Skip to content

Commit

Permalink
feat: Upgrade Python linting from flake8 to ruff (#2815)
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
cclauss committed Mar 13, 2023
1 parent 39ac2c1 commit fc0ddc6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/tests.yml
Expand Up @@ -8,6 +8,12 @@ on:
pull_request:
branches: [ main ]
jobs:
Lint_Python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pip install --user ruff
- run: ruff --format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="S101,UP031" --target-version=py37 .
Tests:
strategy:
fail-fast: false
Expand All @@ -33,15 +39,12 @@ jobs:
- name: Install Dependencies
run: |
npm install --no-progress
pip install flake8 pytest
pip install pytest
- name: Set Windows environment
if: startsWith(matrix.os, 'windows')
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Lint Python
if: startsWith(matrix.os, 'ubuntu')
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- name: Run Python tests
run: python -m pytest
# - name: Run doctests with pytest
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/generator/eclipse.py
Expand Up @@ -24,7 +24,7 @@
import gyp.common
import gyp.msvs_emulation
import shlex
import xml.etree.cElementTree as ET
import xml.etree.ElementTree as ET

generator_wants_static_library_dependencies_adjusted = False

Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/xcodeproj_file.py
Expand Up @@ -2770,7 +2770,7 @@ def __init__(self, properties=None, id=None, parent=None, path=None):
self.path = path
self._other_pbxprojects = {}
# super
return XCContainerPortal.__init__(self, properties, id, parent)
XCContainerPortal.__init__(self, properties, id, parent)

def Name(self):
name = self.path
Expand Down

0 comments on commit fc0ddc6

Please sign in to comment.