Skip to content

Commit af8ab61

Browse files
authored
Merge pull request #263 from Toufool/dev
2 parents 377ebde + de64398 commit af8ab61

38 files changed

+3447
-5248
lines changed

Diff for: .editorconfig

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
root = true
2-
3-
[*]
4-
end_of_line = crlf
5-
insert_final_newline = true
6-
charset = utf-8
7-
indent_style = space
8-
indent_size = 2
9-
10-
[*.py]
11-
indent_size = 4
12-
13-
[*.ui]
14-
indent_size = 1
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.py]
11+
indent_size = 4
12+
13+
[*.ui]
14+
indent_size = 1

Diff for: .github/workflows/lint-and-build.yml

+8-15
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ env:
3434
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
3535
GITHUB_EXCLUDE_BUILD_NUMBER: ${{ inputs.excludeBuildNumber }}
3636

37+
concurrency:
38+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
39+
cancel-in-progress: true
40+
3741
jobs:
3842
ruff:
3943
runs-on: windows-latest
4044
strategy:
4145
fail-fast: false
4246
# Ruff is version and platform sensible
4347
matrix:
44-
python-version: ["3.9", "3.10", "3.11"]
48+
python-version: ["3.10", "3.11", "3.12"]
4549
steps:
4650
- name: Checkout ${{ github.repository }}/${{ github.ref }}
4751
uses: actions/checkout@v3
@@ -54,25 +58,13 @@ jobs:
5458
- run: scripts/install.ps1
5559
shell: pwsh
5660
- run: ruff check .
57-
add-trailing-comma:
58-
runs-on: windows-latest
59-
steps:
60-
- name: Checkout ${{ github.repository }}/${{ github.ref }}
61-
uses: actions/checkout@v3
62-
- name: Set up Python 3.11
63-
uses: actions/setup-python@v4
64-
with:
65-
python-version: "3.11"
66-
- run: pip install add-trailing-comma
67-
- name: Analysing the code with add-trailing-comma
68-
run: add-trailing-comma $(git ls-files '**.py*')
6961
Pyright:
7062
runs-on: windows-latest
7163
strategy:
7264
fail-fast: false
7365
# Pyright is version and platform sensible
7466
matrix:
75-
python-version: ["3.9", "3.10", "3.11"]
67+
python-version: ["3.10", "3.11", "3.12"]
7668
steps:
7769
- name: Checkout ${{ github.repository }}/${{ github.ref }}
7870
uses: actions/checkout@v3
@@ -88,13 +80,14 @@ jobs:
8880
uses: jakebailey/pyright-action@v1
8981
with:
9082
working-directory: src/
83+
python-version: ${{ matrix.python-version }}
9184
Build:
9285
runs-on: windows-latest
9386
strategy:
9487
fail-fast: false
9588
# Only the Python version we plan on shipping matters.
9689
matrix:
97-
python-version: ["3.11"]
90+
python-version: ["3.11", "3.12"]
9891
steps:
9992
- name: Checkout ${{ github.repository }}/${{ github.ref }}
10093
uses: actions/checkout@v3

Diff for: .pre-commit-config.yaml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: pretty-format-json
66
exclude: ".vscode/.*" # Exclude jsonc
@@ -12,26 +12,27 @@ repos:
1212
args: [--fix=crlf]
1313
- id: check-case-conflict
1414
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
15-
rev: v2.9.0
15+
rev: v2.11.0
1616
hooks:
1717
- id: pretty-format-ini
1818
args: [--autofix]
19-
- repo: https://github.com/charliermarsh/ruff-pre-commit
20-
rev: "v0.0.276" # Must match requirements-dev.txt
19+
- repo: https://github.com/astral-sh/ruff-pre-commit
20+
rev: "v0.1.6" # Must match requirements-dev.txt
2121
hooks:
2222
- id: ruff
2323
args: [--fix]
24-
- repo: https://github.com/pre-commit/mirrors-autopep8
25-
rev: "v2.0.2" # Must match requirements-dev.txt
24+
- repo: https://github.com/hhatto/autopep8
25+
rev: "v2.0.4" # Must match requirements-dev.txt
2626
hooks:
2727
- id: autopep8
2828
- repo: https://github.com/asottile/add-trailing-comma
29-
rev: v3.0.0 # Must match requirements-dev.txt
29+
rev: v3.1.0 # Must match requirements-dev.txt
3030
hooks:
3131
- id: add-trailing-comma
3232

3333
ci:
3434
autoupdate_branch: dev
35+
autoupdate_schedule: monthly
3536
skip:
3637
# Ignore until Linux support. We don't want lf everywhere yet
3738
# And crlf fails on CI because pre-commit runs on linux

Diff for: .sonarcloud.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sonar.python.version=3.9, 3.10, 3.11
1+
sonar.python.version=3.10, 3.11, 3.12

Diff for: .vscode/settings.json

+12-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"files.trimTrailingWhitespace": true,
1515
"files.insertFinalNewline": true,
1616
"files.trimFinalNewlines": true,
17+
"files.eol": "\n",
1718
"editor.comments.insertSpace": true,
1819
"editor.insertSpaces": true,
1920
"editor.detectIndentation": false,
2021
"editor.tabSize": 2,
2122
"editor.formatOnSave": true,
2223
"editor.codeActionsOnSave": {
2324
"source.fixAll": true,
24-
"source.fixAll.unusedImports": false,
25-
"source.fixAll.convertImportFormat": true,
25+
// Let dedicated linter (Ruff) organize imports
2626
"source.organizeImports": false,
2727
},
2828
"emeraldwalk.runonsave": {
@@ -63,7 +63,7 @@
6363
"editor.defaultFormatter": "vscode.json-language-features",
6464
},
6565
"[python]": {
66-
// Ruff is not yet a formatter: https://github.com/charliermarsh/ruff/issues/1904
66+
// Ruff as a formatter doesn't fully satisfy our needs yet: https://github.com/astral-sh/ruff/discussions/7310
6767
"editor.defaultFormatter": "ms-python.autopep8",
6868
"editor.tabSize": 4,
6969
"editor.rulers": [
@@ -80,23 +80,28 @@
8080
"--config-file=mypy.ini",
8181
],
8282
"python.terminal.activateEnvironment": true,
83+
// python.analysis is Pylance (pyright) configurations
84+
"python.analysis.fixAll": [
85+
"source.convertImportFormat"
86+
// Explicitly omiting "source.unusedImports", can be annoying when commenting code for debugging
87+
],
8388
// Important to follow the config in pyrightconfig.json
8489
"python.analysis.useLibraryCodeForTypes": false,
8590
"python.analysis.diagnosticMode": "workspace",
86-
"python.linting.enabled": true,
8791
"ruff.importStrategy": "fromEnvironment",
8892
// Use the Ruff extension instead
8993
"isort.check": false,
94+
// linting/formatting options deprecated, use dedicated extensions instead
95+
// https://github.com/microsoft/vscode-python/wiki/Migration-to-Python-Tools-Extensions
96+
"python.linting.enabled": false,
9097
"python.linting.banditEnabled": false,
9198
"python.linting.flake8Enabled": false,
9299
"python.linting.prospectorEnabled": false,
93100
"python.linting.pycodestyleEnabled": false,
94101
"python.linting.pylamaEnabled": false,
95102
"python.linting.pylintEnabled": false,
96-
// Use the autopep8 extension instead
97-
"python.formatting.provider": "none",
98-
// Use Pyright/Pylance instead
99103
"python.linting.mypyEnabled": false,
104+
"python.formatting.provider": "none",
100105
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
101106
"powershell.codeFormatting.autoCorrectAliases": true,
102107
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,

Diff for: PyInstaller/hooks/hook-requests.py

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

53
# Get the cacert.pem

Diff for: README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=Avasam_AutoSplit)
66
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=security_rating)](https://sonarcloud.io/dashboard?id=Avasam_AutoSplit)
77
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
8-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
8+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
99
[![SemVer](https://badgen.net/badge/_/SemVer%20compliant/grey?label)](https://semver.org/)
10+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
11+
[![autopep8](https://badgen.net/badge/code%20style/autopep8/blue)](https://github.com/hhatto/autopep8)
12+
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
13+
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
1014

1115
Easy to use image comparison based auto splitter for speedrunning on console or PC.
1216

@@ -25,14 +29,14 @@ This program can be used to automatically start, split, and reset your preferred
2529
### Compatibility
2630

2731
- Windows 10 and 11.
28-
- Python 3.9+ (Not requried for normal use. Refer to the [build instructions](/docs/build%20instructions.md) if you'd like run the application directly in Python).
32+
- Python 3.10+ (Not required for normal use. Refer to the [build instructions](/docs/build%20instructions.md) if you'd like run the application directly in Python).
2933

3034
## OPTIONS
3135

3236
#### Split Image Folder
3337

34-
- Supported image file types: .png, .jpg, .jpeg, .bmp, and [more](https://docs.opencv.org/3.0-beta/modules/imgcodecs/doc/reading_and_writing_images.html#imread).
35-
- Images can be any size.
38+
- Supported image file types: PNG, JPEG, bitmaps, WebP, and [more](https://docs.opencv.org/4.8.0/d4/da8/group__imgcodecs.html#imread).
39+
- Images can be any size and ratio.
3640
- Images are matched in alphanumerical order.
3741
- Recommended filenaming convention: `001_SplitName.png, 002_SplitName.png, 003_SplitName.png`...
3842
- Custom split image settings are handled in the filename. See how [here](#custom-split-image-settings).
@@ -79,7 +83,7 @@ This program can be used to automatically start, split, and reset your preferred
7983
Duplicates the desktop using Direct3D.
8084
It can record OpenGL and Hardware Accelerated windows.
8185
About 10-15x slower than BitBlt. Not affected by window size.
82-
overlapping windows will show up and can't record across displays.
86+
Overlapping windows will show up and can't record across displays.
8387
This option may not be available for hybrid GPU laptops, see [D3DDD-Note-Laptops.md](/docs/D3DDD-Note-Laptops.md) for a solution.
8488
- **Force Full Content Rendering** (very slow, can affect rendering)
8589
Uses BitBlt behind the scene, but passes a special flag to PrintWindow to force rendering the entire desktop.

Diff for: docs/build instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### All platforms
1010

11-
- [Python](https://www.python.org/downloads/) 3.9+.
11+
- [Python](https://www.python.org/downloads/) 3.10+.
1212
- [Node](https://nodejs.org) is optional, but required for complete linting.
1313
- Alternatively you can install the [pyright python wrapper](https://pypi.org/project/pyright/) which has a bit of an overhead delay.
1414
- [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell)

Diff for: pyproject.toml

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# https://beta.ruff.rs/docs/configuration
1+
# https://docs.astral.sh/ruff/configuration/
22
[tool.ruff]
3-
target-version = "py39"
3+
target-version = "py310"
44
line-length = 120
5-
select = ["ALL", "NURSERY"]
6-
extend-fixable = ["NURSERY"]
7-
# https://beta.ruff.rs/docs/rules
5+
select = ["ALL"]
6+
preview = true
7+
# https://docs.astral.sh/ruff/rules/
88
ignore = [
99
###
1010
# Not needed or wanted
@@ -21,6 +21,8 @@ ignore = [
2121
"ERA001", # eradicate: commented-out-code
2222
# contextlib.suppress is roughly 3x slower than try/except
2323
"SIM105", # flake8-simplify: use-contextlib-suppress
24+
# Negative performance impact
25+
"UP038", # non-pep604-isinstance
2426
# Checked by type-checker (pyright)
2527
"ANN", # flake-annotations
2628
"PGH003", # blanket-type-ignore
@@ -34,7 +36,7 @@ ignore = [
3436
"TD001", # flake8-todos: invalid-todo-tag
3537

3638
###
37-
# These should be warnings (https://github.com/charliermarsh/ruff/issues/1256)
39+
# These should be warnings (https://github.com/astral-sh/ruff/issues/1256 & https://github.com/astral-sh/ruff/issues/1774)
3840
###
3941
"FIX", # flake8-fixme
4042
# Not all TODOs are worth an issue, this would be better as a warning
@@ -56,45 +58,44 @@ ignore = [
5658
# Python 3.11, introduced "zero cost" exception handling
5759
"PERF203", # try-except-in-loop
5860

59-
### FIXME/TODO (no warnings in Ruff yet: https://github.com/charliermarsh/ruff/issues/1256):
60-
"CPY001",
61-
"PTH",
61+
### FIXME/TODO (no warnings in Ruff yet: https://github.com/astral-sh/ruff/issues/1256 & https://github.com/astral-sh/ruff/issues/1774):
62+
"CPY001", # flake8-copyright
63+
"PTH", # flake8-use-pathlib
6264
# Ignore until linux support
63-
"EXE",
65+
"EXE", # flake8-executable
6466
]
6567

6668
[tool.ruff.per-file-ignores]
6769
"typings/**/*.pyi" = [
6870
"F811", # Re-exports false positives
69-
"F821", # https://github.com/charliermarsh/ruff/issues/3011
71+
"F821", # https://github.com/astral-sh/ruff/issues/3011
7072
# The following can't be controlled for external libraries:
7173
"A", # Shadowing builtin names
7274
"ICN001", # unconventional-import-alias
7375
"N8", # Naming conventions
76+
"PLR0904", # Too many public methods
7477
"PLR0913", # Argument count
78+
"PLW3201", # misspelled dunder method name
7579
"PYI042", # CamelCase TypeAlias
7680
]
7781

78-
# https://beta.ruff.rs/docs/settings/#flake8-implicit-str-concat
82+
# https://docs.astral.sh/ruff/settings/#flake8-implicit-str-concat
7983
[tool.ruff.flake8-implicit-str-concat]
8084
allow-multiline = false
8185

82-
# https://beta.ruff.rs/docs/settings/#isort
86+
# https://docs.astral.sh/ruff/settings/#isort
8387
[tool.ruff.isort]
8488
combine-as-imports = true
8589
split-on-trailing-comma = false
86-
required-imports = ["from __future__ import annotations"]
8790
# Unlike isort, Ruff only counts relative imports as local-folder by default for know.
88-
# https://github.com/charliermarsh/ruff/issues/2419
89-
# https://github.com/charliermarsh/ruff/issues/3115
91+
# https://github.com/astral-sh/ruff/issues/3115
9092
known-local-folder = [
9193
"AutoControlledThread",
9294
"AutoSplit",
9395
"AutoSplitImage",
9496
"capture_method",
9597
"compare",
9698
"error_messages",
97-
"error_messages",
9899
"gen",
99100
"hotkeys",
100101
"menu_bar",
@@ -104,7 +105,7 @@ known-local-folder = [
104105
"utils",
105106
]
106107

107-
# https://beta.ruff.rs/docs/settings/#mccabe
108+
# https://docs.astral.sh/ruff/settings/#mccabe
108109
[tool.ruff.mccabe]
109110
# Hard limit, arbitrary to 4 bytes
110111
max-complexity = 31
@@ -127,7 +128,10 @@ ignore = [
127128
"E124", # Closing bracket may not match multi-line method invocation style (enforced by add-trailing-comma)
128129
"E70", # Allow ... on same line as def
129130
# Autofixed by Ruff
130-
# Check for the "Fix" flag https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
131+
# Check for the "Fix" flag https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
132+
"E20", # whitespace-after-* & whitespace-before-*
133+
"E211", # whitespace-before-parameters
134+
"E231", # missing-whitespace
131135
"E401", # I001: unsorted-imports
132136
"E71", # Comparisons
133137
"E731", # lambda-assignment
@@ -138,6 +142,7 @@ ignore = [
138142
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
139143
[tool.pyright]
140144
typeCheckingMode = "strict"
145+
pythonVersion = "3.10"
141146
# Prefer `pyright: ignore`
142147
enableTypeIgnoreComments = false
143148
# Extra strict

0 commit comments

Comments
 (0)