-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruff changes, expand pre-commit hooks to checkPot and unit tests (#16767
) Fix up for #16751 Summary of the issue: Ruff recently updated, so we might as well use the latest version. a warning is omitted for the section we added logger-objects to in ruff's config. it was unclear in docs how to avoid pre-commit hooks from triggering. more pre-commit hooks could be added ruff whitespace formating is done through ruff format currently we are only linting with ruff check. We should also run a ruff format on the whole NVDA. ruff was missing scons files, which should also be linted in a mass lint. Summary of other changes: Added pre commit hooks for unit tests and translation comment checks. Added generic pre-commit hooks for python static syntax checking, basic whitespace rules, and file write safety checks change the output of rununittests.bat to have simpler buffer output, only show failures. Ensure the verbose log is logged in AppVeyor. add ruff format to lint checks add scons files to lint checks update coderabbit prompt for change log entry items
- Loading branch information
Showing
9 changed files
with
76 additions
and
32 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
$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." | ||
Add-AppveyorMessage "FAIL: Lint check. See test results and lint artifacts for more information." | ||
} else { | ||
Add-AppveyorMessage "PASS: Lint check." | ||
} | ||
Push-AppveyorArtifact $lintOutput | ||
Push-AppveyorArtifact "$lintOutput/PR-lint.xml" | ||
Push-AppveyorArtifact "$lintOutput/lint-diff.diff" | ||
$wc = New-Object 'System.Net.WebClient' | ||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", $lintOutput) | ||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", "$lintOutput/PR-lint.xml") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
@echo off | ||
rem runlint [<output file>] | ||
rem Lints the entire repository | ||
rem runlint [<output dir>] | ||
rem Lints and formats all python files | ||
set hereOrig=%~dp0 | ||
set here=%hereOrig% | ||
if #%hereOrig:~-1%# == #\# set here=%hereOrig:~0,-1% | ||
set scriptsDir=%here%\venvUtils | ||
|
||
if "%1" NEQ "" set ruffArgs=--output-file=%1 --output-format=junit | ||
call "%scriptsDir%\venvCmd.bat" ruff check --fix %ruffArgs% | ||
set ruffCheckArgs= | ||
set ruffFormatArgs= | ||
if "%1" NEQ "" set ruffCheckArgs=--output-file=%1/PR-lint.xml --output-format=junit | ||
if "%1" NEQ "" set ruffFormatArgs=--diff > %1/lint-diff.diff | ||
call "%scriptsDir%\venvCmd.bat" ruff check --fix %ruffCheckArgs% | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | ||
call "%scriptsDir%\venvCmd.bat" ruff format %ruffFormatArgs% | ||
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