ruff check文件目錄檢測--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
如果有更多目錄呢?無限追加 --extend-exclude 就好了
ruff check . --exclude testing --extend-exclude dev --extend-exclude core
以上就是ruff check文件目錄檢測--exclude參數(shù)設(shè)置路徑詳解的詳細(xì)內(nèi)容,更多關(guān)于ruff check exclude參數(shù)設(shè)置路徑的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Python對(duì)Excel不同的行分別復(fù)制不同的次數(shù)
這篇文章主要介紹了如何利用Python實(shí)現(xiàn)讀取Excel表格文件數(shù)據(jù),并將其中符合我們特定要求的那一行加以復(fù)制指定的次數(shù),感興趣的小伙伴可以學(xué)習(xí)一下2023-07-07
Python統(tǒng)計(jì)字符內(nèi)容的占比的實(shí)現(xiàn)
本文介紹了如何使用Python統(tǒng)計(jì)字符占比,包括字符串中字母、數(shù)字、空格等字符的占比,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-08-08
基于Python實(shí)現(xiàn)簡易的動(dòng)漫圖片轉(zhuǎn)換器
本文旨在利用Python語言制作一個(gè)將普通照片轉(zhuǎn)換成動(dòng)漫圖片的小工具,其中使用opencv的非標(biāo)準(zhǔn)庫實(shí)現(xiàn)對(duì)圖片完成轉(zhuǎn)換,感興趣的可以嘗試一下2022-08-08
Python中l(wèi)ambda的用法及其與def的區(qū)別解析
這篇文章主要介紹了Python中l(wèi)ambda的用法及其與def的區(qū)別解析,需要的朋友可以參考下2014-07-07
我用Python給班主任寫了一個(gè)自動(dòng)閱卷腳本(附源碼)
這篇文章主要介紹了如何用Python給寫了一個(gè)自動(dòng)閱卷腳本,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-08-08
Python中字典和JSON互轉(zhuǎn)操作實(shí)例
這篇文章主要介紹了Python中字典和JSON互轉(zhuǎn)操作實(shí)例,本文給出了Dict轉(zhuǎn)JSON、讀取JSON并轉(zhuǎn)為Dict示例,需要的朋友可以參考下2015-01-01
python中必會(huì)的四大高級(jí)數(shù)據(jù)類型(字符,元組,列表,字典)
這篇文章主要介紹了python中必會(huì)的四大高級(jí)數(shù)據(jù)類型(字符,元組,列表,字典),本文通過實(shí)例圖文相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-05-05

