diff --git a/.flake8 b/.flake8
index a5dfe806..e6aff2b6 100644
--- a/.flake8
+++ b/.flake8
@@ -1,8 +1,6 @@
[flake8]
color=always
max-line-length=120
-; TODO: Bring WAY down
-max-complexity=55
; Auto generated
exclude=src/gen/
; TODO: We want to configure this
@@ -12,3 +10,6 @@ per-file-ignores =
; line too long
; mixed case
__init__.pyi:F401,E501,N816
+; TODO: Bring WAY down
+max-complexity=55
+inline-quotes = "
diff --git a/.github/workflows/build-and-lint.yml b/.github/workflows/build-and-lint.yml
new file mode 100644
index 00000000..ae10b564
--- /dev/null
+++ b/.github/workflows/build-and-lint.yml
@@ -0,0 +1,111 @@
+# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
+name: Build and lint
+on:
+ push:
+ branches:
+ - main
+ - master
+ - 2.0.0
+ pull_request:
+ branches:
+ - main
+ - master
+ - dev
+ - dev*
+jobs:
+ Pyright:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9"]
+ steps:
+ - name: Checkout ${{ github.repository }}/${{ github.ref }}
+ uses: actions/checkout@v2
+ - name: Set up Node
+ uses: actions/setup-node@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r "scripts/requirements.txt"
+ npm install -g pyright
+ - run: scripts/compile_resources.bat
+ - name: Analysing the code with ${{ job.name }}
+ run: pyright
+ Pylint:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9"]
+ steps:
+ - name: Checkout ${{ github.repository }}/${{ github.ref }}
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r "scripts/requirements.txt"
+ - run: scripts/compile_resources.bat
+ - name: Analysing the code with ${{ job.name }}
+ run: pylint --reports=y --output-format=colorized $(git ls-files '**/*.py*')
+ Bandit:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9"]
+ steps:
+ - name: Checkout ${{ github.repository }}/${{ github.ref }}
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r "scripts/requirements.txt"
+ - run: scripts/compile_resources.bat
+ - name: Analysing the code with ${{ job.name }}
+ run: bandit -n 1 --severity-level medium --recursive src
+ Flake8:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9"]
+ steps:
+ - name: Checkout ${{ github.repository }}/${{ github.ref }}
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r "scripts/requirements.txt"
+ - run: scripts/compile_resources.bat
+ - name: Analysing the code with ${{ job.name }}
+ run: flake8
+ Build:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9"]
+ steps:
+ - name: Checkout ${{ github.repository }}/${{ github.ref }}
+ uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r "scripts/requirements.txt"
+ - run: scripts/build.bat
diff --git a/.mypy.ini b/.mypy.ini
deleted file mode 100644
index 6b23dbbd..00000000
--- a/.mypy.ini
+++ /dev/null
@@ -1,33 +0,0 @@
-; https://mypy.readthedocs.io/en/stable/command_line.html#disallow-dynamic-typing
-[mypy]
-show_column_numbers=True
-show_error_codes=True
-no_color_output=False
-color_output=True
-
-ignore_missing_imports=True
-follow_imports=silent
-
-; Note: exclude is ignored when linting file by file so VSCode will still show errors in typings
-; typings are incomplete as we only add types for what we need, cannot disable specific rules per file
-; Auto generated
-exclude=(typings/|src/gen/)
-
-; Redundant
-disallow_untyped_defs=False
-; Doesn't see our cv2 type stubs
-warn_return_any=False
-; False positives when it's needed for other linting libraries
-warn_unused_ignores=False
-; Doesn't see imports from src/gen/
-disallow_any_unimported=False
-disallow_subclassing_any=False
-; False positives with ndarray
-disable_error_code=no-untyped-def
-
-strict=True
-; Doesn't see types from some imports
-disallow_any_expr=False
-disallow_any_decorated=True
-disallow_any_explicit=True
-warn_unreachable=True
diff --git a/.pylintrc b/.pylintrc
deleted file mode 100644
index 8bd9be7a..00000000
--- a/.pylintrc
+++ /dev/null
@@ -1,23 +0,0 @@
-; http://pylint-messages.wikidot.com/all-codes
-[MASTER]
-max-line-length=120
-ignore-paths=
- ; Haven't looked into disabling specific rules per file
- ^typings/.*$,
- ; Auto generated
- ^src/gen/.*$
-disable=
- missing-docstring,
- ; TODO: We want to configure this
- ; https://pylint.pycqa.org/en/latest/user_guide/options.html#naming-styles
- invalid-name,
- ; We group imports
- wrong-import-position,
- ; Already taken care of and grayed out. Also conflicts with Pylance reportIncompatibleMethodOverride
- unused-argument,
- ; Already taken care of by Flake8
- unused-import,
-extension-pkg-allow-list=PyQt6,win32ui
-
-[TYPECHECK]
-generated-members=cv2
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index ca9b77ca..d4464eda 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -1,11 +1,12 @@
{
"recommendations": [
- "ms-python.vscode-pylance",
- "ms-python.python",
- "sonarsource.sonarlint-vscode",
+ "bungcip.better-toml",
"davidanson.vscode-markdownlint",
+ "eamodio.gitlens",
+ "ms-python.python",
+ "ms-python.vscode-pylance",
"shardulm94.trailing-spaces",
- "eamodio.gitlens"
+ "sonarsource.sonarlint-vscode"
],
"unwantedRecommendations": [
"ms-pyright.pyright",
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 2f06bd99..5336311a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -13,9 +13,11 @@
"[python]": {
"editor.tabSize": 4,
"editor.rulers": [
- 79,
- 100,
- 120,
+ 72, // PEP8-17 docstrings
+ // 79, // PEP8-17 default max
+ // 88, // Black default
+ 99, // PEP8-17 acceptable max
+ 120, // Our hard rule
]
},
"editor.formatOnSave": true,
@@ -23,16 +25,14 @@
"source.fixAll": true,
"source.fixAll.markdownlint": true,
},
- // Set to trace when sending error reports to Pylance
- // "python.analysis.logLevel": "Trace",
- // https://code.visualstudio.com/docs/python/linting#_specific-linters
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintCategorySeverity.convention": "Warning",
"python.linting.pylintCategorySeverity.refactor": "Warning",
"python.linting.flake8Enabled": true,
"python.linting.flake8CategorySeverity.E": "Warning",
- "python.linting.mypyEnabled": true,
+ // PyRight obsoletes mypy
+ "python.linting.mypyEnabled": false,
// Is already wrapped by Flake8, prospector and pylama
"python.linting.pycodestyleEnabled": false,
// Just another wrapper, use Flake8 OR this
@@ -66,5 +66,5 @@
"**/bower_components": true,
"**/*.code-search": true,
"typings": true,
- }
+ },
}
diff --git a/README.md b/README.md
index f11ae3e3..7a4896bc 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-#
AutoSplit
+#
AutoSplit [](/../../actions/workflows/build-and-lint.yml) [](https://sonarcloud.io/dashboard?id=Avasam_Auto-Split) [](https://sonarcloud.io/dashboard?id=Avasam_Auto-Split) [](https://sonarcloud.io/dashboard?id=Avasam_Auto-Split) [](https://sonarcloud.io/dashboard?id=Avasam_Auto-Split)
Easy to use image comparison based auto splitter for speedrunning on console or PC.
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000..4a532389
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,96 @@
+# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
+[tool.black]
+line-length = 120
+# Auto generated
+force-exclude = "src/gen/.*\\.py$"
+
+# https://github.com/hhatto/autopep8#usage
+# https://github.com/hhatto/autopep8#more-advanced-usage
+[tool.autopep8]
+max_line_length = 120
+recursive = true
+aggressive = 3
+
+# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
+[tool.pyright]
+pythonPlatform = "Windows"
+typeCheckingMode = "strict"
+stubPath = "typings/"
+ignore = [
+ # Auto generated
+ "src/gen/",
+ "typings/",
+]
+reportMissingTypeStubs = "information"
+# False positives with TYPE_CHECKING
+reportImportCycles = "information"
+# PyQt .connect
+reportFunctionMemberAccess = "information"
+# Extra runtime safety
+reportUnnecessaryComparison = "warning"
+# Flake8 does a better job
+reportUnusedImport = "none"
+# numpy has way too many complex types that triggers this
+reportUnknownMemberType = "none"
+
+# https://github.com/PyCQA/pylint/blob/main/examples/pylintrc
+# https://pylint.pycqa.org/en/latest/technical_reference/features.html
+[tool.pylint.REPORTS]
+# Just like default but any error will make drop to 9 or less
+evaluation="10.0 - error - ((float(warning + refactor + convention) / statement) * 10)"
+[tool.pylint.MASTER]
+fail-under=9.0
+# https://pylint.pycqa.org/en/latest/technical_reference/extensions.html
+load-plugins = [
+ "pylint.extensions.emptystring",
+ "pylint.extensions.confusing_elif",
+ "pylint.extensions.consider_ternary_expression",
+ "pylint.extensions.bad_builtin",
+ "pylint.extensions.mccabe",
+ "pylint.extensions.check_elif",
+ "pylint.extensions.redefined_variable_type",
+ "pylint.extensions.overlapping_exceptions",
+ "pylint.extensions.empty_comment",
+ "pylint.extensions.set_membership",
+ "pylint.extensions.typing",
+ # TODO: Maybe later
+ # "pylint.extensions.docparams",
+ # Not wanted/needed
+ # "pylint.extensions.broad_try_clause",
+ # "pylint.extensions.code_style",
+ # "pylint.extensions.comparetozero",
+ # "pylint.extensions.docstyle",
+ # "pylint.extensions.while_used",
+ # Didn't work
+ # "pylint.extensions.comparison_placement",
+ # "pylint.extensions.for_any_all",
+]
+ignore-paths = [
+ # Haven't looked into disabling specific rules per file
+ "^typings/.*$",
+ # Auto generated
+ "^src/gen/.*$",
+]
+# No need to mention the fixmes
+disable=["fixme"]
+extension-pkg-allow-list = ["PyQt6", "win32ui"]
+
+[tool.pylint.FORMAT]
+max-line-length = 120
+
+[tool.pylint.'MESSAGES CONTROL']
+disable = [
+ "missing-docstring",
+ # TODO: We want to configure this
+ # https://pylint.pycqa.org/en/latest/user_guide/options.html#naming-styles
+ "invalid-name",
+ # We group imports
+ "wrong-import-position",
+ # Already taken care of and grayed out. Also conflicts with Pylance reportIncompatibleMethodOverride
+ "unused-argument",
+ # Already taken care of by Flake8
+ "unused-import",
+]
+
+[tool.pylint.TYPECHECK]
+generated-members = "cv2"
diff --git a/pyrightconfig.json b/pyrightconfig.json
deleted file mode 100644
index 5aaa8948..00000000
--- a/pyrightconfig.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "typeCheckingMode": "strict",
- // Auto generated
- "ignore": [
- // "src/gen/",
- "typings/",
- ],
- "reportMissingTypeStubs": "information",
- // False positives with TYPE_CHECKING
- "reportImportCycles": "information",
- // PyQt .connect
- "reportFunctionMemberAccess": "information",
- // Extra runtime safety
- "reportUnnecessaryComparison": "warning",
- // Flake8 does a better job
- "reportUnusedImport": "none",
- // numpy has way too many complex types that triggers this
- "reportUnknownMemberType": "none",
-}
diff --git a/res/design.ui b/res/design.ui
index 1e74b9d8..af4e7559 100644
--- a/res/design.ui
+++ b/res/design.ui
@@ -615,7 +615,7 @@
450
- 50
+ 38
102
16
@@ -705,7 +705,7 @@
200
- 50
+ 38
82
16
@@ -759,7 +759,7 @@
380
- 270
+ 50
241
20
@@ -1076,10 +1076,10 @@
- 120
+ 440
270
- 241
- 16
+ 181
+ 20
@@ -1112,6 +1112,38 @@
+
+
+
+ 120
+ 50
+ 241
+ 20
+
+
+
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+
+ true
+
+
+
+ 120
+ 270
+ 221
+ 20
+
+
+
+ Force Full Content Rendering (slower)
+
+
splitimagefolderLabel
splitimagefolderLineEdit
browseButton
@@ -1178,6 +1210,8 @@
startImageLabel
currentsimilaritythresholdLabel
currentsimilaritythresholdnumberLabel
+ captureregionwindowLabel
+ forcePrintWindowCheckBox