mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
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.  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.
This commit is contained in:
parent
39ac2c135d
commit
fc0ddc6523
3 changed files with 9 additions and 6 deletions
11
.github/workflows/tests.yml
vendored
11
.github/workflows/tests.yml
vendored
|
@ -8,6 +8,12 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
jobs:
|
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:
|
Tests:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -33,15 +39,12 @@ jobs:
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install --no-progress
|
npm install --no-progress
|
||||||
pip install flake8 pytest
|
pip install pytest
|
||||||
- name: Set Windows environment
|
- name: Set Windows environment
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
|
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
|
||||||
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $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
|
- name: Run Python tests
|
||||||
run: python -m pytest
|
run: python -m pytest
|
||||||
# - name: Run doctests with pytest
|
# - name: Run doctests with pytest
|
||||||
|
|
|
@ -24,7 +24,7 @@ import gyp
|
||||||
import gyp.common
|
import gyp.common
|
||||||
import gyp.msvs_emulation
|
import gyp.msvs_emulation
|
||||||
import shlex
|
import shlex
|
||||||
import xml.etree.cElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
generator_wants_static_library_dependencies_adjusted = False
|
generator_wants_static_library_dependencies_adjusted = False
|
||||||
|
|
||||||
|
|
|
@ -2770,7 +2770,7 @@ class PBXProject(XCContainerPortal):
|
||||||
self.path = path
|
self.path = path
|
||||||
self._other_pbxprojects = {}
|
self._other_pbxprojects = {}
|
||||||
# super
|
# super
|
||||||
return XCContainerPortal.__init__(self, properties, id, parent)
|
XCContainerPortal.__init__(self, properties, id, parent)
|
||||||
|
|
||||||
def Name(self):
|
def Name(self):
|
||||||
name = self.path
|
name = self.path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue