From c806a49623ea85180acb70014356b79ac407138c Mon Sep 17 00:00:00 2001 From: Max <143429685+RandomProgramm3r@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:42:17 +0300 Subject: [PATCH 1/4] ci: Update linting.yml --- .github/workflows/linting.yml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index d5221cb..b0ed05e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,7 +1,7 @@ name: Linting on: push: - branches: [main, develop] + branches: [main, develop, ci] pull_request: branches: [main, develop] workflow_dispatch: @@ -13,28 +13,15 @@ jobs: matrix: python-version: ["3.12"] steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Cache pip - uses: actions/cache@v3 + - name: Run Ruff via Action + uses: astral-sh/ruff-action@v3.2.2 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/dev.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/dev.txt - - - name: Run linters - run: | - black . --check --verbose - isort . --check --verbose - flake8 . --count --show-source --statistics + github-token: ${{ secrets.GITHUB_TOKEN }} From b4477b67931531f23f76fac6b85802d89c6f1444 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 18 Apr 2025 21:01:31 +0300 Subject: [PATCH 2/4] ci(lint): bump Python to 3.13 and fix Ruff C420 - Bump Python version in GitHub Actions matrix from 3.12 to 3.13 - Adjust Ruff rule C420 (redundant return in generator) to prevent false positives --- .github/workflows/linting.yml | 2 +- promo_code/user/validators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b0ed05e..1a6329c 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/promo_code/user/validators.py b/promo_code/user/validators.py index bc0a0eb..2a62b5e 100644 --- a/promo_code/user/validators.py +++ b/promo_code/user/validators.py @@ -82,7 +82,7 @@ def __call__(self, value): if missing_fields: raise rest_framework.serializers.ValidationError( - {field: 'This field is required.' for field in missing_fields}, + dict.fromkeys(missing_fields, 'This field is required.'), ) serializer = self.__class__(data=value) From df926f2355d1ff9dede55a64ccbcb27b53ec100c Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 18 Apr 2025 21:16:12 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D1=81hore(lint):=20migrate=20linting=20fro?= =?UTF-8?q?m=20flake8/isort/black=20to=20ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove config files: .flake8, .isort.cfg, pyproject.toml - Uninstall dependencies: black, flake8, isort, requirements\flake8-plugins.txt --- .flake8 | 10 ---------- .isort.cfg | 7 ------- pyproject.toml | 5 ----- requirements/dev.txt | 5 +---- requirements/flake8-plugins.txt | 12 ------------ requirements/test.txt | 1 - 6 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 .flake8 delete mode 100644 .isort.cfg delete mode 100644 pyproject.toml delete mode 100644 requirements/flake8-plugins.txt diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 2a6fa7d..0000000 --- a/.flake8 +++ /dev/null @@ -1,10 +0,0 @@ -[flake8] -max-line-length = 79 -application_import_names = promo_code, user, core, business -import-order-style = google -exclude = */migrations/, venv/, verdict.py, .venv/, env/, venv, .git, __pycache__ -max-complexity = 10 -max-expression-complexity = 7 - -[flake8-quotes] -quote-style = single \ No newline at end of file diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 0f5f77b..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -profile = black -skip = migrations, venv/, venv -known_first_party = promo_code, user, core, business -default_section = THIRDPARTY -force_sort_within_sections = true -line_length = 79 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index f86b994..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,5 +0,0 @@ -[tool.black] -line-length = 79 -skip-string-normalization = true -target-version = ['py313'] -exclude = ".venv" \ No newline at end of file diff --git a/requirements/dev.txt b/requirements/dev.txt index 8be14f0..a5331ab 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,7 +1,4 @@ -r prod.txt -r test.txt -black==24.8.0 -flake8==7.1.1 -isort==5.13.2 ruff==0.11.5 -sort-requirements==1.3.0 \ No newline at end of file +sort-requirements==1.3.0 diff --git a/requirements/flake8-plugins.txt b/requirements/flake8-plugins.txt deleted file mode 100644 index 5f4d517..0000000 --- a/requirements/flake8-plugins.txt +++ /dev/null @@ -1,12 +0,0 @@ -flake8-absolute-import==1.0.0.2 -flake8-bugbear==24.8.19 -flake8-clean-block==0.1.2 -flake8-commas==4.0.0 -flake8-eradicate==1.5.0 -flake8-expression-complexity==0.0.11 -flake8-implicit-str-concat==0.5.0 -flake8-print==5.0.0 -flake8-quotes==3.4.0 -flake8-return==1.2.0 -flake8-use-pathlib==0.3.0 -pep8-naming==0.14.1 \ No newline at end of file diff --git a/requirements/test.txt b/requirements/test.txt index 49553db..62a33be 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,3 +1,2 @@ --r flake8-plugins.txt django-debug-toolbar==4.4.6 parameterized==0.9.0 From 14bd97e50bd628fb53e79c27f189c677c5d29f14 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 18 Apr 2025 21:17:47 +0300 Subject: [PATCH 4/4] ci: Update linting.yml --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 1a6329c..56bbcb2 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,7 +1,7 @@ name: Linting on: push: - branches: [main, develop, ci] + branches: [main, develop] pull_request: branches: [main, develop] workflow_dispatch: