-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docsFor2024.3
- Loading branch information
Showing
169 changed files
with
1,407 additions
and
1,795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.4.10 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
args: [ --fix ] | ||
# Run the formatter. | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,12 @@ | ||
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -or $env:APPVEYOR_REPO_BRANCH.StartsWith("try-")) { | ||
$lintOutput = (Resolve-Path .\testOutput\lint\) | ||
$lintSource = (Resolve-Path .\tests\lint\) | ||
$flake8Output = "$lintOutput\Flake8.txt" | ||
# When Appveyor runs for a pr, | ||
# the build is made from a new temporary commit, | ||
# resulting from the pr branch being merged into its base branch. | ||
# Therefore to create a diff for linting, we must fetch the head of the base branch. | ||
# In a PR, APPVEYOR_REPO_BRANCH points to the head of the base branch. | ||
# Additionally, we can not use a clone_depth of 1, but must use an unlimited clone. | ||
if($env:APPVEYOR_PULL_REQUEST_NUMBER) { | ||
git fetch -q origin $env:APPVEYOR_REPO_BRANCH | ||
$msgBaseLabel = "PR" | ||
} else { | ||
# However in a pushed branch, we must fetch master. | ||
git fetch -q origin master:master | ||
$msgBaseLabel = "Branch" | ||
} | ||
.\runlint.bat FETCH_HEAD "$flake8Output" | ||
if($LastExitCode -ne 0) { | ||
Set-AppveyorBuildVariable "testFailExitCode" $LastExitCode | ||
Add-AppveyorMessage "FAIL: Lint check. See test results for more information." | ||
} else { | ||
Add-AppveyorMessage "PASS: Lint check." | ||
} | ||
Push-AppveyorArtifact $flake8Output | ||
$junitXML = "$lintOutput\PR-Flake8.xml" | ||
py "$lintSource\createJunitReport.py" "$flake8Output" "$junitXML" | ||
Push-AppveyorArtifact $junitXML | ||
$wc = New-Object 'System.Net.WebClient' | ||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", $junitXML) | ||
$lintOutput = (Resolve-Path .\testOutput\lint\) | ||
$lintOutput = "$lintOutput\PR-lint.xml" | ||
.\runlint.bat "$lintOutput" | ||
if ($LastExitCode -ne 0) { | ||
Set-AppveyorBuildVariable "testFailExitCode" $LastExitCode | ||
Add-AppveyorMessage "FAIL: Lint check. See test results for more information." | ||
} else { | ||
Add-AppveyorMessage "PASS: Lint check." | ||
} | ||
Push-AppveyorArtifact $lintOutput | ||
$wc = New-Object 'System.Net.WebClient' | ||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", $lintOutput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Linting | ||
|
||
## Lint overview | ||
|
||
Our linting process involves running [Ruff](https://docs.astral.sh/ruff) to pick up linting issues and auto-apply fixes where possible. | ||
|
||
## Lint integration | ||
|
||
For faster lint results, or greater integration with your tools you may want to set up Ruff with your IDE. | ||
|
||
## Pre-commit hooks | ||
|
||
[Pre-commit hooks](https://pre-commit.com/) can be used to automatically run linting on files staged for commit. | ||
This will automatically apply lint fixes where possible, otherwise cancelling the commit on lint issues. | ||
|
||
From a shell, set up pre-commit scripts for your NVDA python environment: | ||
|
||
1. `venvUtils\ensureAndActivate.bat` | ||
1. `pre-commit install` | ||
|
||
Alternatively, set up pre-commit scripts globally: | ||
|
||
1. `pip install pre-commit` | ||
1. `pre-commit install --allow-missing-config` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,53 @@ | ||
[build-system] | ||
requires = ["setuptools<70", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.ruff] | ||
line-length = 110 | ||
|
||
builtins = [ | ||
# translation lookup | ||
"_", | ||
# translation lookup | ||
"ngettext", | ||
# translation lookup | ||
"pgettext", | ||
# translation lookup | ||
"npgettext", | ||
] | ||
|
||
logger-objects = ["logHandler.log"] | ||
|
||
include = [ | ||
"*.py", | ||
"*.pyw", | ||
] | ||
|
||
exclude = [ | ||
".git", | ||
"__pycache__", | ||
".tox", | ||
"build", | ||
"output", | ||
# When excluding concrete paths relative to a directory, | ||
# not matching multiple folders by name e.g. `__pycache__`, | ||
# paths are relative to the configuration file. | ||
"./include/*", | ||
"./miscDeps", | ||
"./source/louis", | ||
# #10924: generated by third-party dependencies | ||
"./source/comInterfaces/*", | ||
] | ||
|
||
[tool.ruff.format] | ||
indent-style = "tab" | ||
line-ending = "lf" | ||
|
||
[tool.ruff.lint.mccabe] | ||
max-complexity = 15 | ||
|
||
[tool.ruff.lint] | ||
ignore = [ | ||
# indentation contains tabs | ||
"W191", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
@echo off | ||
rem runlint <base commit> [<output file>] | ||
rem Lints any changes after base commit up to and including current HEAD, plus any uncommitted changes. | ||
rem runlint [<output file>] | ||
rem Lints the entire repository | ||
set hereOrig=%~dp0 | ||
set here=%hereOrig% | ||
if #%hereOrig:~-1%# == #\# set here=%hereOrig:~0,-1% | ||
set scriptsDir=%here%\venvUtils | ||
set lintFilesPath=%here%\tests\lint | ||
|
||
call "%scriptsDir%\venvCmd.bat" py "%lintFilesPath%\genDiff.py" %1 "%lintFilesPath%\_lint.diff" | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | ||
set flake8Args=--diff --config="%lintFilesPath%\flake8.ini" | ||
if "%2" NEQ "" set flake8Args=%flake8Args% --tee --output-file=%2 | ||
type "%lintFilesPath%\_lint.diff" | call "%scriptsDir%\venvCmd.bat" py -Xutf8 -m flake8 %flake8Args% | ||
|
||
if "%1" NEQ "" set ruffArgs=--output-file=%1 --output-format=junit | ||
call "%scriptsDir%\venvCmd.bat" ruff check --fix %ruffArgs% | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.