Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #190

Merged
merged 34 commits into from
Sep 19, 2024
Merged

Refactoring #190

merged 34 commits into from
Sep 19, 2024

Conversation

meanmail
Copy link
Contributor

Issues:
Issue#

Description:

Replaced `requirements` files and `setup.py` with `pyproject.toml` for Poetry. Updated Dockerfile to use Poetry for project build and dependency installation, and added a new GitHub Actions workflow for sorting whitelists.
@meanmail meanmail changed the base branch from main to develop September 18, 2024 13:34
meanmail added 28 commits September 18, 2024 15:51
Added username and password for the container registry to ensure proper authentication during workflow execution. This change will help avoid issues related to image pulling from the private registry.
A missing brace in the image reference was corrected. This ensures that the proper Docker image is used during the build steps for both jobs. This also prevents potential runtime errors during CI/CD pipelines.
Reformatted RUN commands in the Dockerfile for improved readability and consistency by chaining them with backslashes. Added commands to remove temporary files after use, enhancing cleanliness and reducing image size.
Changed test execution commands in Dockerfile and GitHub Actions workflow to use 'python -m pytest' instead of 'pytest'. This ensures consistent module execution and resolves potential issues with poetry.
Added concurrency settings to the sort_whitespaces, build_base_image, publish, and build workflows to manage job execution and prevent redundant concurrent runs. Updated flake8 lint commands in the build workflow to use Poetry for module execution.
The build.yml file now specifies that actions should be triggered on pushes to the 'main' and 'develop' branches. This change ensures that the workflows are built and tested on these key branches.
Updated the `.github/workflows/sort_whitespaces.yml`, `.github/workflows/publish.yml`, and `.github/workflows/build.yml` files to use self-hosted runners with a small configuration. This change aims to leverage available self-hosted resources for running GitHub Actions.
Updated the GitHub Actions workflow to include specific paths for filtering events. This ensures that changes to 'whitelist.txt' and the specified 'hyperstyle' path trigger the workflow.
Updated the workflow name in the 'publish.yml' file to specify its purpose more clearly. This change improves readability and helps maintainers quickly understand the workflow's action.
Upgraded grpcio-tools from 1.51.1 to 1.66.1 and protobuf from 4.25.4 to 5.28.1 in pyproject.toml and poetry.lock to the latest versions. Updated Dockerfile to adjust paths and improve build context. These changes improve compatibility and maintain security standards.
# Conflicts:
#	.github/workflows/build.yml
#	requirements.txt
This change modifies the build workflow to run Python commands using 'python -m' instead of directly invoking with Poetry. It ensures better compatibility and consistency for package execution in environments using Poetry.
# Conflicts:
#	.github/workflows/build_base_image.yml
Simplified the ENV variable syntax by eliminating spaces around the '=' sign. Additionally, added the '-o' flag to the unzip commands to prevent potential file overwrites and updated the URLs for fetching `epicbox-go` resources. These changes enhance script robustness and maintain error-free behavior.
Updated the Go version in the base image to 1.21.6 for compatibility and security improvements. Removed unnecessary options in unzip
This commit updates the Docker base image to use Go 1.18.5 instead of Go 1.21.6. It also updates the URLs for third-party Go libraries to new versions for better compatibility and stability.
Changed the URLs for downloading the `go.mod`, `go.sum`, and `main.go` files to point to the StepicOrg repository. This ensures that the Docker build process uses the correct and updated resources for the third-party Go libraries.
Updated the Python base image from version 3.8.11 to 3.12.5 in the Dockerfile. This change ensures compatibility with the latest Python features and dependencies. No other modifications were made to the Docker setup.
Switching from Python 3.8.11 to 3.12.5 for improved features and performance enhancements. Ensure compatibility with the newer version in your development environment.
Upgraded `asgiref` to v3.8.1 and replaced `chardet` with `charset-normalizer` v3.3.2. Removed `atomicwrites` and `backports-zoneinfo` as they are no longer required.
This change prevents Docker from including linter files in the image, which helps to reduce image size and unnecessary clutter. Linters are not required for the runtime environment, so excluding them ensures a cleaner and more efficient Docker image.
Changed the default tag and Dockerfile base image from Python 3.12.5 to 3.11.9. Ensures compatibility with required dependencies while maintaining security updates.
Revert Python version to 3.11 and downgrade Django to 4.0.10 to ensure compatibility with existing tools. Added setuptools version 56.0.0 as a required dependency.
This commit upgrades the wps-light dependency from version 0.15.2 to 0.15.3 in the pyproject.toml file. This ensures the project benefits from the latest fixes and improvements provided in the newer version.
Previously, the CMD directive in the Dockerfile was configured to run a specific test file. This change updates the CMD to run the entire suite of pytest tests, ensuring all tests are executed by default.
Reverts Python version from 3.12.5 to 3.10.14 in various configuration files to maintain compatibility with dependencies. Updated Docker base images and added several new dependencies to match the new environment setup.
meanmail added 5 commits September 19, 2024 13:06
Changed the default Python version from 3.11.9 to 3.10.14 in the GitHub Actions workflow configuration. This ensures compatibility with existing dependencies and avoids issues with newer releases.
The build workflow now includes changing to the /review directory before executing tests. This ensures that tests are run in the correct context and can locate all necessary dependencies.
Replaced 'python -m pytest' with 'pytest' for running tests. Added 'cd /review' command before running linters and tool checks to ensure the correct working directory is set. This change improves consistency and reliability of the build process.
Changed the test execution command in the build workflow from `poetry run pytest` to `poetry run python -m pytest`. This ensures compatibility and consistency when running tests within the specified review directory.
Switched to using sys.executable in multiple files for better flexibility with the Python interpreter. Updated the Dockerfile to create and use a virtual environment, and adjusted related workflow scripts to use the virtual environment's executables. Added a new GitHub Actions workflow for building the Docker image after a release.
@meanmail meanmail merged commit b5b6e3b into develop Sep 19, 2024
4 checks passed
@meanmail meanmail deleted the refactoring branch September 19, 2024 13:47
meanmail added a commit that referenced this pull request Sep 19, 2024
* PMD update (#161)

* Add LanguageVersion.JAVA_17

* Add B007's custom tip

* Add W1404 and R1721' custom tips

* Add new words

* Add some inspections in ignore

* Sort whitelists (Github Actions)

* Add WPS442

* Remove W0621

* Add java17

* Update PMD to 6.47.0

* Add java17

* Update PMD to 6.47.0

* Update PMD to 6.47.0

* Remove unnecessary whitespaces

* Add test for Java 17

* Bump version 1.2.7 -> 1.2.8

* Add trailing new line

* Try to update docker image

* Bump version 1.2.8 -> 1.3.0

Co-authored-by: GirZ0n <GirZ0n@users.noreply.github.com>
Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>

* Inspectors architecture refactoring (#162)

* Add LanguageVersion.JAVA_17

* Add B007's custom tip

* Add W1404 and R1721' custom tips

* Add new words

* Add some inspections in ignore

* Sort whitelists (Github Actions)

* Add WPS442

* Remove W0621

* Add flake8 data folder

* Add is_fstring function

* Add `get_measure_name_by_measurable_issue_type` function

* Add metric codes

* Refactor some strings into format strings

* Add new words

* Fix flake8 issues

* Add IssueConfig, IssueDescriptionParser and IssueConfigsHandler

* Refactor flake8 using new IssueConfigsHandler class

* Add issue configs tests

* Sort whitelists (Github Actions)

* Typo fix

* Typo fix

* Typo fix

* Remove unnecessary tests and add some more ones

* Add one more test

* Rename test data

* Remove unnecessary tests and add some more

* Move augmented assign pattern tip to `tips.py`

* Remove unnecessary dicts

* Require the `new_description` field

* Fix tests

* Accept only a dictionary in IssueDescriptionParser

* Fix tests

* Add new tests

* Add new tests

* Fix problems with escaped characters

* Move some common files into common folder

* Add new pylint's tests

* Refactor pylint

* Fix imports

* Fix imports

* Move common code into a new function

* Refactor pmd

* Refactor checkstyle and add new tests

* Update tips

* Refactor xml parser

* Fix tests

* Fix description

* Remove unused impoty

* Change default argument for get_magic_number_tip

* Refactor detekt

* Fix import style

* Add new tests for pylint

* Refactor eslint

* Add new tests for eslint

* Bump version 1.3.0 -> 1.3.1

* Update todo

* Fix comment

* Fix import

* Change the order of checks in __post_init__ and fix typos

* Add new tests

* Remove unnecessary typing

* Fix import style

* Try to update docker image

Co-authored-by: GirZ0n <GirZ0n@users.noreply.github.com>
Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>

* Golang support (#154)

* Add Golang config

* Add Go language

* Add new words

* Add Go language

* Add golangci-lint inspector

* Add golang and golangci-lint

* Sort whitelists (Github Actions)

* Add new words

* Add metric linter names

* Sort whitelists (Github Actions)

* Add lightbulb

* Sort whitelists (Github Actions)

* Sort whitelists (Github Actions)

* Fix #151: disable AbstractClassWithoutAbstractMethod.

* Undo 6c8d506

* Add get_extension_from_file

* Fix the bug that caused the tool to fail

* Add test

* Fix code style

* Script for setting up the environment (#155)

* Add a script for setting up the environment

* Fix typo

* Update README

* Update README

* Fix PR issues

* Fix extensions

* Update VERSION.md

* Add WIP config

* Fix golangci-lint's download command

* Add golangci-lint download

* Add working directory argument

* Add ability to analyze folders

* Fix extension

* Fix typo

* Fix extension

* Update golangci-lint to 1.47.1

* Fix generics

* Fix incorrect opening of Go projects without go.mod files

* Add concurrency flag

* Add issue types

* Fix typo

* Add noqa flag

* Fix #156 (#157)

* Add get_extension_from_file

* Fix the bug that caused the tool to fail

* Add test

* Fix code style

* Fix extensions

* Update VERSION.md

* Add logging

* Move go installation into Dockerfile.base

* Add --allow-parallel-runners flag

* Fix curl flags

* Fix typo

* Fix configs

* Move is_result_file_correct to common utils

* Rename GolangLint -> GolangLintInspector

* Small fixes:
1. Rename GolangLint -> GolangLintInspector;
2. Add a check for an invalid output file
3. Fix description regexp
4. Fix description style
5. Fix comment

* Add some golang tests

* Add a trailing new line

* Fix typo

* Remove gocognit

* Add go data folder

* Add tests

* Fix typo

* Add `n_line_len` and `n_info`

* Add some more tests

* Rename a variable

* Fix flake8 issue

* Add some more tests

* Bump version to 1.4.0

* Added a new test case

* Remove an unnecessary field

* Remove an unnecessary field and replace `deadcode` with `unused`

* Bump `golangci-lint` version: 1.47.1 -> 1.49.0

* Remove deprecated linters

* Fix tests

* Add new linter

* Fix config

* Fix import and measure's descriptions

* Fix import

* Move `is_result_file_correct` function to `utils.py`

* Move inspector to a new architecture

* Add new tests

* Add issue configs

* Fix config

* Fix config

* Fix typo

* Add installation of third party golang libraries

* Add _is_metalinter_issue

* Remove blank line

* Try to update docker image

* Change container

Co-authored-by: GirZ0n <GirZ0n@users.noreply.github.com>
Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>

* Contribution guideline (#166)

* Create CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Fix link

* Update CONTRIBUTING.md

* Update go config

* Run inspectors on code without files (#169)

* Try to add in memory api

* Fix requirements conflicts

* Fix flake8

* Add inspect_in_memory fo inspectors

* Try to support in memory inspectors

* Fix styles

* Fix styles and add more helpers

* Try to adapt flake8 and run_in_subprocess function

* Try to fix teamcity tests

* Fix flake

* Try to fix teamcity

* Try to fix teamcity

* Fix tests

* added inspect_in_memory for pyling inspector (#168)

* added inspect_in_memory for pyling inspector

* fix formatting

* Fix tests

Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>

* Update version

Co-authored-by: Sergey Titov <72385325+TitovSergey@users.noreply.github.com>

* ML-149: IJ inspector based on code server (#171)

* Add simple ij inspector

* Move code server params to env variables and update Dockerfile

* Fix flake8

* Fix flake8

* Fix flake8

* Fix flake8

* Sort whitelists (Github Actions)

* Try to fix tests

* Fix code style

* Wrap server connection with try/catch

* Remove test main

* Fix tests

* Edit README.md

* Fix review comments

Co-authored-by: tiginamaria <tiginamaria@users.noreply.github.com>
Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>

* Add timeout to request (#172)

* Fix go linter and fix an error in README (#174)

* Disable whitespace inspection for Go and fix a small error in README

* Fix tests

* Update version

* Add issues types for ij python inspections

* Fix flake8

* IJ-Hyperstyle Adaptation (#180)

* Fix ij-inspector (#182)

* Fix ij-inspector

* Fix issues

* Fix styles

* fix: remove an unnecessary quote

* Links fix (#183)

* fix: fix WPS link

* fix: fix golangci-lint link

* fix: fix golangci-lint link

* fix: fix PMD link

* fix: fix Detekt link

* fix: fix checkstyle link

* Kotlin IJ Inspector (#186)

* fix: update .gitignore to exclude unnecessary files

* feat: add IJ Kotlin inspector
feat: add the `ij-config` argument
feat: add BaseIJInspector
refactor: move several inspector-related files to the common folder

* fix: update flake8 run command

* docs: refined the `--ij-config` argument description

* fix: update test configuration to disable IJ_PYTHON and IJ_KOTLIN

* fix: add the `ij_config` argument to test command builder

* fix: fix tests

* fix: add IJ_KOTLIN to an inspector types list

* style: fix flake8's issues

* refactor: rename variable for clarity in common.py

* style: fix flake8's issue

* docs: rearrange wording for consistent format in README

* fix: fix PR issues

* style: fix flake8's issues

* fix: bump the version number

* Refactor build system (#187)

* fix: update .gitignore to exclude unnecessary files

* feat: add IJ Kotlin inspector
feat: add the `ij-config` argument
feat: add BaseIJInspector
refactor: move several inspector-related files to the common folder

* fix: update flake8 run command

* docs: refined the `--ij-config` argument description

* fix: update test configuration to disable IJ_PYTHON and IJ_KOTLIN

* fix: add the `ij_config` argument to test command builder

* fix: fix tests

* fix: add IJ_KOTLIN to an inspector types list

* style: fix flake8's issues

* refactor: rename variable for clarity in common.py

* style: fix flake8's issue

* docs: rearrange wording for consistent format in README

* refactor: refactor build system

* fix: try to fix workflows

* fix: try to fix workflows

* style: fix flake8's issue

* fix: remove MANIFEST.in

* fix: update project license type and remove unneeded sections

* feat: update setup.py for generating proto files

* fix: add protobuf compilation step to build workflow

* bump: bump the tool version

* fix: update a proto path in build workflow

* fix: add proto generation to Dockerfile

* fix: fix incorrect ENV syntax in Dockerfile

* fix: update PROTO_PATH in Dockerfile

* refactor: refactor dependencies structure

* fixL fix a comment

* refactor: refactor Dockerfile, optimizing sequence of commands

* feat: add new directories to .dockerignore

* fix: return dependencies installation

* fix: specify versions for setuptools and setuptools-scm

* style: remove unnecessary cd

* fix: remove redundant dependencies

* fix: removed unnecessary step

* fix: fix the GitHub workflow

* fix: update project author in pyproject.toml

* docs: update README.md installation instructions

* fix: update the build system requires and exclude unnecessary files

* fix: fix a small bug where the inspector type for `BaseIJInspector` was always `IJ_PYTHON` (#188)

* Refactoring (#190)

* Switch to Poetry for dependency management

Replaced `requirements` files and `setup.py` with `pyproject.toml` for Poetry. Updated Dockerfile to use Poetry for project build and dependency installation, and added a new GitHub Actions workflow for sorting whitelists.

* Switch workflows to self-hosted runners

Updated the `.github/workflows/sort_whitespaces.yml`, `.github/workflows/publish.yml`, and `.github/workflows/build.yml` files to use self-hosted runners with a small configuration. This change aims to leverage available self-hosted resources for running GitHub Actions.

* Upgrade grpcio-tools and protobuf versions

Upgraded grpcio-tools from 1.51.1 to 1.66.1 and protobuf from 4.25.4 to 5.28.1 in pyproject.toml and poetry.lock to the latest versions. Updated Dockerfile to adjust paths and improve build context. These changes improve compatibility and maintain security standards.

* Update Python version to 3.10.14

Switching from Python 3.8.11 to 3.10.14 for improved features and performance enhancements. Ensure compatibility with the newer version in your development environment.

* Update wps-light to version 0.15.3

This commit upgrades the wps-light dependency from version 0.15.2 to 0.15.3 in the pyproject.toml file. This ensures the project benefits from the latest fixes and improvements provided in the newer version.

* Use sys.executable and refactor Dockerfile for venv

Switched to using sys.executable in multiple files for better flexibility with the Python interpreter. Updated the Dockerfile to create and use a virtual environment, and adjusted related workflow scripts to use the virtual environment's executables. Added a new GitHub Actions workflow for building the Docker image after a release.

---------

Co-authored-by: meanmail <meanmail@meanmail.dev>

* Remove VERSION.md file

The VERSION.md file has been deleted to streamline project maintenance. Version tracking will now rely on internal systems rather than a separate file.

* Update string prefix removal method

Replaced the custom `remove_prefix` function with Python's built-in `removeprefix` method for better readability and efficiency. This change modernizes the code and leverages Python's built-in capabilities.

* Remove default disabled inspectors

Removed the default 'ij_python' inspector from the disabled set in the `run_tool.py` file. This change prepares the code for production by ensuring no inspectors are disabled by default.

* Revert version to 1.5.0 in pyproject.toml

Reverting the version number from 1.5.1 back to 1.5.0. This change rectifies an unintended version increment in the previous update.

* Remove unused import in pmd.py

Remove the `remove_prefix` import from `pmd.py` which is not being used in the code. This helps to clean up the code and avoid unnecessary imports.

---------

Co-authored-by: Ilya Vlasov <55441714+GirZ0n@users.noreply.github.com>
Co-authored-by: GirZ0n <GirZ0n@users.noreply.github.com>
Co-authored-by: Anastasiia.Birillo <nbirillo@mail.ru>
Co-authored-by: GirZ0n <ilyavlasov2011@gmail.com>
Co-authored-by: Sergey Titov <72385325+TitovSergey@users.noreply.github.com>
Co-authored-by: Maria Tigina <31625351+tiginamaria@users.noreply.github.com>
Co-authored-by: tiginamaria <tiginamaria@users.noreply.github.com>
Co-authored-by: anastasia.birillo <anastasia.i.birillo@gmail.com>
Co-authored-by: Ilya Vlasov <ilya.vlasov@jetbrains.com>
Co-authored-by: meanmail <meanmail@meanmail.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant