ruff check文件目錄檢測(cè)--exclude參數(shù)設(shè)置路徑詳解
ruff check --help
Run Ruff on the given files or directories (default)
Usage: ruff check [OPTIONS] [FILES]...
Arguments:
[FILES]... List of files or directories to check
Options:
--fix
Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include unsafe fixes
--unsafe-fixes
Include fixes that may not retain the original intent of the code. Use `--no-unsafe-fixes` to disable
--show-source
Show violations with source code. Use `--no-show-source` to disable
--show-fixes
Show an enumeration of all fixed lint violations. Use `--no-show-fixes` to disable
--diff
Avoid writing any fixed files back; instead, output a diff for each changed file to stdout. Implies `--fix-only`
-w, --watch
Run in watch mode by re-running whenever files change
--fix-only
Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--unsafe-fixes` to include unsafe fixes
--ignore-noqa
Ignore any `# noqa` comments
--output-format <OUTPUT_FORMAT>
Output serialization format for violations [env: RUFF_OUTPUT_FORMAT=] [possible values: text, json, json-lines, junit, grouped, github, gitlab, pylint, azure]
-o, --output-file <OUTPUT_FILE>
Specify file to write the linter output to (default: stdout)
--target-version <TARGET_VERSION>
The minimum Python version that should be supported [possible values: py37, py38, py39, py310, py311, py312]
--preview
Enable preview mode; checks will include unstable rules and fixes. Use `--no-preview` to disable
--config <CONFIG>
Path to the `pyproject.toml` or `ruff.toml` file to use for configuration
--statistics
Show counts for every rule with at least one violation
--add-noqa
Enable automatic additions of `noqa` directives to failing lines
--show-files
See the files Ruff will be run against with the current settings
--show-settings
See the settings Ruff will use to lint a given Python file
-h, --help
Print help
Rule selection:
--select <RULE_CODE>
Comma-separated list of rule codes to enable (or ALL, to enable all rules)
--ignore <RULE_CODE>
Comma-separated list of rule codes to disable
--extend-select <RULE_CODE>
Like --select, but adds additional rule codes on top of those already specified
--per-file-ignores <PER_FILE_IGNORES>
List of mappings from file pattern to code to exclude
--extend-per-file-ignores <EXTEND_PER_FILE_IGNORES>
Like `--per-file-ignores`, but adds additional ignores on top of those already specified
--fixable <RULE_CODE>
List of rule codes to treat as eligible for fix. Only applicable when fix itself is enabled (e.g., via `--fix`)
--unfixable <RULE_CODE>
List of rule codes to treat as ineligible for fix. Only applicable when fix itself is enabled (e.g., via `--fix`)
--extend-fixable <RULE_CODE>
Like --fixable, but adds additional rule codes on top of those already specified
File selection:
--exclude <FILE_PATTERN> List of paths, used to omit files and/or directories from analysis
--extend-exclude <FILE_PATTERN> Like --exclude, but adds additional files and directories on top of those already excluded
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files. Use `--no-respect-gitignore` to disable
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line. Use `--no-force-exclude` to disable
Miscellaneous:
-n, --no-cache
Disable cache reads
--isolated
Ignore all configuration files
--cache-dir <CACHE_DIR>
Path to the cache directory [env: RUFF_CACHE_DIR=]
--stdin-filename <STDIN_FILENAME>
The name of the file when passing it through stdin
-e, --exit-zero
Exit with status code "0", even upon detecting lint violations
--exit-non-zero-on-fix
Exit with a non-zero status code if any files were modified via fix, even if no lint violations remain
Log levels:
-v, --verbose Enable verbose logging
-q, --quiet Print diagnostics, but nothing else
-s, --silent Disable all logging (but still exit with status code "1" upon detecting diagnostics)主要部分
File selection:
--exclude <FILE_PATTERN> List of paths, used to omit files and/or directories from analysis
--extend-exclude <FILE_PATTERN> Like --exclude, but adds additional files and directories on top of those already excluded
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files. Use `--no-respect-gitignore` to disable
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line. Use `--no-force-exclude` to disable錯(cuò)誤做法
ruff check . --exclude testing,dev
ruff check . --exclude testing;dev
正確做法
使用 --extend-exclude 追加
ruff check . --exclude testing --extend-exclude dev
如果有更多目錄呢?無(wú)限追加 --extend-exclude 就好了
ruff check . --exclude testing --extend-exclude dev --extend-exclude core
以上就是ruff check文件目錄檢測(cè)--exclude參數(shù)設(shè)置路徑詳解的詳細(xì)內(nèi)容,更多關(guān)于ruff check exclude參數(shù)設(shè)置路徑的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Python使用psutil庫(kù)實(shí)現(xiàn)系統(tǒng)監(jiān)控與管理詳解
在我們的測(cè)試工作中,監(jiān)控和管理系統(tǒng)資源是一項(xiàng)重要的任務(wù),本文將介紹如何使用psutil庫(kù)來(lái)實(shí)現(xiàn)系統(tǒng)監(jiān)控和管理,以及一些實(shí)用的技巧和示例,希望對(duì)大家有所幫助2022-10-10
使用Python做一個(gè)文檔轉(zhuǎn)化器的代碼實(shí)現(xiàn)
Python 文檔轉(zhuǎn)換器項(xiàng)目旨在通過(guò) Python 技術(shù)實(shí)現(xiàn)多種文檔格式之間的自動(dòng)化轉(zhuǎn)換,解決不同格式文件在跨平臺(tái)、跨應(yīng)用場(chǎng)景下的兼容性問(wèn)題,本文給大家介紹了如何使用Python做一個(gè)文檔轉(zhuǎn)化器,需要的朋友可以參考下2026-02-02
python實(shí)現(xiàn)名片管理系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)名片管理系統(tǒng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-11-11
numpy工程實(shí)踐之np.savetxt()存儲(chǔ)數(shù)據(jù)
NumPy提供了多種存取數(shù)組內(nèi)容的文件操作函數(shù),保存數(shù)組數(shù)據(jù)的文件可以是二進(jìn)制格式或者文本格式,下面這篇文章主要給大家介紹了關(guān)于numpy工程實(shí)踐之np.savetxt()存儲(chǔ)數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下2023-05-05
python十進(jìn)制轉(zhuǎn)二進(jìn)制的詳解
在本篇文章里小編給大家整理了關(guān)于python十進(jìn)制轉(zhuǎn)二進(jìn)制的相關(guān)知識(shí)點(diǎn)內(nèi)容,需要的朋友們可以參考學(xué)習(xí)下。2020-02-02
PyTorch實(shí)現(xiàn)線(xiàn)性回歸詳細(xì)過(guò)程
本文介紹PyTorch實(shí)現(xiàn)線(xiàn)性回歸,線(xiàn)性關(guān)系是一種非常簡(jiǎn)單的變量之間的關(guān)系,因變量和自變量在線(xiàn)性關(guān)系的情況下,可以使用線(xiàn)性回歸算法對(duì)一個(gè)或多個(gè)因變量和自變量間的線(xiàn)性關(guān)系進(jìn)行建模,該模型的系數(shù)可以用最小二乘法進(jìn)行求解,需要的朋友可以參考一下2022-03-03
解決plt.savefig()和plt.show()方法得到的圖片不一樣問(wèn)題
這篇文章主要介紹了解決plt.savefig()和plt.show()方法得到的圖片不一樣問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-08-08

