mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Move copyright
rules to flake8_copyright
module (#5236)
## Summary I initially wanted this category to be more general and decoupled from the plugin, but I got some feedback that the titling felt inconsistent with others.
This commit is contained in:
parent
1db7d9e759
commit
07b6b7401f
27 changed files with 102 additions and 102 deletions
|
@ -8,7 +8,7 @@ use ruff_python_ast::source_code::{Indexer, Locator, Stylist};
|
||||||
use ruff_python_whitespace::UniversalNewlines;
|
use ruff_python_whitespace::UniversalNewlines;
|
||||||
|
|
||||||
use crate::registry::Rule;
|
use crate::registry::Rule;
|
||||||
use crate::rules::copyright::rules::missing_copyright_notice;
|
use crate::rules::flake8_copyright::rules::missing_copyright_notice;
|
||||||
use crate::rules::flake8_executable::helpers::{extract_shebang, ShebangDirective};
|
use crate::rules::flake8_executable::helpers::{extract_shebang, ShebangDirective};
|
||||||
use crate::rules::flake8_executable::rules::{
|
use crate::rules::flake8_executable::rules::{
|
||||||
shebang_missing, shebang_newline, shebang_not_executable, shebang_python, shebang_whitespace,
|
shebang_missing, shebang_newline, shebang_not_executable, shebang_python, shebang_whitespace,
|
||||||
|
|
|
@ -375,7 +375,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||||
(Flake8Simplify, "910") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
(Flake8Simplify, "910") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
||||||
|
|
||||||
// copyright
|
// copyright
|
||||||
(Copyright, "001") => (RuleGroup::Nursery, rules::copyright::rules::MissingCopyrightNotice),
|
(Copyright, "001") => (RuleGroup::Nursery, rules::flake8_copyright::rules::MissingCopyrightNotice),
|
||||||
|
|
||||||
// pyupgrade
|
// pyupgrade
|
||||||
(Pyupgrade, "001") => (RuleGroup::Unspecified, rules::pyupgrade::rules::UselessMetaclassType),
|
(Pyupgrade, "001") => (RuleGroup::Unspecified, rules::pyupgrade::rules::UselessMetaclassType),
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
|
||||||
---
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ import os
|
||||||
"#
|
"#
|
||||||
.trim(),
|
.trim(),
|
||||||
&settings::Settings {
|
&settings::Settings {
|
||||||
copyright: super::settings::Settings {
|
flake8_copyright: super::settings::Settings {
|
||||||
author: Some("Ruff".to_string()),
|
author: Some("Ruff".to_string()),
|
||||||
..super::settings::Settings::default()
|
..super::settings::Settings::default()
|
||||||
},
|
},
|
||||||
|
@ -95,7 +95,7 @@ import os
|
||||||
"#
|
"#
|
||||||
.trim(),
|
.trim(),
|
||||||
&settings::Settings {
|
&settings::Settings {
|
||||||
copyright: super::settings::Settings {
|
flake8_copyright: super::settings::Settings {
|
||||||
author: Some("Ruff".to_string()),
|
author: Some("Ruff".to_string()),
|
||||||
..super::settings::Settings::default()
|
..super::settings::Settings::default()
|
||||||
},
|
},
|
||||||
|
@ -113,7 +113,7 @@ import os
|
||||||
"#
|
"#
|
||||||
.trim(),
|
.trim(),
|
||||||
&settings::Settings {
|
&settings::Settings {
|
||||||
copyright: super::settings::Settings {
|
flake8_copyright: super::settings::Settings {
|
||||||
min_file_size: 256,
|
min_file_size: 256,
|
||||||
..super::settings::Settings::default()
|
..super::settings::Settings::default()
|
||||||
},
|
},
|
|
@ -28,7 +28,7 @@ pub(crate) fn missing_copyright_notice(
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
) -> Option<Diagnostic> {
|
) -> Option<Diagnostic> {
|
||||||
// Ignore files that are too small to contain a copyright notice.
|
// Ignore files that are too small to contain a copyright notice.
|
||||||
if locator.len() < settings.copyright.min_file_size {
|
if locator.len() < settings.flake8_copyright.min_file_size {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ pub(crate) fn missing_copyright_notice(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Locate the copyright notice.
|
// Locate the copyright notice.
|
||||||
if let Some(match_) = settings.copyright.notice_rgx.find(contents) {
|
if let Some(match_) = settings.flake8_copyright.notice_rgx.find(contents) {
|
||||||
match settings.copyright.author {
|
match settings.flake8_copyright.author {
|
||||||
Some(ref author) => {
|
Some(ref author) => {
|
||||||
// Ensure that it's immediately followed by the author.
|
// Ensure that it's immediately followed by the author.
|
||||||
if contents[match_.end()..].trim_start().starts_with(author) {
|
if contents[match_.end()..].trim_start().starts_with(author) {
|
|
@ -1,4 +1,4 @@
|
||||||
//! Settings for the `copyright` plugin.
|
//! Settings for the `flake8-copyright` plugin.
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
@ -12,7 +12,7 @@ use ruff_macros::{CacheKey, CombineOptions, ConfigurationOptions};
|
||||||
#[serde(
|
#[serde(
|
||||||
deny_unknown_fields,
|
deny_unknown_fields,
|
||||||
rename_all = "kebab-case",
|
rename_all = "kebab-case",
|
||||||
rename = "CopyrightOptions"
|
rename = "Flake8CopyrightOptions"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
pub struct Options {
|
pub struct Options {
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
---
|
---
|
||||||
<filename>:1:1: CPY001 Missing copyright notice at top of file
|
<filename>:1:1: CPY001 Missing copyright notice at top of file
|
||||||
|
|
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff/src/rules/copyright/mod.rs
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
---
|
---
|
||||||
<filename>:1:1: CPY001 Missing copyright notice at top of file
|
<filename>:1:1: CPY001 Missing copyright notice at top of file
|
||||||
|
|
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff/src/rules/flake8_copyright/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![allow(clippy::useless_format)]
|
#![allow(clippy::useless_format)]
|
||||||
pub mod airflow;
|
pub mod airflow;
|
||||||
pub mod copyright;
|
|
||||||
pub mod eradicate;
|
pub mod eradicate;
|
||||||
pub mod flake8_2020;
|
pub mod flake8_2020;
|
||||||
pub mod flake8_annotations;
|
pub mod flake8_annotations;
|
||||||
|
@ -12,6 +11,7 @@ pub mod flake8_bugbear;
|
||||||
pub mod flake8_builtins;
|
pub mod flake8_builtins;
|
||||||
pub mod flake8_commas;
|
pub mod flake8_commas;
|
||||||
pub mod flake8_comprehensions;
|
pub mod flake8_comprehensions;
|
||||||
|
pub mod flake8_copyright;
|
||||||
pub mod flake8_datetimez;
|
pub mod flake8_datetimez;
|
||||||
pub mod flake8_debugger;
|
pub mod flake8_debugger;
|
||||||
pub mod flake8_django;
|
pub mod flake8_django;
|
||||||
|
|
|
@ -16,8 +16,8 @@ use crate::fs;
|
||||||
use crate::line_width::{LineLength, TabSize};
|
use crate::line_width::{LineLength, TabSize};
|
||||||
use crate::rule_selector::RuleSelector;
|
use crate::rule_selector::RuleSelector;
|
||||||
use crate::rules::{
|
use crate::rules::{
|
||||||
copyright, flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins,
|
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
|
||||||
flake8_comprehensions, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||||
pycodestyle, pydocstyle, pyflakes, pylint,
|
pycodestyle, pydocstyle, pyflakes, pylint,
|
||||||
|
@ -75,14 +75,14 @@ pub struct Configuration {
|
||||||
pub flake8_bugbear: Option<flake8_bugbear::settings::Options>,
|
pub flake8_bugbear: Option<flake8_bugbear::settings::Options>,
|
||||||
pub flake8_builtins: Option<flake8_builtins::settings::Options>,
|
pub flake8_builtins: Option<flake8_builtins::settings::Options>,
|
||||||
pub flake8_comprehensions: Option<flake8_comprehensions::settings::Options>,
|
pub flake8_comprehensions: Option<flake8_comprehensions::settings::Options>,
|
||||||
pub copyright: Option<copyright::settings::Options>,
|
pub flake8_copyright: Option<flake8_copyright::settings::Options>,
|
||||||
pub flake8_errmsg: Option<flake8_errmsg::settings::Options>,
|
pub flake8_errmsg: Option<flake8_errmsg::settings::Options>,
|
||||||
|
pub flake8_gettext: Option<flake8_gettext::settings::Options>,
|
||||||
pub flake8_implicit_str_concat: Option<flake8_implicit_str_concat::settings::Options>,
|
pub flake8_implicit_str_concat: Option<flake8_implicit_str_concat::settings::Options>,
|
||||||
pub flake8_import_conventions: Option<flake8_import_conventions::settings::Options>,
|
pub flake8_import_conventions: Option<flake8_import_conventions::settings::Options>,
|
||||||
pub flake8_pytest_style: Option<flake8_pytest_style::settings::Options>,
|
pub flake8_pytest_style: Option<flake8_pytest_style::settings::Options>,
|
||||||
pub flake8_quotes: Option<flake8_quotes::settings::Options>,
|
pub flake8_quotes: Option<flake8_quotes::settings::Options>,
|
||||||
pub flake8_self: Option<flake8_self::settings::Options>,
|
pub flake8_self: Option<flake8_self::settings::Options>,
|
||||||
pub flake8_gettext: Option<flake8_gettext::settings::Options>,
|
|
||||||
pub flake8_tidy_imports: Option<flake8_tidy_imports::options::Options>,
|
pub flake8_tidy_imports: Option<flake8_tidy_imports::options::Options>,
|
||||||
pub flake8_type_checking: Option<flake8_type_checking::settings::Options>,
|
pub flake8_type_checking: Option<flake8_type_checking::settings::Options>,
|
||||||
pub flake8_unused_arguments: Option<flake8_unused_arguments::settings::Options>,
|
pub flake8_unused_arguments: Option<flake8_unused_arguments::settings::Options>,
|
||||||
|
@ -229,7 +229,7 @@ impl Configuration {
|
||||||
flake8_bugbear: options.flake8_bugbear,
|
flake8_bugbear: options.flake8_bugbear,
|
||||||
flake8_builtins: options.flake8_builtins,
|
flake8_builtins: options.flake8_builtins,
|
||||||
flake8_comprehensions: options.flake8_comprehensions,
|
flake8_comprehensions: options.flake8_comprehensions,
|
||||||
copyright: options.copyright,
|
flake8_copyright: options.flake8_copyright,
|
||||||
flake8_errmsg: options.flake8_errmsg,
|
flake8_errmsg: options.flake8_errmsg,
|
||||||
flake8_gettext: options.flake8_gettext,
|
flake8_gettext: options.flake8_gettext,
|
||||||
flake8_implicit_str_concat: options.flake8_implicit_str_concat,
|
flake8_implicit_str_concat: options.flake8_implicit_str_concat,
|
||||||
|
@ -308,7 +308,7 @@ impl Configuration {
|
||||||
flake8_comprehensions: self
|
flake8_comprehensions: self
|
||||||
.flake8_comprehensions
|
.flake8_comprehensions
|
||||||
.combine(config.flake8_comprehensions),
|
.combine(config.flake8_comprehensions),
|
||||||
copyright: self.copyright.combine(config.copyright),
|
flake8_copyright: self.flake8_copyright.combine(config.flake8_copyright),
|
||||||
flake8_errmsg: self.flake8_errmsg.combine(config.flake8_errmsg),
|
flake8_errmsg: self.flake8_errmsg.combine(config.flake8_errmsg),
|
||||||
flake8_gettext: self.flake8_gettext.combine(config.flake8_gettext),
|
flake8_gettext: self.flake8_gettext.combine(config.flake8_gettext),
|
||||||
flake8_implicit_str_concat: self
|
flake8_implicit_str_concat: self
|
||||||
|
|
|
@ -10,8 +10,8 @@ use crate::line_width::{LineLength, TabSize};
|
||||||
use crate::registry::Linter;
|
use crate::registry::Linter;
|
||||||
use crate::rule_selector::{prefix_to_selector, RuleSelector};
|
use crate::rule_selector::{prefix_to_selector, RuleSelector};
|
||||||
use crate::rules::{
|
use crate::rules::{
|
||||||
copyright, flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins,
|
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
|
||||||
flake8_comprehensions, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||||
pycodestyle, pydocstyle, pyflakes, pylint,
|
pycodestyle, pydocstyle, pyflakes, pylint,
|
||||||
|
@ -96,7 +96,7 @@ impl Default for Settings {
|
||||||
flake8_bugbear: flake8_bugbear::settings::Settings::default(),
|
flake8_bugbear: flake8_bugbear::settings::Settings::default(),
|
||||||
flake8_builtins: flake8_builtins::settings::Settings::default(),
|
flake8_builtins: flake8_builtins::settings::Settings::default(),
|
||||||
flake8_comprehensions: flake8_comprehensions::settings::Settings::default(),
|
flake8_comprehensions: flake8_comprehensions::settings::Settings::default(),
|
||||||
copyright: copyright::settings::Settings::default(),
|
flake8_copyright: flake8_copyright::settings::Settings::default(),
|
||||||
flake8_errmsg: flake8_errmsg::settings::Settings::default(),
|
flake8_errmsg: flake8_errmsg::settings::Settings::default(),
|
||||||
flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings::default(),
|
flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings::default(),
|
||||||
flake8_import_conventions: flake8_import_conventions::settings::Settings::default(),
|
flake8_import_conventions: flake8_import_conventions::settings::Settings::default(),
|
||||||
|
|
|
@ -16,8 +16,8 @@ use ruff_macros::CacheKey;
|
||||||
use crate::registry::{Rule, RuleNamespace, RuleSet, INCOMPATIBLE_CODES};
|
use crate::registry::{Rule, RuleNamespace, RuleSet, INCOMPATIBLE_CODES};
|
||||||
use crate::rule_selector::{RuleSelector, Specificity};
|
use crate::rule_selector::{RuleSelector, Specificity};
|
||||||
use crate::rules::{
|
use crate::rules::{
|
||||||
copyright, flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins,
|
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
|
||||||
flake8_comprehensions, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||||
pycodestyle, pydocstyle, pyflakes, pylint,
|
pycodestyle, pydocstyle, pyflakes, pylint,
|
||||||
|
@ -112,11 +112,11 @@ pub struct Settings {
|
||||||
pub flake8_bugbear: flake8_bugbear::settings::Settings,
|
pub flake8_bugbear: flake8_bugbear::settings::Settings,
|
||||||
pub flake8_builtins: flake8_builtins::settings::Settings,
|
pub flake8_builtins: flake8_builtins::settings::Settings,
|
||||||
pub flake8_comprehensions: flake8_comprehensions::settings::Settings,
|
pub flake8_comprehensions: flake8_comprehensions::settings::Settings,
|
||||||
pub copyright: copyright::settings::Settings,
|
pub flake8_copyright: flake8_copyright::settings::Settings,
|
||||||
pub flake8_errmsg: flake8_errmsg::settings::Settings,
|
pub flake8_errmsg: flake8_errmsg::settings::Settings,
|
||||||
|
pub flake8_gettext: flake8_gettext::settings::Settings,
|
||||||
pub flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings,
|
pub flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings,
|
||||||
pub flake8_import_conventions: flake8_import_conventions::settings::Settings,
|
pub flake8_import_conventions: flake8_import_conventions::settings::Settings,
|
||||||
pub flake8_gettext: flake8_gettext::settings::Settings,
|
|
||||||
pub flake8_pytest_style: flake8_pytest_style::settings::Settings,
|
pub flake8_pytest_style: flake8_pytest_style::settings::Settings,
|
||||||
pub flake8_quotes: flake8_quotes::settings::Settings,
|
pub flake8_quotes: flake8_quotes::settings::Settings,
|
||||||
pub flake8_self: flake8_self::settings::Settings,
|
pub flake8_self: flake8_self::settings::Settings,
|
||||||
|
@ -210,9 +210,9 @@ impl Settings {
|
||||||
.flake8_comprehensions
|
.flake8_comprehensions
|
||||||
.map(flake8_comprehensions::settings::Settings::from)
|
.map(flake8_comprehensions::settings::Settings::from)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
copyright: config
|
flake8_copyright: config
|
||||||
.copyright
|
.flake8_copyright
|
||||||
.map(copyright::settings::Settings::try_from)
|
.map(flake8_copyright::settings::Settings::try_from)
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
flake8_errmsg: config
|
flake8_errmsg: config
|
||||||
|
|
|
@ -8,8 +8,8 @@ use ruff_macros::ConfigurationOptions;
|
||||||
use crate::line_width::{LineLength, TabSize};
|
use crate::line_width::{LineLength, TabSize};
|
||||||
use crate::rule_selector::RuleSelector;
|
use crate::rule_selector::RuleSelector;
|
||||||
use crate::rules::{
|
use crate::rules::{
|
||||||
copyright, flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins,
|
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
|
||||||
flake8_comprehensions, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||||
pycodestyle, pydocstyle, pyflakes, pylint,
|
pycodestyle, pydocstyle, pyflakes, pylint,
|
||||||
|
@ -499,7 +499,7 @@ pub struct Options {
|
||||||
pub flake8_comprehensions: Option<flake8_comprehensions::settings::Options>,
|
pub flake8_comprehensions: Option<flake8_comprehensions::settings::Options>,
|
||||||
#[option_group]
|
#[option_group]
|
||||||
/// Options for the `copyright` plugin.
|
/// Options for the `copyright` plugin.
|
||||||
pub copyright: Option<copyright::settings::Options>,
|
pub flake8_copyright: Option<flake8_copyright::settings::Options>,
|
||||||
#[option_group]
|
#[option_group]
|
||||||
/// Options for the `flake8-errmsg` plugin.
|
/// Options for the `flake8-errmsg` plugin.
|
||||||
pub flake8_errmsg: Option<flake8_errmsg::settings::Options>,
|
pub flake8_errmsg: Option<flake8_errmsg::settings::Options>,
|
||||||
|
|
|
@ -9,8 +9,8 @@ use ruff::line_width::{LineLength, TabSize};
|
||||||
use ruff::linter::{check_path, LinterResult};
|
use ruff::linter::{check_path, LinterResult};
|
||||||
use ruff::registry::AsRule;
|
use ruff::registry::AsRule;
|
||||||
use ruff::rules::{
|
use ruff::rules::{
|
||||||
copyright, flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins,
|
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
|
||||||
flake8_comprehensions, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||||
pycodestyle, pydocstyle, pyflakes, pylint,
|
pycodestyle, pydocstyle, pyflakes, pylint,
|
||||||
|
@ -138,11 +138,8 @@ pub fn defaultSettings() -> Result<JsValue, JsValue> {
|
||||||
flake8_bugbear: Some(flake8_bugbear::settings::Settings::default().into()),
|
flake8_bugbear: Some(flake8_bugbear::settings::Settings::default().into()),
|
||||||
flake8_builtins: Some(flake8_builtins::settings::Settings::default().into()),
|
flake8_builtins: Some(flake8_builtins::settings::Settings::default().into()),
|
||||||
flake8_comprehensions: Some(flake8_comprehensions::settings::Settings::default().into()),
|
flake8_comprehensions: Some(flake8_comprehensions::settings::Settings::default().into()),
|
||||||
copyright: Some(copyright::settings::Settings::default().into()),
|
flake8_copyright: Some(flake8_copyright::settings::Settings::default().into()),
|
||||||
flake8_errmsg: Some(flake8_errmsg::settings::Settings::default().into()),
|
flake8_errmsg: Some(flake8_errmsg::settings::Settings::default().into()),
|
||||||
flake8_pytest_style: Some(flake8_pytest_style::settings::Settings::default().into()),
|
|
||||||
flake8_quotes: Some(flake8_quotes::settings::Settings::default().into()),
|
|
||||||
flake8_self: Some(flake8_self::settings::Settings::default().into()),
|
|
||||||
flake8_gettext: Some(flake8_gettext::settings::Settings::default().into()),
|
flake8_gettext: Some(flake8_gettext::settings::Settings::default().into()),
|
||||||
flake8_implicit_str_concat: Some(
|
flake8_implicit_str_concat: Some(
|
||||||
flake8_implicit_str_concat::settings::Settings::default().into(),
|
flake8_implicit_str_concat::settings::Settings::default().into(),
|
||||||
|
@ -150,6 +147,9 @@ pub fn defaultSettings() -> Result<JsValue, JsValue> {
|
||||||
flake8_import_conventions: Some(
|
flake8_import_conventions: Some(
|
||||||
flake8_import_conventions::settings::Settings::default().into(),
|
flake8_import_conventions::settings::Settings::default().into(),
|
||||||
),
|
),
|
||||||
|
flake8_pytest_style: Some(flake8_pytest_style::settings::Settings::default().into()),
|
||||||
|
flake8_quotes: Some(flake8_quotes::settings::Settings::default().into()),
|
||||||
|
flake8_self: Some(flake8_self::settings::Settings::default().into()),
|
||||||
flake8_tidy_imports: Some(flake8_tidy_imports::settings::Settings::default().into()),
|
flake8_tidy_imports: Some(flake8_tidy_imports::settings::Settings::default().into()),
|
||||||
flake8_type_checking: Some(flake8_type_checking::settings::Settings::default().into()),
|
flake8_type_checking: Some(flake8_type_checking::settings::Settings::default().into()),
|
||||||
flake8_unused_arguments: Some(
|
flake8_unused_arguments: Some(
|
||||||
|
|
80
ruff.schema.json
generated
80
ruff.schema.json
generated
|
@ -32,17 +32,6 @@
|
||||||
"null"
|
"null"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"copyright": {
|
|
||||||
"description": "Options for the `copyright` plugin.",
|
|
||||||
"anyOf": [
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/CopyrightOptions"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "null"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"dummy-variable-rgx": {
|
"dummy-variable-rgx": {
|
||||||
"description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.",
|
"description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.",
|
||||||
"type": [
|
"type": [
|
||||||
|
@ -209,6 +198,17 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"flake8-copyright": {
|
||||||
|
"description": "Options for the `copyright` plugin.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/Flake8CopyrightOptions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"flake8-errmsg": {
|
"flake8-errmsg": {
|
||||||
"description": "Options for the `flake8-errmsg` plugin.",
|
"description": "Options for the `flake8-errmsg` plugin.",
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
@ -631,35 +631,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"CopyrightOptions": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"author": {
|
|
||||||
"description": "Author to enforce within the copyright notice. If provided, the author must be present immediately following the copyright notice.",
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"min-file-size": {
|
|
||||||
"description": "A minimum file size (in bytes) required for a copyright notice to be enforced. By default, all files are validated.",
|
|
||||||
"type": [
|
|
||||||
"integer",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "uint",
|
|
||||||
"minimum": 0.0
|
|
||||||
},
|
|
||||||
"notice-rgx": {
|
|
||||||
"description": "The regular expression used to match the copyright notice, compiled with the [`regex`](https://docs.rs/regex/latest/regex/) crate.\n\nDefaults to `(?i)Copyright\\s+(\\(C\\)\\s+)?\\d{4}(-\\d{4})*`, which matches the following: - `Copyright 2023` - `Copyright (C) 2023` - `Copyright 2021-2023` - `Copyright (C) 2021-2023`",
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"Flake8AnnotationsOptions": {
|
"Flake8AnnotationsOptions": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -779,6 +750,35 @@
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
"Flake8CopyrightOptions": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"author": {
|
||||||
|
"description": "Author to enforce within the copyright notice. If provided, the author must be present immediately following the copyright notice.",
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"min-file-size": {
|
||||||
|
"description": "A minimum file size (in bytes) required for a copyright notice to be enforced. By default, all files are validated.",
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"format": "uint",
|
||||||
|
"minimum": 0.0
|
||||||
|
},
|
||||||
|
"notice-rgx": {
|
||||||
|
"description": "The regular expression used to match the copyright notice, compiled with the [`regex`](https://docs.rs/regex/latest/regex/) crate.\n\nDefaults to `(?i)Copyright\\s+(\\(C\\)\\s+)?\\d{4}(-\\d{4})*`, which matches the following: - `Copyright 2023` - `Copyright (C) 2023` - `Copyright 2021-2023` - `Copyright (C) 2021-2023`",
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
"Flake8ErrMsgOptions": {
|
"Flake8ErrMsgOptions": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue