Skip to content

Commit 709e6c1

Browse files
authored
Merge pull request #129 from Avasam/Recover-from-closed-capture-window
Recover from closed capture window Fixes #94
2 parents 82a2d05 + 84a5bb4 commit 709e6c1

File tree

12 files changed

+6508
-254
lines changed

12 files changed

+6508
-254
lines changed

.flake8

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ per-file-ignores=
1212
__init__.pyi:Q000
1313
; PyQt methods
1414
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent
15-
; TODO: Bring down to 15, same as SonarLint
16-
max-complexity=55
15+
; McCabe max-complexity is also taken care of by Pylint and doesn't fail teh build there
16+
; So this is the hard limit
17+
max-complexity=32
1718
inline-quotes="

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
npm install -g pyright
4545
- run: scripts/compile_resources.bat
4646
- name: Analysing the code with ${{ job.name }}
47-
run: pyright
47+
run: pyright --warnings
4848
Pylint:
4949
runs-on: windows-latest
5050
strategy:

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ typeCheckingMode = "strict"
1818
ignore = [
1919
# Auto generated
2020
"src/gen/",
21+
# We expect stub files to be incomplete or contain useless statements as they're external
2122
"typings/",
2223
]
2324
reportMissingTypeStubs = "information"
@@ -36,7 +37,7 @@ reportUnknownMemberType = "none"
3637
# https://pylint.pycqa.org/en/latest/technical_reference/features.html
3738
[tool.pylint.REPORTS]
3839
# Just like default but any error will make drop to 9 or less
39-
evaluation = "10.0 - error - ((float(warning + refactor + convention) / statement) * 10)"
40+
evaluation = "10.0 - error - ((float(warning * 10 + refactor + convention) / statement) * 10)"
4041
[tool.pylint.MASTER]
4142
fail-under = 9.0
4243
# https://pylint.pycqa.org/en/latest/technical_reference/extensions.html
@@ -65,10 +66,10 @@ load-plugins = [
6566
# "pylint.extensions.for_any_all",
6667
]
6768
ignore-paths = [
68-
# Haven't looked into disabling specific rules per file
69-
"^typings/.*$",
7069
# Auto generated
7170
"^src/gen/.*$",
71+
# We expect stub files to be incomplete or contain useless statements as they're external
72+
"^typings/.*$",
7273
]
7374
# No need to mention the fixmes
7475
disable = ["fixme"]
@@ -78,7 +79,11 @@ extension-pkg-allow-list = ["PyQt6", "win32ui"]
7879
max-line-length = 120
7980

8081
[tool.pylint.DESIGN]
81-
max-attributes = 15
82+
# Same as SonarLint
83+
max-args = 7
84+
# Arbitrary to 2 bytes
85+
max-attributes = 16
86+
max-locals = 16
8287

8388
[tool.pylint.'MESSAGES CONTROL']
8489
# Same as SonarLint

scripts/lint.ps1

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1-
echo "`nRunning Pyright..."
2-
pyright
1+
$originalDirectory = $pwd
2+
cd "$PSScriptRoot\.."
3+
Write-Host $Script:MyInvocation.MyCommand.Path
4+
$exitCodes = 0
35

4-
echo "`nRunning Pylint..."
6+
Write-Host "`nRunning Pyright..."
7+
pyright --warnings
8+
$exitCodes += $LastExitCode
9+
if ($LastExitCode -gt 0) {
10+
Write-Host "`Pyright failed ($LastExitCode)" -ForegroundColor Red
11+
} else {
12+
Write-Host "`Pyright passed" -ForegroundColor Green
13+
}
14+
15+
Write-Host "`nRunning Pylint..."
516
pylint --score=n --output-format=colorized $(git ls-files '**/*.py*')
17+
$exitCodes += $LastExitCode
18+
if ($LastExitCode -gt 0) {
19+
Write-Host "`Pylint failed ($LastExitCode)" -ForegroundColor Red
20+
} else {
21+
Write-Host "`Pylint passed" -ForegroundColor Green
22+
}
623

7-
echo "`nRunning Flake8..."
24+
Write-Host "`nRunning Flake8..."
825
flake8
26+
$exitCodes += $LastExitCode
27+
if ($LastExitCode -gt 0) {
28+
Write-Host "`Flake8 failed ($LastExitCode)" -ForegroundColor Red
29+
} else {
30+
Write-Host "`Flake8 passed" -ForegroundColor Green
31+
}
932

10-
echo "`nRunning Bandit..."
33+
Write-Host "`nRunning Bandit..."
1134
bandit -f custom --silent --recursive src
35+
# $exitCodes += $LastExitCode # Returns 1 on low
36+
if ($LastExitCode -gt 0) {
37+
Write-Host "`Bandit warning ($LastExitCode)" -ForegroundColor Yellow
38+
} else {
39+
Write-Host "`Bandit passed" -ForegroundColor Green
40+
}
41+
42+
43+
if ($exitCodes -gt 0) {
44+
Write-Host "`nLinting failed ($exitCodes)" -ForegroundColor Red
45+
} else {
46+
Write-Host "`nLinting passed" -ForegroundColor Green
47+
}
48+
49+
cd $originalDirectory

scripts/start.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CALL "%~p0compile_resources.bat"
2-
py -3.9 "%~p0..\src\AutoSplit.py"
2+
py -3.9 "%~p0..\src\AutoSplit.py" %*

0 commit comments

Comments
 (0)