Skip to content

Commit 193e870

Browse files
authored
Merge pull request #240 from Toufool/ruff-to-master
Use Ruff ! (#207)
2 parents 75a8f39 + d8c76b4 commit 193e870

32 files changed

+548
-692
lines changed

.flake8

-37
This file was deleted.

.github/workflows/lint-and-build.yml

+9-58
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ env:
3434
GITHUB_EXCLUDE_BUILD_NUMBER: ${{ inputs.excludeBuildNumber }}
3535

3636
jobs:
37-
isort:
37+
ruff:
3838
runs-on: windows-latest
39+
strategy:
40+
fail-fast: false
41+
# Ruff is version and platform sensible
42+
matrix:
43+
python-version: ["3.9", "3.10", "3.11"]
3944
steps:
4045
- name: Checkout ${{ github.repository }}/${{ github.ref }}
4146
uses: actions/checkout@v3
42-
- name: Set up Python 3.11
47+
- name: Set up Python ${{ matrix.python-version }}
4348
uses: actions/setup-python@v4
4449
with:
45-
python-version: "3.11"
50+
python-version: ${{ matrix.python-version }}
4651
cache: "pip"
4752
cache-dependency-path: "scripts/requirements*.txt"
4853
- run: scripts/install.ps1
4954
shell: pwsh
50-
- name: Analysing the code with isort
51-
run: isort src/ typings/ --check-only
55+
- run: ruff check .
5256
add-trailing-comma:
5357
runs-on: windows-latest
5458
steps:
@@ -61,19 +65,6 @@ jobs:
6165
- run: pip install add-trailing-comma
6266
- name: Analysing the code with add-trailing-comma
6367
run: add-trailing-comma $(git ls-files '**.py*') --py36-plus
64-
Bandit:
65-
# Bandit only matters on the version deployed. Platform checks are ignored
66-
runs-on: windows-latest
67-
steps:
68-
- name: Checkout ${{ github.repository }}/${{ github.ref }}
69-
uses: actions/checkout@v3
70-
- name: Set up Python 3.11
71-
uses: actions/setup-python@v4
72-
with:
73-
python-version: "3.11"
74-
- run: pip install bandit
75-
- name: Analysing the code with Bandit
76-
run: bandit src/ -n 1 --severity-level medium --recursive
7768
Pyright:
7869
runs-on: windows-latest
7970
strategy:
@@ -96,46 +87,6 @@ jobs:
9687
uses: jakebailey/pyright-action@v1
9788
with:
9889
working-directory: src/
99-
Pylint:
100-
runs-on: windows-latest
101-
strategy:
102-
fail-fast: false
103-
# Pylint is version and platform sensible
104-
matrix:
105-
python-version: ["3.9", "3.10", "3.11"]
106-
steps:
107-
- name: Checkout ${{ github.repository }}/${{ github.ref }}
108-
uses: actions/checkout@v3
109-
- name: Set up Python ${{ matrix.python-version }}
110-
uses: actions/setup-python@v4
111-
with:
112-
python-version: ${{ matrix.python-version }}
113-
cache: "pip"
114-
cache-dependency-path: "scripts/requirements*.txt"
115-
- run: scripts/install.ps1
116-
shell: pwsh
117-
- name: Analysing the code with Pylint
118-
run: pylint src/ --reports=y --output-format=colorized
119-
Flake8:
120-
runs-on: windows-latest
121-
strategy:
122-
fail-fast: false
123-
# Flake8 is tied to the version of Python on which it runs. Platform checks are ignored
124-
matrix:
125-
python-version: ["3.9", "3.10", "3.11"]
126-
steps:
127-
- name: Checkout ${{ github.repository }}/${{ github.ref }}
128-
uses: actions/checkout@v3
129-
- name: Set up Python ${{ matrix.python-version }}
130-
uses: actions/setup-python@v4
131-
with:
132-
python-version: ${{ matrix.python-version }}
133-
cache: "pip"
134-
cache-dependency-path: "scripts/requirements*.txt"
135-
- run: scripts/install.ps1
136-
shell: pwsh
137-
- name: Analysing the code with Flake8
138-
run: flake8 src/ typings/
13990
Build:
14091
runs-on: windows-latest
14192
strategy:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# Caches
4-
.cache/
4+
.*cache/
55

66
# Byte-compiled / optimized / DLL files
77
__pycache__/

.vscode/extensions.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66
"eamodio.gitlens",
77
"emeraldwalk.runonsave",
88
"ms-python.autopep8",
9-
"ms-python.flake8",
10-
"ms-python.isort",
11-
"ms-python.pylint",
129
"ms-python.python",
1310
"ms-python.vscode-pylance",
1411
"ms-vscode.powershell",
1512
"pkief.material-icon-theme",
1613
"redhat.vscode-xml",
1714
"redhat.vscode-yaml",
18-
"shardulm94.trailing-spaces",
1915
],
2016
"unwantedRecommendations": [
2117
// Must disable in this workspace //
@@ -24,13 +20,18 @@
2420
// VSCode has implemented an optimized version
2521
"coenraads.bracket-pair-colorizer",
2622
"coenraads.bracket-pair-colorizer-2",
23+
"shardulm94.trailing-spaces",
2724
// Obsoleted by Pylance
2825
"ms-pyright.pyright",
2926
// Not configurable per workspace, tends to conflict with other linters
3027
"sonarsource.sonarlint-vscode",
3128
//
3229
// Don't recommend to autoinstall //
3330
//
31+
// Use Ruff instead
32+
"ms-python.flake8",
33+
"ms-python.isort",
34+
"ms-python.pylint",
3435
// We use autopep8
3536
"ms-python.black-formatter",
3637
// This is a Git project

.vscode/settings.json

+17-62
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
72
99
]
1010
},
11-
"trailing-spaces.includeEmptyLines": true,
12-
"trailing-spaces.trimOnSave": true,
13-
"trailing-spaces.syntaxIgnore": [
14-
"markdown"
15-
],
1611
"[markdown]": {
1712
"files.trimTrailingWhitespace": false,
1813
},
@@ -28,14 +23,10 @@
2823
"source.fixAll": true,
2924
"source.fixAll.unusedImports": false,
3025
"source.fixAll.convertImportFormat": true,
31-
"source.organizeImports": true,
26+
"source.organizeImports": false,
3227
},
3328
"emeraldwalk.runonsave": {
3429
"commands": [
35-
{
36-
"match": "\\.pyi?",
37-
"cmd": "unify ${file} --in-place --quote=\"\\\"\""
38-
},
3930
{
4031
"match": "\\.pyi?",
4132
"cmd": "add-trailing-comma ${file} --py36-plus"
@@ -62,9 +53,13 @@
6253
"**/*.code-search": true,
6354
"*.lock": true,
6455
},
56+
// Set the default formatter to help avoid Prettier
57+
"[json][jsonc]": {
58+
"editor.defaultFormatter": "vscode.json-language-features",
59+
},
6560
"[python]": {
66-
// Cannot use autotpep8 until https://github.com/microsoft/vscode-autopep8/issues/32 is fixed
67-
"editor.defaultFormatter": "ms-python.python",
61+
// Ruff is not yet a formatter: https://github.com/charliermarsh/ruff/issues/1904
62+
"editor.defaultFormatter": "ms-python.autopep8",
6863
"editor.tabSize": 4,
6964
"editor.rulers": [
7065
72, // PEP8-17 docstrings
@@ -77,60 +72,20 @@
7772
// Important to follow the config in pyrightconfig.json
7873
"python.analysis.useLibraryCodeForTypes": false,
7974
"python.analysis.diagnosticMode": "workspace",
80-
"python.formatting.provider": "autopep8",
81-
"isort.check": true,
82-
"isort.importStrategy": "fromEnvironment",
8375
"python.linting.enabled": true,
84-
// Use the new Pylint extension instead
85-
"python.linting.pylintEnabled": false,
86-
"pylint.severity": {
87-
"convention": "Warning",
88-
"error": "Error",
89-
"fatal": "Error",
90-
"refactor": "Warning",
91-
"warning": "Warning",
92-
"info": "Information"
93-
},
94-
// Use the new Flake8 extension instead
76+
"ruff.importStrategy": "fromEnvironment",
77+
// Use the Ruff extension instead
78+
"isort.check": false,
79+
"python.linting.banditEnabled": false,
9580
"python.linting.flake8Enabled": false,
96-
// Partial codes don't work yet: https://github.com/microsoft/vscode-flake8/issues/7
97-
"flake8.severity": {
98-
"convention": "Warning",
99-
"error": "Error",
100-
"fatal": "Error",
101-
"refactor": "Warning",
102-
"warning": "Warning",
103-
"info": "Warning",
104-
// builtins
105-
"A": "Warning",
106-
// mccabe
107-
"C": "Warning",
108-
// class attributes order
109-
"CCE": "Warning",
110-
// pycodestyles
111-
"E": "Warning",
112-
"E9": "Error", // Runtime
113-
"W": "Warning",
114-
"W6": "Error", // Deprecation warning
115-
// Pyflakes
116-
"F": "Warning",
117-
// PEP8 Naming convention
118-
"N": "Warning",
119-
// Simplify
120-
"SIM": "Warning",
121-
"SIM9": "Information",
122-
// PYI
123-
"Y": "Warning",
124-
},
125-
// PyRight obsoletes mypy
126-
"python.linting.mypyEnabled": false,
127-
// Is already wrapped by Flake8, prospector and pylama
128-
"python.linting.pycodestyleEnabled": false,
129-
// Just another wrapper, use Flake8 OR this
13081
"python.linting.prospectorEnabled": false,
131-
// Just another wrapper, use Flake8 OR this
82+
"python.linting.pycodestyleEnabled": false,
13283
"python.linting.pylamaEnabled": false,
133-
"python.linting.banditEnabled": true,
84+
"python.linting.pylintEnabled": false,
85+
// Use the autopep8 extension instead
86+
"python.formatting.provider": "none",
87+
// Use Pyright/Pylance instead
88+
"python.linting.mypyEnabled": false,
13489
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
13590
"powershell.codeFormatting.autoCorrectAliases": true,
13691
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,

PyInstaller/hooks/hook-requests.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from PyInstaller.utils.hooks import collect_data_files
24

35
# Get the cacert.pem

0 commit comments

Comments
 (0)