mirror of https://github.com/astral-sh/ruff
Enable `pycodestyle` rules (#3689)
This commit is contained in:
parent
ddf7de7e86
commit
39fa38cb35
|
|
@ -81,6 +81,5 @@ colored = { workspace = true, features = ["no-color"] }
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
schemars = ["dep:schemars"]
|
schemars = ["dep:schemars"]
|
||||||
logical_lines = []
|
|
||||||
jupyter_notebook = []
|
jupyter_notebook = []
|
||||||
ecosystem_ci = []
|
ecosystem_ci = []
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,11 @@ pub(crate) fn check_logical_lines(
|
||||||
) -> Vec<Diagnostic> {
|
) -> Vec<Diagnostic> {
|
||||||
let mut context = LogicalLinesContext::new(settings);
|
let mut context = LogicalLinesContext::new(settings);
|
||||||
|
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
let should_fix_missing_whitespace = settings.rules.should_fix(Rule::MissingWhitespace);
|
let should_fix_missing_whitespace = settings.rules.should_fix(Rule::MissingWhitespace);
|
||||||
|
|
||||||
#[cfg(not(feature = "logical_lines"))]
|
|
||||||
let should_fix_missing_whitespace = false;
|
|
||||||
|
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
let should_fix_whitespace_before_parameters =
|
let should_fix_whitespace_before_parameters =
|
||||||
settings.rules.should_fix(Rule::WhitespaceBeforeParameters);
|
settings.rules.should_fix(Rule::WhitespaceBeforeParameters);
|
||||||
|
|
||||||
#[cfg(not(feature = "logical_lines"))]
|
|
||||||
let should_fix_whitespace_before_parameters = false;
|
|
||||||
|
|
||||||
let mut prev_line = None;
|
let mut prev_line = None;
|
||||||
let mut prev_indent_level = None;
|
let mut prev_indent_level = None;
|
||||||
let indent_char = stylist.indentation().as_char();
|
let indent_char = stylist.indentation().as_char();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
pub(crate) mod ast;
|
pub(crate) mod ast;
|
||||||
pub(crate) mod filesystem;
|
pub(crate) mod filesystem;
|
||||||
pub(crate) mod imports;
|
pub(crate) mod imports;
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
pub(crate) mod logical_lines;
|
pub(crate) mod logical_lines;
|
||||||
pub(crate) mod noqa;
|
pub(crate) mod noqa;
|
||||||
pub(crate) mod physical_lines;
|
pub(crate) mod physical_lines;
|
||||||
|
|
|
||||||
|
|
@ -34,67 +34,36 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<Rule> {
|
||||||
Some(match (linter, code) {
|
Some(match (linter, code) {
|
||||||
// pycodestyle errors
|
// pycodestyle errors
|
||||||
(Pycodestyle, "E101") => Rule::MixedSpacesAndTabs,
|
(Pycodestyle, "E101") => Rule::MixedSpacesAndTabs,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E111") => Rule::IndentationWithInvalidMultiple,
|
(Pycodestyle, "E111") => Rule::IndentationWithInvalidMultiple,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E112") => Rule::NoIndentedBlock,
|
(Pycodestyle, "E112") => Rule::NoIndentedBlock,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E113") => Rule::UnexpectedIndentation,
|
(Pycodestyle, "E113") => Rule::UnexpectedIndentation,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E114") => Rule::IndentationWithInvalidMultipleComment,
|
(Pycodestyle, "E114") => Rule::IndentationWithInvalidMultipleComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E115") => Rule::NoIndentedBlockComment,
|
(Pycodestyle, "E115") => Rule::NoIndentedBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E116") => Rule::UnexpectedIndentationComment,
|
(Pycodestyle, "E116") => Rule::UnexpectedIndentationComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E117") => Rule::OverIndented,
|
(Pycodestyle, "E117") => Rule::OverIndented,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E201") => Rule::WhitespaceAfterOpenBracket,
|
(Pycodestyle, "E201") => Rule::WhitespaceAfterOpenBracket,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E202") => Rule::WhitespaceBeforeCloseBracket,
|
(Pycodestyle, "E202") => Rule::WhitespaceBeforeCloseBracket,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E203") => Rule::WhitespaceBeforePunctuation,
|
(Pycodestyle, "E203") => Rule::WhitespaceBeforePunctuation,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E211") => Rule::WhitespaceBeforeParameters,
|
(Pycodestyle, "E211") => Rule::WhitespaceBeforeParameters,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E221") => Rule::MultipleSpacesBeforeOperator,
|
(Pycodestyle, "E221") => Rule::MultipleSpacesBeforeOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E222") => Rule::MultipleSpacesAfterOperator,
|
(Pycodestyle, "E222") => Rule::MultipleSpacesAfterOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E223") => Rule::TabBeforeOperator,
|
(Pycodestyle, "E223") => Rule::TabBeforeOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E224") => Rule::TabAfterOperator,
|
(Pycodestyle, "E224") => Rule::TabAfterOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E225") => Rule::MissingWhitespaceAroundOperator,
|
(Pycodestyle, "E225") => Rule::MissingWhitespaceAroundOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E226") => Rule::MissingWhitespaceAroundArithmeticOperator,
|
(Pycodestyle, "E226") => Rule::MissingWhitespaceAroundArithmeticOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E227") => Rule::MissingWhitespaceAroundBitwiseOrShiftOperator,
|
(Pycodestyle, "E227") => Rule::MissingWhitespaceAroundBitwiseOrShiftOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E228") => Rule::MissingWhitespaceAroundModuloOperator,
|
(Pycodestyle, "E228") => Rule::MissingWhitespaceAroundModuloOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E231") => Rule::MissingWhitespace,
|
(Pycodestyle, "E231") => Rule::MissingWhitespace,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E251") => Rule::UnexpectedSpacesAroundKeywordParameterEquals,
|
(Pycodestyle, "E251") => Rule::UnexpectedSpacesAroundKeywordParameterEquals,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E252") => Rule::MissingWhitespaceAroundParameterEquals,
|
(Pycodestyle, "E252") => Rule::MissingWhitespaceAroundParameterEquals,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E261") => Rule::TooFewSpacesBeforeInlineComment,
|
(Pycodestyle, "E261") => Rule::TooFewSpacesBeforeInlineComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E262") => Rule::NoSpaceAfterInlineComment,
|
(Pycodestyle, "E262") => Rule::NoSpaceAfterInlineComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E265") => Rule::NoSpaceAfterBlockComment,
|
(Pycodestyle, "E265") => Rule::NoSpaceAfterBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E266") => Rule::MultipleLeadingHashesForBlockComment,
|
(Pycodestyle, "E266") => Rule::MultipleLeadingHashesForBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E271") => Rule::MultipleSpacesAfterKeyword,
|
(Pycodestyle, "E271") => Rule::MultipleSpacesAfterKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E272") => Rule::MultipleSpacesBeforeKeyword,
|
(Pycodestyle, "E272") => Rule::MultipleSpacesBeforeKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E273") => Rule::TabAfterKeyword,
|
(Pycodestyle, "E273") => Rule::TabAfterKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E274") => Rule::TabBeforeKeyword,
|
(Pycodestyle, "E274") => Rule::TabBeforeKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
(Pycodestyle, "E275") => Rule::MissingWhitespaceAfterKeyword,
|
(Pycodestyle, "E275") => Rule::MissingWhitespaceAfterKeyword,
|
||||||
(Pycodestyle, "E401") => Rule::MultipleImportsOnOneLine,
|
(Pycodestyle, "E401") => Rule::MultipleImportsOnOneLine,
|
||||||
(Pycodestyle, "E402") => Rule::ModuleImportNotAtTopOfFile,
|
(Pycodestyle, "E402") => Rule::ModuleImportNotAtTopOfFile,
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ pub fn check_path(
|
||||||
.iter_enabled()
|
.iter_enabled()
|
||||||
.any(|rule_code| rule_code.lint_source().is_logical_lines())
|
.any(|rule_code| rule_code.lint_source().is_logical_lines())
|
||||||
{
|
{
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
diagnostics.extend(crate::checkers::logical_lines::check_logical_lines(
|
diagnostics.extend(crate::checkers::logical_lines::check_logical_lines(
|
||||||
&tokens, locator, stylist, settings,
|
&tokens, locator, stylist, settings,
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -14,67 +14,36 @@ pub use rule_set::{RuleSet, RuleSetIterator};
|
||||||
ruff_macros::register_rules!(
|
ruff_macros::register_rules!(
|
||||||
// pycodestyle errors
|
// pycodestyle errors
|
||||||
rules::pycodestyle::rules::MixedSpacesAndTabs,
|
rules::pycodestyle::rules::MixedSpacesAndTabs,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::IndentationWithInvalidMultiple,
|
rules::pycodestyle::rules::logical_lines::IndentationWithInvalidMultiple,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::NoIndentedBlock,
|
rules::pycodestyle::rules::logical_lines::NoIndentedBlock,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::UnexpectedIndentation,
|
rules::pycodestyle::rules::logical_lines::UnexpectedIndentation,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::IndentationWithInvalidMultipleComment,
|
rules::pycodestyle::rules::logical_lines::IndentationWithInvalidMultipleComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::NoIndentedBlockComment,
|
rules::pycodestyle::rules::logical_lines::NoIndentedBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::UnexpectedIndentationComment,
|
rules::pycodestyle::rules::logical_lines::UnexpectedIndentationComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::OverIndented,
|
rules::pycodestyle::rules::logical_lines::OverIndented,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::WhitespaceAfterOpenBracket,
|
rules::pycodestyle::rules::logical_lines::WhitespaceAfterOpenBracket,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::WhitespaceBeforeCloseBracket,
|
rules::pycodestyle::rules::logical_lines::WhitespaceBeforeCloseBracket,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::WhitespaceBeforePunctuation,
|
rules::pycodestyle::rules::logical_lines::WhitespaceBeforePunctuation,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MultipleSpacesBeforeOperator,
|
rules::pycodestyle::rules::logical_lines::MultipleSpacesBeforeOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MultipleSpacesAfterOperator,
|
rules::pycodestyle::rules::logical_lines::MultipleSpacesAfterOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::TabBeforeOperator,
|
rules::pycodestyle::rules::logical_lines::TabBeforeOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::TabAfterOperator,
|
rules::pycodestyle::rules::logical_lines::TabAfterOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::TooFewSpacesBeforeInlineComment,
|
rules::pycodestyle::rules::logical_lines::TooFewSpacesBeforeInlineComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::NoSpaceAfterInlineComment,
|
rules::pycodestyle::rules::logical_lines::NoSpaceAfterInlineComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::NoSpaceAfterBlockComment,
|
rules::pycodestyle::rules::logical_lines::NoSpaceAfterBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MultipleLeadingHashesForBlockComment,
|
rules::pycodestyle::rules::logical_lines::MultipleLeadingHashesForBlockComment,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MultipleSpacesAfterKeyword,
|
rules::pycodestyle::rules::logical_lines::MultipleSpacesAfterKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespace,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespace,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAfterKeyword,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAfterKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MultipleSpacesBeforeKeyword,
|
rules::pycodestyle::rules::logical_lines::MultipleSpacesBeforeKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundOperator,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundArithmeticOperator,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundArithmeticOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundBitwiseOrShiftOperator,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundBitwiseOrShiftOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundModuloOperator,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundModuloOperator,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::TabAfterKeyword,
|
rules::pycodestyle::rules::logical_lines::TabAfterKeyword,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::UnexpectedSpacesAroundKeywordParameterEquals,
|
rules::pycodestyle::rules::logical_lines::UnexpectedSpacesAroundKeywordParameterEquals,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundParameterEquals,
|
rules::pycodestyle::rules::logical_lines::MissingWhitespaceAroundParameterEquals,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::WhitespaceBeforeParameters,
|
rules::pycodestyle::rules::logical_lines::WhitespaceBeforeParameters,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
rules::pycodestyle::rules::logical_lines::TabBeforeKeyword,
|
rules::pycodestyle::rules::logical_lines::TabBeforeKeyword,
|
||||||
rules::pycodestyle::rules::MultipleImportsOnOneLine,
|
rules::pycodestyle::rules::MultipleImportsOnOneLine,
|
||||||
rules::pycodestyle::rules::ModuleImportNotAtTopOfFile,
|
rules::pycodestyle::rules::ModuleImportNotAtTopOfFile,
|
||||||
|
|
@ -974,7 +943,6 @@ impl Rule {
|
||||||
Rule::IOError => LintSource::Io,
|
Rule::IOError => LintSource::Io,
|
||||||
Rule::UnsortedImports | Rule::MissingRequiredImport => LintSource::Imports,
|
Rule::UnsortedImports | Rule::MissingRequiredImport => LintSource::Imports,
|
||||||
Rule::ImplicitNamespacePackage | Rule::InvalidModuleName => LintSource::Filesystem,
|
Rule::ImplicitNamespacePackage | Rule::InvalidModuleName => LintSource::Filesystem,
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
Rule::IndentationWithInvalidMultiple
|
Rule::IndentationWithInvalidMultiple
|
||||||
| Rule::IndentationWithInvalidMultipleComment
|
| Rule::IndentationWithInvalidMultipleComment
|
||||||
| Rule::MissingWhitespace
|
| Rule::MissingWhitespace
|
||||||
|
|
|
||||||
|
|
@ -196,15 +196,16 @@ pub(crate) const fn prefix_to_selector(prefix: RuleCodePrefix) -> RuleSelector {
|
||||||
|
|
||||||
#[cfg(feature = "schemars")]
|
#[cfg(feature = "schemars")]
|
||||||
mod schema {
|
mod schema {
|
||||||
use crate::registry::RuleNamespace;
|
|
||||||
use crate::rule_selector::{Linter, Rule, RuleCodePrefix};
|
|
||||||
use crate::RuleSelector;
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use schemars::JsonSchema;
|
||||||
use schemars::_serde_json::Value;
|
use schemars::_serde_json::Value;
|
||||||
use schemars::schema::{InstanceType, Schema, SchemaObject};
|
use schemars::schema::{InstanceType, Schema, SchemaObject};
|
||||||
use schemars::JsonSchema;
|
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
|
use crate::registry::RuleNamespace;
|
||||||
|
use crate::rule_selector::{Linter, RuleCodePrefix};
|
||||||
|
use crate::RuleSelector;
|
||||||
|
|
||||||
impl JsonSchema for RuleSelector {
|
impl JsonSchema for RuleSelector {
|
||||||
fn schema_name() -> String {
|
fn schema_name() -> String {
|
||||||
"RuleSelector".to_string()
|
"RuleSelector".to_string()
|
||||||
|
|
@ -228,20 +229,6 @@ mod schema {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(
|
||||||
RuleCodePrefix::iter()
|
RuleCodePrefix::iter()
|
||||||
.filter(|p| {
|
|
||||||
// Once logical lines are active by default, please remove this.
|
|
||||||
// This is here because generate-all output otherwise depends on
|
|
||||||
// the feature sets which makes the test running with
|
|
||||||
// `--all-features` fail
|
|
||||||
!Rule::from_code(&format!(
|
|
||||||
"{}{}",
|
|
||||||
p.linter().common_prefix(),
|
|
||||||
p.short_code()
|
|
||||||
))
|
|
||||||
.unwrap()
|
|
||||||
.lint_source()
|
|
||||||
.is_logical_lines()
|
|
||||||
})
|
|
||||||
.map(|p| {
|
.map(|p| {
|
||||||
let prefix = p.linter().common_prefix();
|
let prefix = p.linter().common_prefix();
|
||||||
let code = p.short_code();
|
let code = p.short_code();
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ mod tests {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
#[test_case(Rule::IndentationWithInvalidMultiple, Path::new("E11.py"))]
|
#[test_case(Rule::IndentationWithInvalidMultiple, Path::new("E11.py"))]
|
||||||
#[test_case(Rule::IndentationWithInvalidMultipleComment, Path::new("E11.py"))]
|
#[test_case(Rule::IndentationWithInvalidMultipleComment, Path::new("E11.py"))]
|
||||||
#[test_case(Rule::MultipleLeadingHashesForBlockComment, Path::new("E26.py"))]
|
#[test_case(Rule::MultipleLeadingHashesForBlockComment, Path::new("E26.py"))]
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ mod invalid_escape_sequence;
|
||||||
mod lambda_assignment;
|
mod lambda_assignment;
|
||||||
mod line_too_long;
|
mod line_too_long;
|
||||||
mod literal_comparisons;
|
mod literal_comparisons;
|
||||||
#[cfg(feature = "logical_lines")]
|
|
||||||
pub(crate) mod logical_lines;
|
pub(crate) mod logical_lines;
|
||||||
mod missing_newline_at_end_of_file;
|
mod missing_newline_at_end_of_file;
|
||||||
mod mixed_spaces_and_tabs;
|
mod mixed_spaces_and_tabs;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,3 @@ mimalloc = "0.1.34"
|
||||||
|
|
||||||
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dev-dependencies]
|
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dev-dependencies]
|
||||||
tikv-jemallocator = "0.5.0"
|
tikv-jemallocator = "0.5.0"
|
||||||
|
|
||||||
[features]
|
|
||||||
logical_lines = [ "ruff/logical_lines" ]
|
|
||||||
|
|
|
||||||
|
|
@ -1688,6 +1688,46 @@
|
||||||
"E1",
|
"E1",
|
||||||
"E10",
|
"E10",
|
||||||
"E101",
|
"E101",
|
||||||
|
"E11",
|
||||||
|
"E111",
|
||||||
|
"E112",
|
||||||
|
"E113",
|
||||||
|
"E114",
|
||||||
|
"E115",
|
||||||
|
"E116",
|
||||||
|
"E117",
|
||||||
|
"E2",
|
||||||
|
"E20",
|
||||||
|
"E201",
|
||||||
|
"E202",
|
||||||
|
"E203",
|
||||||
|
"E21",
|
||||||
|
"E211",
|
||||||
|
"E22",
|
||||||
|
"E221",
|
||||||
|
"E222",
|
||||||
|
"E223",
|
||||||
|
"E224",
|
||||||
|
"E225",
|
||||||
|
"E226",
|
||||||
|
"E227",
|
||||||
|
"E228",
|
||||||
|
"E23",
|
||||||
|
"E231",
|
||||||
|
"E25",
|
||||||
|
"E251",
|
||||||
|
"E252",
|
||||||
|
"E26",
|
||||||
|
"E261",
|
||||||
|
"E262",
|
||||||
|
"E265",
|
||||||
|
"E266",
|
||||||
|
"E27",
|
||||||
|
"E271",
|
||||||
|
"E272",
|
||||||
|
"E273",
|
||||||
|
"E274",
|
||||||
|
"E275",
|
||||||
"E4",
|
"E4",
|
||||||
"E40",
|
"E40",
|
||||||
"E401",
|
"E401",
|
||||||
|
|
|
||||||
|
|
@ -28,22 +28,44 @@ KNOWN_FORMATTING_VIOLATIONS = [
|
||||||
"bad-quotes-inline-string",
|
"bad-quotes-inline-string",
|
||||||
"bad-quotes-multiline-string",
|
"bad-quotes-multiline-string",
|
||||||
"explicit-string-concatenation",
|
"explicit-string-concatenation",
|
||||||
|
"indentation-with-invalid-multiple",
|
||||||
"line-too-long",
|
"line-too-long",
|
||||||
"missing-trailing-comma",
|
"missing-trailing-comma",
|
||||||
"multi-line-implicit-string-concatenation",
|
"multi-line-implicit-string-concatenation",
|
||||||
|
"multiple-leading-hashes-for-block-comment",
|
||||||
|
"multiple-spaces-after-keyword",
|
||||||
|
"multiple-spaces-after-operator",
|
||||||
|
"multiple-spaces-before-keyword",
|
||||||
|
"multiple-spaces-before-operator",
|
||||||
"multiple-statements-on-one-line-colon",
|
"multiple-statements-on-one-line-colon",
|
||||||
"multiple-statements-on-one-line-semicolon",
|
"multiple-statements-on-one-line-semicolon",
|
||||||
|
"no-indented-block-comment",
|
||||||
|
"no-space-after-block-comment",
|
||||||
|
"no-space-after-inline-comment",
|
||||||
|
"over-indented",
|
||||||
"prohibited-trailing-comma",
|
"prohibited-trailing-comma",
|
||||||
|
"too-few-spaces-before-inline-comment",
|
||||||
"trailing-comma-on-bare-tuple",
|
"trailing-comma-on-bare-tuple",
|
||||||
|
"unexpected-indentation-comment",
|
||||||
"useless-semicolon",
|
"useless-semicolon",
|
||||||
|
"whitespace-after-open-bracket",
|
||||||
|
"whitespace-before-close-bracket",
|
||||||
|
"whitespace-before-punctuation",
|
||||||
]
|
]
|
||||||
|
|
||||||
# For some docs, black is unable to parse the example code.
|
# For some docs, black is unable to parse the example code.
|
||||||
KNOWN_PARSE_ERRORS = [
|
KNOWN_PARSE_ERRORS = [
|
||||||
"blank-line-with-whitespace",
|
"blank-line-with-whitespace",
|
||||||
|
"indentation-with-invalid-multiple-comment",
|
||||||
"missing-newline-at-end-of-file",
|
"missing-newline-at-end-of-file",
|
||||||
"mixed-spaces-and-tabs",
|
"mixed-spaces-and-tabs",
|
||||||
|
"no-indented-block",
|
||||||
|
"tab-after-keyword",
|
||||||
|
"tab-after-operator",
|
||||||
|
"tab-before-keyword",
|
||||||
|
"tab-before-operator",
|
||||||
"trailing-whitespace",
|
"trailing-whitespace",
|
||||||
|
"unexpected-indentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ ignore = [
|
||||||
"G", # flake8-logging
|
"G", # flake8-logging
|
||||||
"T", # flake8-print
|
"T", # flake8-print
|
||||||
"FBT", # flake8-boolean-trap
|
"FBT", # flake8-boolean-trap
|
||||||
|
"E203",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.pydocstyle]
|
[tool.ruff.pydocstyle]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue