File tree Expand file tree Collapse file tree 9 files changed +76
-32
lines changed
Expand file tree Collapse file tree 9 files changed +76
-32
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ reviews:
3737 Also consider readability and clarity of contents.
3838 Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.
3939 "
40+ - path : " user_docs/en/changes.md"
41+ instructions : "
42+ Ensure each change log entry references an issue or pull request number.
43+ Change log entries can also include a reference to a GitHub author.
44+ Examples of valid change log entries:
45+ * Item with sub-items (#123, @username):
46+ * sub-item
47+ * bar (#342)
48+ * Item with.
49+ Multiple lines. (#143)
50+ "
4051 tools :
4152 github-checks :
4253 enabled : true
Original file line number Diff line number Diff line change 11repos :
2+
3+ - repo : https://github.com/pre-commit/pre-commit-hooks
4+ rev : v4.6.0
5+ hooks :
6+ # Checks python syntax
7+ - id : check-ast
8+ - id : check-case-conflict
9+ - id : check-merge-conflict
10+ - id : end-of-file-fixer
11+ - id : trailing-whitespace
12+
213- repo : https://github.com/astral-sh/ruff-pre-commit
3- # Ruff version.
4- rev : v0.4.10
14+ # Matches Ruff version in requirements .
15+ rev : v0.5.0
516 hooks :
6- # Run the linter.
717 - id : ruff
18+ name : lint with ruff
819 args : [ --fix ]
9- # Run the formatter.
1020 - id : ruff-format
21+ name : format with ruff
1122
1223- repo : local
1324 hooks :
25+ - id : checkPot
26+ name : translation string check
27+ entry : cmd.exe /c "scons checkPot -j 4"
28+ language : system
29+ pass_filenames : false
30+ types : [python, pofile]
31+ - id : unitTest
32+ name : unit tests
33+ entry : ./rununittests.bat
34+ language : script
35+ pass_filenames : false
36+ types : [python, c, c++, batch]
1437 - id : licenseCheck
1538 name : Check license compatibility of pip dependencies
1639 files : requirements.txt
Original file line number Diff line number Diff line change 11$lintOutput = (Resolve-Path .\testOutput\lint\)
2- $lintOutput = " $lintOutput \PR-lint.xml"
32.\runlint.bat " $lintOutput "
43if ($LastExitCode -ne 0 ) {
54 Set-AppveyorBuildVariable " testFailExitCode" $LastExitCode
6- Add-AppveyorMessage " FAIL: Lint check. See test results for more information."
5+ Add-AppveyorMessage " FAIL: Lint check. See test results and lint artifacts for more information."
76} else {
87 Add-AppveyorMessage " PASS: Lint check."
98}
10- Push-AppveyorArtifact $lintOutput
9+ Push-AppveyorArtifact " $lintOutput /PR-lint.xml"
10+ Push-AppveyorArtifact " $lintOutput /lint-diff.diff"
1111$wc = New-Object ' System.Net.WebClient'
12- $wc.UploadFile (" https://ci.appveyor.com/api/testresults/junit/$ ( $env: APPVEYOR_JOB_ID ) " , $lintOutput )
12+ $wc.UploadFile (" https://ci.appveyor.com/api/testresults/junit/$ ( $env: APPVEYOR_JOB_ID ) " , " $lintOutput /PR-lint.xml " )
Original file line number Diff line number Diff line change 11$outDir = (Resolve-Path .\testOutput\unit\)
22$unitTestsXml = " $outDir \unitTests.xml"
3- .\rununittests.bat -- output- file " $unitTestsXml "
3+ .\rununittests.bat -- output- file " $unitTestsXml " - v
44if ($LastExitCode -ne 0 ) {
55 Set-AppveyorBuildVariable " testFailExitCode" $LastExitCode
66 Add-AppveyorMessage " FAIL: Unit tests. See test results for more information."
Original file line number Diff line number Diff line change @@ -7,18 +7,3 @@ Our linting process involves running [Ruff](https://docs.astral.sh/ruff) to pick
77## Lint integration
88
99For faster lint results, or greater integration with your tools you may want to set up Ruff with your IDE.
10-
11- ## Pre-commit hooks
12-
13- [ Pre-commit hooks] ( https://pre-commit.com/ ) can be used to automatically run linting on files staged for commit.
14- This will automatically apply lint fixes where possible, otherwise cancelling the commit on lint issues.
15-
16- From a shell, set up pre-commit scripts for your NVDA python environment:
17-
18- 1 . ` venvUtils\ensureAndActivate.bat `
19- 1 . ` pre-commit install `
20-
21- Alternatively, set up pre-commit scripts globally:
22-
23- 1 . ` pip install pre-commit `
24- 1 . ` pre-commit install --allow-missing-config `
Original file line number Diff line number Diff line change 11## Running Automated Tests
2+
23If you make a change to the NVDA code, you should run NVDA's automated tests.
34These tests help to ensure that code changes do not unintentionally break functionality that was previously working.
45
6+ ### Pre-commit hooks
7+
8+ [ Pre-commit hooks] ( https://pre-commit.com/ ) can be used to automatically run linting, translatable string checks and unit tests on files staged for commit.
9+ This will automatically apply lint fixes where possible, and will cancel the commit on lint issues and other test failures.
10+
11+ From a shell, set up pre-commit scripts for your NVDA python environment:
12+
13+ 1 . ` venvUtils\ensureAndActivate.bat `
14+ 1 . ` pre-commit install `
15+
16+ Alternatively, set up pre-commit scripts globally:
17+
18+ 1 . ` pip install pre-commit `
19+ 1 . ` pre-commit install --allow-missing-config `
20+
21+ To skip pre-commit hooks from triggering, use the ` --no-verify ` CLI option.
22+ Example: ` git commit -m "message" --no-verify ` .
23+
524### Translatable string checks
25+
626To run the translatable string checks (which check that all translatable strings have translator comments), run:
727
828``` cmd
Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ builtins = [
1616 " npgettext" ,
1717]
1818
19- logger-objects = [" logHandler.log" ]
20-
2119include = [
2220 " *.py" ,
2321 " *.pyw" ,
22+ " sconstruct" ,
23+ " *sconscript" ,
2424]
2525
2626exclude = [
@@ -51,6 +51,7 @@ ignore = [
5151 # indentation contains tabs
5252 " W191" ,
5353]
54+ logger-objects = [" logHandler.log" ]
5455
5556[tool .licensecheck ]
5657using = " requirements:requirements.txt"
@@ -79,4 +80,3 @@ ignore_packages = [
7980 " wxPython" , # wxWindows Library License
8081 " pillow" , # PIL Software License
8182]
82-
Original file line number Diff line number Diff line change 11@ echo off
2- rem runlint [< output file > ]
3- rem Lints the entire repository
2+ rem runlint [< output dir > ]
3+ rem Lints and formats all python files
44set hereOrig = %~dp0
55set here = %hereOrig%
66if #%hereOrig:~-1 % # == #\# set here = %hereOrig:~0 ,-1 %
77set scriptsDir = %here% \venvUtils
88
9- if " %1 " NEQ " " set ruffArgs = --output-file=%1 --output-format=junit
10- call " %scriptsDir% \venvCmd.bat" ruff check --fix %ruffArgs%
9+ set ruffCheckArgs =
10+ set ruffFormatArgs =
11+ if " %1 " NEQ " " set ruffCheckArgs = --output-file=%1 /PR-lint.xml --output-format=junit
12+ if " %1 " NEQ " " set ruffFormatArgs = --diff > %1 /lint-diff.diff
13+ call " %scriptsDir% \venvCmd.bat" ruff check --fix %ruffCheckArgs%
14+ if ERRORLEVEL 1 exit /b %ERRORLEVEL%
15+ call " %scriptsDir% \venvCmd.bat" ruff format %ruffFormatArgs%
1116if ERRORLEVEL 1 exit /b %ERRORLEVEL%
Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ set unitTestsPath=%here%\tests\unit
77set testOutput = %here% \testOutput\unit
88md %testOutput%
99
10- call " %scriptsDir% \venvCmd.bat" py -m xmlrunner discover -v -s " %unitTestsPath% " -t " %here% " --output-file " %testOutput% \unitTests.xml" %*
10+ call " %scriptsDir% \venvCmd.bat" py -m xmlrunner discover -b -s " %unitTestsPath% " -t " %here% " --output-file " %testOutput% \unitTests.xml" %*
You can’t perform that action at this time.
0 commit comments