Skip to content

Commit fc0ddc6

Browse files
authored
feat: Upgrade Python linting from flake8 to ruff (#2815)
[Ruff](https://beta.ruff.rs/) supports [over 500 lint rules](https://beta.ruff.rs/docs/rules) including bandit, isort, pylint, pyupgrade, and flake8 plus its plugins and is written in Rust for speed. This GitHub Action will provide contributors with intuitive GitHub Annotations. ![image](https://user-images.githubusercontent.com/3709715/223758136-afc386d2-70aa-4eff-953a-2c2d82ceea23.png) The `Required` in the checks below should be: 1. Removed from `flake8-annotation` and added to `ruff-annotation` which replaces it. 2. Removed from `isort` and added to `ruff` which replaces it.
1 parent 39ac2c1 commit fc0ddc6

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
pull_request:
99
branches: [ main ]
1010
jobs:
11+
Lint_Python:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- run: pip install --user ruff
16+
- run: ruff --format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="S101,UP031" --target-version=py37 .
1117
Tests:
1218
strategy:
1319
fail-fast: false
@@ -33,15 +39,12 @@ jobs:
3339
- name: Install Dependencies
3440
run: |
3541
npm install --no-progress
36-
pip install flake8 pytest
42+
pip install pytest
3743
- name: Set Windows environment
3844
if: startsWith(matrix.os, 'windows')
3945
run: |
4046
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
4147
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
42-
- name: Lint Python
43-
if: startsWith(matrix.os, 'ubuntu')
44-
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
4548
- name: Run Python tests
4649
run: python -m pytest
4750
# - name: Run doctests with pytest

gyp/pylib/gyp/generator/eclipse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import gyp.common
2525
import gyp.msvs_emulation
2626
import shlex
27-
import xml.etree.cElementTree as ET
27+
import xml.etree.ElementTree as ET
2828

2929
generator_wants_static_library_dependencies_adjusted = False
3030

gyp/pylib/gyp/xcodeproj_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2770,7 +2770,7 @@ def __init__(self, properties=None, id=None, parent=None, path=None):
27702770
self.path = path
27712771
self._other_pbxprojects = {}
27722772
# super
2773-
return XCContainerPortal.__init__(self, properties, id, parent)
2773+
XCContainerPortal.__init__(self, properties, id, parent)
27742774

27752775
def Name(self):
27762776
name = self.path

0 commit comments

Comments
 (0)