Skip to content

Switch from pre-commit.ci to autofix.ci + dprint, update shared configs #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://dprint.dev/config/#extending-a-different-configuration-file
"extends": "https://raw.githubusercontent.com/BesLogic/shared-configs/main/.dprint.jsonc",
}
28 changes: 28 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://autofix.ci/setup#getting-started
name: autofix.ci # needed to securely identify the workflow
on:
pull_request:
branches:
- main
permissions:
contents: read

jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/ruff-action@v3
with:
version-file: "pyproject.toml"
args: "check --fix"
- run: ruff format
# Format even if the the previous step failed
if: ${{ !cancelled() }}

- run: npx dprint fmt
# Format even if the the previous step failed
if: ${{ !cancelled() }}

- uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef
11 changes: 0 additions & 11 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ concurrency:
cancel-in-progress: true

jobs:
Ruff:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
version-file: "pyproject.toml"
- run: ruff format --check --diff
# Show formatting issues even if the "check" step failed
if: ${{ !cancelled() }}

Pyright:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
30 changes: 0 additions & 30 deletions .pre-commit-config.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// Only keep those used by your specific project
"recommendations": [
// General
"dprint.dprint",
"eamodio.gitlens",
"editorconfig.editorconfig",
"pkief.material-icon-theme",
Expand Down
12 changes: 6 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preLaunchTask": "Compile resources",
"program": "src/AutoSplit.py",
"console": "integratedTerminal",
"justMyCode": false
"justMyCode": false,
},
{
"name": "Python: AutoSplit",
Expand All @@ -20,7 +20,7 @@
"preLaunchTask": "Compile resources",
"program": "src/AutoSplit.py",
"console": "integratedTerminal",
"justMyCode": true
"justMyCode": true,
},
{
"name": "Python: AutoSplit --auto-controlled",
Expand All @@ -29,10 +29,10 @@
"preLaunchTask": "Compile resources",
"program": "src/AutoSplit.py",
"args": [
"--auto-controlled"
"--auto-controlled",
],
"console": "integratedTerminal",
"justMyCode": true
}
]
"justMyCode": true,
},
],
}
32 changes: 18 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
// https://github.com/BesLogic/shared-configs/blob/main/.vscode/settings.json
// Modifications to this file that are not project-specific should also be done upstream.
{
"json.schemas": [
{
// Not all .jsonc files have a pre-associated schema
"fileMatch": [
"*.jsonc",
],
"schema": {
"allowTrailingCommas": true,
},
"json.schemas": [{
// Not all .jsonc files have a pre-associated schema
"fileMatch": ["*.jsonc"],
"schema": {
"allowTrailingCommas": true,
},
],
}],
"files.associations": {
// Qt Creator
"*.qrc": "xml",
Expand Down Expand Up @@ -64,24 +60,28 @@
// IDEM, but also it's annoying to remove imports because of commented code while testing
"source.removeUnusedImports": "never",
},

// NOTE: due to a bug in VSCode, we have to specify editor.defaultFormatter individually to ensure
// it overrides user settings. Please upvote: https://github.com/microsoft/vscode/issues/168411

/*
* Markdown
*/
"[markdown]": {
"files.trimTrailingWhitespace": false,
"editor.defaultFormatter": "vscode.markdown-language-features",
"editor.defaultFormatter": "dprint.dprint",
},

/*
* JSON
*/
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.defaultFormatter": "dprint.dprint",
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.defaultFormatter": "dprint.dprint",
},

/*
* Python
*/
Expand Down Expand Up @@ -111,6 +111,7 @@
"ruff.organizeImports": true,
// Use the Ruff extension instead
"isort.check": false,

/*
* TOML
*/
Expand All @@ -134,15 +135,17 @@
"evenBetterToml.formatter.trailingNewline": true,
// We like keeping TOML keys in a certain non-alphabetical order that feels more natural
"evenBetterToml.formatter.reorderKeys": false,

/*
* YAML
*/
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml",
"editor.defaultFormatter": "dprint.dprint",
},
"yaml.schemas": {
"https://json.schemastore.org/github-issue-config.json": ".github/ISSUE_TEMPLATE/config.yml",
},

/*
* XML
*/
Expand All @@ -167,6 +170,7 @@
// Custom
"string",
],

/*
* Powershell
*/
Expand Down
34 changes: 17 additions & 17 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
"-Command",
],
},
},
},
"linux": {
"options": {
"shell": {
"executable": "pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
"-Command",
],
},
},
},
"osx": {
"options": {
"shell": {
"executable": "pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
"-Command",
],
},
},
},
"tasks": [
{
"label": "Compile resources",
"type": "shell",
"command": "scripts/compile_resources.ps1"
"command": "scripts/compile_resources.ps1",
},
{
"label": "Build AutoSplit",
"type": "shell",
"command": "scripts/build.ps1",
"group": {
"kind": "build",
"isDefault": true
}
}
]
"isDefault": true,
},
},
],
}
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To understand how to use AutoSplit and how it works in-depth, please read the [t
## Download and open

- Download the [latest version](/../../releases/latest)
- You can also check out the [latest dev builds](/../../actions/workflows/lint-and-build.yml?query=event%3Apush+is%3Asuccess) (requires a GitHub account)
- You can also check out the [latest dev builds](/../../actions/workflows/lint-and-build.yml?query=event%3Apush+is%3Asuccess) (requires a GitHub account)\
(If you don't have a GitHub account, you can try [nightly.link](https://nightly.link/Toufool/AutoSplit/workflows/lint-and-build/main))
- Linux users must ensure they are in the `tty` and `input` groups and have write access to `/dev/uinput`. You can run the following commands to do so:

Expand Down Expand Up @@ -77,17 +77,19 @@ See the [installation instructions](https://github.com/Toufool/LiveSplit.AutoSpl
## Resources

Still need help?

<!-- open issues sorted by reactions -->

- [Check if your issue already exists](../../issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc)
- If it does, upvote it 👍
- If it doesn't, create a new one
- Join the [AutoSplit Discord
![AutoSplit Discord](https://badgen.net/discord/members/Qcbxv9y)](https://discord.gg/Qcbxv9y)
- Join the [AutoSplit Discord\
![AutoSplit Discord](https://badgen.net/discord/members/Qcbxv9y)](https://discord.gg/Qcbxv9y)

## Contributing

See [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for our contributing standards.
Refer to the [build instructions](/docs/build%20instructions.md) if you're interested in building the application yourself or running it in Python.
See [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for our contributing standards.\
Refer to the [build instructions](/docs/build%20instructions.md) if you're interested in building the application yourself or running it in Python.

Not a developer? You can still help through the following methods:

Expand Down
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Supported Versions

| Version | Supported |
| ------- | :-------: |
| main | :white_check_mark: |
| Version | Supported |
| --------------- | :-------------------------------------------: |
| main | :white_check_mark: |
| everything else | WIP branches, security support may be lacking |

## Reporting a Vulnerability
Expand Down
8 changes: 3 additions & 5 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

## Python Setup and Building

Refer to the [build instructions](/docs/build%20instructions.md) if you're interested in building the application yourself or running it in Python.
Refer to the [build instructions](/docs/build%20instructions.md) if you're interested in building the application yourself or running it in Python.

## Linting and formatting

The project is setup to automatically configure VSCode with the proper extensions and settings. Fixers and formatters will be run on save.
The project is setup to automatically configure VSCode with the proper extensions and settings. Fixers and formatters will be run on save.\
If you use a different IDE or for some reason cannot / don't want to use the recommended extensions, you can run `scripts/lint.ps1`.
Project configurations for other IDEs are welcome.

If you like to use pre-commit hooks, `.pre-commit-config.yaml` is setup for such uses.

The CI will automatically fix and commit any autofixable issue your changes may have.

## Visual Designer
Expand Down Expand Up @@ -60,4 +58,4 @@ Whenever a split image overrides a default global setting, we add a getter that

## Testing

None 😦 Please help us create test suites, we lack the time, but we really want (*need!*) them. <https://github.com/Toufool/AutoSplit/issues/216>
None 😦 Please help us create test suites, we lack the time, but we really want (_need!_) them. <https://github.com/Toufool/AutoSplit/issues/216>
17 changes: 9 additions & 8 deletions docs/D3DDD-Note-Laptops.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Therefore, to be able to use _D3D Desktop Duplication_ on hybrid GPU laptops, we
_You must be running Windows 10 1809 or later for this to work._

1. Press the Windows Key, type `Graphics settings` and press enter
2. You should see the following window:
![image](https://user-images.githubusercontent.com/35039/84433008-a3b65d00-abfb-11ea-8343-81b8f265afc4.png)
2. You should see the following window:\
![image](https://user-images.githubusercontent.com/35039/84433008-a3b65d00-abfb-11ea-8343-81b8f265afc4.png)
3. Make sure the dropdown is set to `Desktop App` and click `Browse`
4. Find the `python.exe` used by your _D3D Desktop Duplication_ project. Example:
![image](https://user-images.githubusercontent.com/35039/84433419-3d7e0a00-abfc-11ea-99a4-b5176535b0e5.png)
4. Find the `python.exe` used by your _D3D Desktop Duplication_ project. Example:\
![image](https://user-images.githubusercontent.com/35039/84433419-3d7e0a00-abfc-11ea-99a4-b5176535b0e5.png)
5. Click on `Options`
6. Select `Power saving` and click `Save`
![image](https://user-images.githubusercontent.com/35039/84433562-7918d400-abfc-11ea-807a-e3c0b15d9fb2.png)
7. If you did everything right it should look like this:
![image](https://user-images.githubusercontent.com/35039/84433706-bda46f80-abfc-11ea-9c64-a702b96095b8.png)
6. Select `Power saving` and click `Save`\
![image](https://user-images.githubusercontent.com/35039/84433562-7918d400-abfc-11ea-807a-e3c0b15d9fb2.png)
7. If you did everything right it should look like this:\
![image](https://user-images.githubusercontent.com/35039/84433706-bda46f80-abfc-11ea-9c64-a702b96095b8.png)
8. Repeat the process for other potentially relevant executables for your project: `ipython.exe`, `jupyter-kernel.exe` etc.

## Approach 2: Nvidia Control Panel
Expand All @@ -44,4 +44,5 @@ Need help to fill in this section. See issue [SerpentAI/D3DShot#28](https://gith
Preliminary answer: No. This is telling Windows how to _render_ Python processes with the Desktop Window Manager. Most Python applications are console applications that don't have a window. Even if you have a GUI application with one or more windows, this should only affect the rendering aspect (i.e. your windows won't be rendered through the dedicated GPU) and shouldn't limit hardware access in any way.

---

(copied and adapted from <https://github.com/SerpentAI/D3DShot/wiki/Installation-Note:-Laptops>)
6 changes: 3 additions & 3 deletions docs/build instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

### Windows

- Microsoft Visual C++ 14.0 or greater may be required to build the executable. Get it with [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/).
- Microsoft Visual C++ 14.0 or greater may be required to build the executable. Get it with [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/).

### Linux

- You need to be part of the `input` and `tty` groups, as well as have permissions on a few files and folders.
If you are missing from either groups, the install script will take care of it on its first run, but you'll need to restart your session.
- You need to be part of the `input` and `tty` groups, as well as have permissions on a few files and folders.\
If you are missing from either groups, the install script will take care of it on its first run, but you'll need to restart your session.

### WSL

Expand Down
Loading