onnxruntime/tools/ci_build/github/windows
Justin Chu d834ec895a
Adopt linrtunner as the linting tool - take 2 (#15085)
### Description

`lintrunner` is a linter runner successfully used by pytorch, onnx and
onnx-script. It provides a uniform experience running linters locally
and in CI. It supports all major dev systems: Windows, Linux and MacOs.
The checks are enforced by the `Python format` workflow.

This PR adopts `lintrunner` to onnxruntime and fixed ~2000 flake8 errors
in Python code. `lintrunner` now runs all required python lints
including `ruff`(replacing `flake8`), `black` and `isort`. Future lints
like `clang-format` can be added.

Most errors are auto-fixed by `ruff` and the fixes should be considered
robust.

Lints that are more complicated to fix are applied `# noqa` for now and
should be fixed in follow up PRs.

### Notable changes

1. This PR **removed some suboptimal patterns**:

	- `not xxx in` -> `xxx not in` membership checks
	- bare excepts (`except:` -> `except Exception`)
	- unused imports
	
	The follow up PR will remove:
	
	- `import *`
	- mutable values as default in function definitions (`def func(a=[])`)
	- more unused imports
	- unused local variables

2. Use `ruff` to replace `flake8`. `ruff` is much (40x) faster than
flake8 and is more robust. We are using it successfully in onnx and
onnx-script. It also supports auto-fixing many flake8 errors.

3. Removed the legacy flake8 ci flow and updated docs.

4. The added workflow supports SARIF code scanning reports on github,
example snapshot:
	

![image](https://user-images.githubusercontent.com/11205048/212598953-d60ce8a9-f242-4fa8-8674-8696b704604a.png)

5. Removed `onnxruntime-python-checks-ci-pipeline` as redundant

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Unified linting experience in CI and local.

Replacing https://github.com/microsoft/onnxruntime/pull/14306

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
2023-03-24 15:29:03 -07:00
..
eager Update torch in eager mode CI pipeline (#14094) 2023-01-06 11:46:44 -08:00
post_to_dashboard Pin version of post to dashboard scripts' dependencies and update them to work with recent version. (#10353) 2022-01-21 19:35:58 -08:00
bundle_dlls_gpu.bat Create combined GPU tarball and zip file package (#8827) 2021-08-25 13:51:18 -07:00
bundle_nuget_with_native_headers.bat Add TRT header file to ORT GPU nuget package (#8962) 2021-09-07 09:50:09 -07:00
extract_nuget_files.ps1 Patch Protobuf and ONNX's cmake files and enforce BinSkim check (#13694) 2022-11-18 10:09:47 -08:00
extract_nuget_files_gpu.ps1 Patch Protobuf and ONNX's cmake files and enforce BinSkim check (#13694) 2022-11-18 10:09:47 -08:00
extract_zip_files_gpu.ps1 Fix issue of GPU tarball/zip/java package (#8850) 2021-08-26 10:16:16 -07:00
helpers.ps1 upgrade protobuf to 3.20.2 and onnx to 1.13 (#14279) 2023-01-31 12:55:09 -08:00
install_third_party_deps.ps1 upgrade protobuf to 3.20.2 and onnx to 1.13 (#14279) 2023-01-31 12:55:09 -08:00
jar_gpu_packaging.ps1 Create combined GPU tarball and zip file package (#8827) 2021-08-25 13:51:18 -07:00
jar_packaging.ps1 remove wrong placed libs (#12201) 2022-07-18 09:22:22 -07:00
post_binary_sizes_to_dashboard.py Adopt linrtunner as the linting tool - take 2 (#15085) 2023-03-24 15:29:03 -07:00
post_code_coverage_to_dashboard.py Adopt linrtunner as the linting tool - take 2 (#15085) 2023-03-24 15:29:03 -07:00
set_telemetry_var.ps1 BUG FIX: the if...else in telemetry-steps.yml does not really work (#14972) 2023-03-10 15:39:07 -08:00
setup_env.bat Add license header to some files. (#13074) 2022-09-23 18:46:02 -07:00
setup_env_azure.bat Rename CloudEP to AzureEP (#14175) 2023-01-11 12:25:04 -08:00
setup_env_cuda_11.bat Add license header to some files. (#13074) 2022-09-23 18:46:02 -07:00
setup_env_gpu.bat [TensorRT EP] support TensorRT 8.5 (#13867) 2022-12-14 13:06:03 -08:00
setup_env_trt.bat Move build machines with Nvidia M60 GPUs to Nvidia T4 (#13170) 2022-10-25 11:21:13 -07:00
setup_env_x86.bat Add license header to some files. (#13074) 2022-09-23 18:46:02 -07:00