mirror of https://github.com/astral-sh/ruff
Allow flagging of multiline implicit string concatenations (#2117)
At present, `ISC001` and `ISC002` flag concatenations like the following: ```py "a" "b" # ISC001 "a" \ "b" # ISC002 ``` However, multiline concatenations are allowed. This PR adds a setting: ```toml [tool.ruff.flake8-implicit-str-concat] allow-multiline = false ``` Which extends `ISC002` to _also_ flag multiline concatenations, like: ```py ( "a" # ISC002 "b" ) ``` Note that this is backwards compatible, as `allow-multiline` defaults to `true`.
This commit is contained in:
parent
549a5d44bc
commit
cc63a4be6a
22
README.md
22
README.md
|
|
@ -2684,6 +2684,28 @@ max-string-length = 20
|
|||
|
||||
---
|
||||
|
||||
### `flake8-implicit-str-concat`
|
||||
|
||||
#### [`allow-multiline`](#allow-multiline)
|
||||
|
||||
Whether to allow implicit string concatenations for multiline strings.
|
||||
By default, implicit concatenations of multiline strings are
|
||||
allowed (but continuation lines, delimited with a backslash, are
|
||||
prohibited).
|
||||
|
||||
**Default value**: `true`
|
||||
|
||||
**Type**: `bool`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
```toml
|
||||
[tool.ruff.flake8-implicit-str-concat]
|
||||
allow-multiline = false
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `flake8-import-conventions`
|
||||
|
||||
#### [`aliases`](#aliases)
|
||||
|
|
|
|||
|
|
@ -175,6 +175,17 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"flake8-implicit-str-concat": {
|
||||
"description": "Options for the `flake8-implicit-str-concat` plugin.",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Flake8ImplicitStrConcatOptions"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"flake8-import-conventions": {
|
||||
"description": "Options for the `flake8-import-conventions` plugin.",
|
||||
"anyOf": [
|
||||
|
|
@ -626,6 +637,19 @@
|
|||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"Flake8ImplicitStrConcatOptions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow-multiline": {
|
||||
"description": "Whether to allow implicit string concatenations for multiline strings. By default, implicit concatenations of multiline strings are allowed (but continuation lines, delimited with a backslash, are prohibited).",
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"Flake8ImportConventionsOptions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,10 @@ pub fn check_tokens(
|
|||
// ISC001, ISC002
|
||||
if enforce_implicit_string_concatenation {
|
||||
diagnostics.extend(
|
||||
flake8_implicit_str_concat::rules::implicit(tokens)
|
||||
flake8_implicit_str_concat::rules::implicit(
|
||||
tokens,
|
||||
&settings.flake8_implicit_str_concat,
|
||||
)
|
||||
.into_iter()
|
||||
.filter(|diagnostic| settings.rules.enabled(diagnostic.kind.rule())),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -467,6 +467,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -531,6 +532,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -595,6 +597,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -659,6 +662,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -728,6 +732,7 @@ mod tests {
|
|||
avoid_escape: None,
|
||||
}),
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -800,6 +805,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -876,6 +882,7 @@ mod tests {
|
|||
avoid_escape: None,
|
||||
}),
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ use crate::linter::check_path;
|
|||
use crate::registry::Rule;
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_tidy_imports,
|
||||
flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle, pydocstyle, pylint,
|
||||
pyupgrade,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
flake8_tidy_imports, flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle,
|
||||
pydocstyle, pylint, pyupgrade,
|
||||
};
|
||||
use crate::rustpython_helpers::tokenize;
|
||||
use crate::settings::configuration::Configuration;
|
||||
|
|
@ -142,6 +142,9 @@ pub fn defaultSettings() -> Result<JsValue, JsValue> {
|
|||
flake8_pytest_style: Some(flake8_pytest_style::settings::Settings::default().into()),
|
||||
flake8_quotes: Some(flake8_quotes::settings::Settings::default().into()),
|
||||
flake8_tidy_imports: Some(flake8_tidy_imports::Settings::default().into()),
|
||||
flake8_implicit_str_concat: Some(
|
||||
flake8_implicit_str_concat::settings::Settings::default().into(),
|
||||
),
|
||||
flake8_import_conventions: Some(
|
||||
flake8_import_conventions::settings::Settings::default().into(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -656,9 +656,9 @@ impl Rule {
|
|||
| Rule::BadQuotesInlineString
|
||||
| Rule::BadQuotesMultilineString
|
||||
| Rule::CommentedOutCode
|
||||
| Rule::MultiLineImplicitStringConcatenation
|
||||
| Rule::ExtraneousParentheses
|
||||
| Rule::InvalidEscapeSequence
|
||||
| Rule::MultiLineImplicitStringConcatenation
|
||||
| Rule::SingleLineImplicitStringConcatenation
|
||||
| Rule::TrailingCommaMissing
|
||||
| Rule::TrailingCommaOnBareTupleProhibited
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
//! Rules from [flake8-implicit-str-concat](https://pypi.org/project/flake8-implicit-str-concat/).
|
||||
pub(crate) mod rules;
|
||||
pub mod settings;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
@ -26,4 +27,24 @@ mod tests {
|
|||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case(Rule::SingleLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC001")]
|
||||
#[test_case(Rule::MultiLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC002")]
|
||||
#[test_case(Rule::ExplicitStringConcatenation, Path::new("ISC.py"); "ISC003")]
|
||||
fn multiline(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
let snapshot = format!("multiline_{}_{}", rule_code.code(), path.to_string_lossy());
|
||||
let diagnostics = test_path(
|
||||
Path::new("./resources/test/fixtures/flake8_implicit_str_concat")
|
||||
.join(path)
|
||||
.as_path(),
|
||||
&settings::Settings {
|
||||
flake8_implicit_str_concat: super::settings::Settings {
|
||||
allow_multiline: false,
|
||||
},
|
||||
..settings::Settings::for_rule(rule_code)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,20 @@ use rustpython_parser::lexer::{LexResult, Tok};
|
|||
|
||||
use crate::ast::types::Range;
|
||||
use crate::registry::Diagnostic;
|
||||
use crate::rules::flake8_implicit_str_concat::settings::Settings;
|
||||
use crate::violations;
|
||||
|
||||
/// ISC001, ISC002
|
||||
pub fn implicit(tokens: &[LexResult]) -> Vec<Diagnostic> {
|
||||
pub fn implicit(tokens: &[LexResult], settings: &Settings) -> Vec<Diagnostic> {
|
||||
let mut diagnostics = vec![];
|
||||
for ((a_start, a_tok, a_end), (b_start, b_tok, b_end)) in
|
||||
tokens.iter().flatten().tuple_windows()
|
||||
for ((a_start, a_tok, a_end), (b_start, b_tok, b_end)) in tokens
|
||||
.iter()
|
||||
.flatten()
|
||||
.filter(|(_, tok, _)| {
|
||||
!matches!(tok, Tok::Comment(..))
|
||||
&& (settings.allow_multiline || !matches!(tok, Tok::NonLogicalNewline))
|
||||
})
|
||||
.tuple_windows()
|
||||
{
|
||||
if matches!(a_tok, Tok::String { .. }) && matches!(b_tok, Tok::String { .. }) {
|
||||
if a_end.row() == b_start.row() {
|
||||
|
|
@ -22,8 +29,6 @@ pub fn implicit(tokens: &[LexResult]) -> Vec<Diagnostic> {
|
|||
},
|
||||
));
|
||||
} else {
|
||||
// Not on the same line, and no NonLogicalNewline between a and b =>
|
||||
// concatantion over a continuation line.
|
||||
diagnostics.push(Diagnostic::new(
|
||||
violations::MultiLineImplicitStringConcatenation,
|
||||
Range {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
//! Settings for the `flake8-implicit-str-concat` plugin.
|
||||
|
||||
use ruff_macros::ConfigurationOptions;
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(
|
||||
Debug, PartialEq, Eq, Serialize, Deserialize, Default, ConfigurationOptions, JsonSchema,
|
||||
)]
|
||||
#[serde(
|
||||
deny_unknown_fields,
|
||||
rename_all = "kebab-case",
|
||||
rename = "Flake8ImplicitStrConcatOptions"
|
||||
)]
|
||||
pub struct Options {
|
||||
#[option(
|
||||
default = r#"true"#,
|
||||
value_type = "bool",
|
||||
example = r#"
|
||||
allow-multiline = false
|
||||
"#
|
||||
)]
|
||||
/// Whether to allow implicit string concatenations for multiline strings.
|
||||
/// By default, implicit concatenations of multiline strings are
|
||||
/// allowed (but continuation lines, delimited with a backslash, are
|
||||
/// prohibited).
|
||||
pub allow_multiline: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Hash)]
|
||||
pub struct Settings {
|
||||
pub allow_multiline: bool,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
allow_multiline: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Options> for Settings {
|
||||
fn from(options: Options) -> Self {
|
||||
Self {
|
||||
allow_multiline: options.allow_multiline.unwrap_or(true),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Settings> for Options {
|
||||
fn from(settings: Settings) -> Self {
|
||||
Self {
|
||||
allow_multiline: Some(settings.allow_multiline),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
source: src/rules/flake8_implicit_str_concat/mod.rs
|
||||
expression: diagnostics
|
||||
---
|
||||
- kind:
|
||||
SingleLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 1
|
||||
column: 4
|
||||
end_location:
|
||||
row: 1
|
||||
column: 11
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
SingleLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 1
|
||||
column: 8
|
||||
end_location:
|
||||
row: 1
|
||||
column: 15
|
||||
fix: ~
|
||||
parent: ~
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
source: src/rules/flake8_implicit_str_concat/mod.rs
|
||||
expression: diagnostics
|
||||
---
|
||||
- kind:
|
||||
MultiLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 5
|
||||
column: 4
|
||||
end_location:
|
||||
row: 6
|
||||
column: 9
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
MultiLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 24
|
||||
column: 2
|
||||
end_location:
|
||||
row: 25
|
||||
column: 7
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
MultiLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 29
|
||||
column: 2
|
||||
end_location:
|
||||
row: 30
|
||||
column: 7
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
MultiLineImplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 34
|
||||
column: 2
|
||||
end_location:
|
||||
row: 35
|
||||
column: 8
|
||||
fix: ~
|
||||
parent: ~
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
source: src/rules/flake8_implicit_str_concat/mod.rs
|
||||
expression: diagnostics
|
||||
---
|
||||
- kind:
|
||||
ExplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 3
|
||||
column: 4
|
||||
end_location:
|
||||
row: 3
|
||||
column: 17
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
ExplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 9
|
||||
column: 2
|
||||
end_location:
|
||||
row: 10
|
||||
column: 7
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
ExplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 14
|
||||
column: 2
|
||||
end_location:
|
||||
row: 15
|
||||
column: 7
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
ExplicitStringConcatenation: ~
|
||||
location:
|
||||
row: 19
|
||||
column: 2
|
||||
end_location:
|
||||
row: 20
|
||||
column: 8
|
||||
fix: ~
|
||||
parent: ~
|
||||
|
||||
|
|
@ -16,9 +16,9 @@ use crate::fs;
|
|||
use crate::registry::RuleSelector;
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_tidy_imports,
|
||||
flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle, pydocstyle, pylint,
|
||||
pyupgrade,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
flake8_tidy_imports, flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle,
|
||||
pydocstyle, pylint, pyupgrade,
|
||||
};
|
||||
use crate::settings::options::Options;
|
||||
use crate::settings::pyproject::load_options;
|
||||
|
|
@ -65,6 +65,7 @@ pub struct Configuration {
|
|||
pub flake8_bugbear: Option<flake8_bugbear::settings::Options>,
|
||||
pub flake8_builtins: Option<flake8_builtins::settings::Options>,
|
||||
pub flake8_errmsg: Option<flake8_errmsg::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_pytest_style: Option<flake8_pytest_style::settings::Options>,
|
||||
pub flake8_quotes: Option<flake8_quotes::settings::Options>,
|
||||
|
|
@ -172,6 +173,7 @@ impl Configuration {
|
|||
flake8_bugbear: options.flake8_bugbear,
|
||||
flake8_builtins: options.flake8_builtins,
|
||||
flake8_errmsg: options.flake8_errmsg,
|
||||
flake8_implicit_str_concat: options.flake8_implicit_str_concat,
|
||||
flake8_import_conventions: options.flake8_import_conventions,
|
||||
flake8_pytest_style: options.flake8_pytest_style,
|
||||
flake8_quotes: options.flake8_quotes,
|
||||
|
|
@ -240,6 +242,9 @@ impl Configuration {
|
|||
flake8_bugbear: self.flake8_bugbear.or(config.flake8_bugbear),
|
||||
flake8_builtins: self.flake8_builtins.or(config.flake8_builtins),
|
||||
flake8_errmsg: self.flake8_errmsg.or(config.flake8_errmsg),
|
||||
flake8_implicit_str_concat: self
|
||||
.flake8_implicit_str_concat
|
||||
.or(config.flake8_implicit_str_concat),
|
||||
flake8_import_conventions: self
|
||||
.flake8_import_conventions
|
||||
.or(config.flake8_import_conventions),
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ use super::Settings;
|
|||
use crate::registry::RuleSelector;
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_tidy_imports,
|
||||
flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle, pydocstyle, pylint,
|
||||
pyupgrade,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
flake8_tidy_imports, flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle,
|
||||
pydocstyle, pylint, pyupgrade,
|
||||
};
|
||||
|
||||
pub const PREFIXES: &[RuleSelector] = &[RuleSelector::E, RuleSelector::F];
|
||||
|
|
@ -76,6 +76,7 @@ impl Default for Settings {
|
|||
flake8_bugbear: flake8_bugbear::settings::Settings::default(),
|
||||
flake8_builtins: flake8_builtins::settings::Settings::default(),
|
||||
flake8_errmsg: flake8_errmsg::settings::Settings::default(),
|
||||
flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings::default(),
|
||||
flake8_import_conventions: flake8_import_conventions::settings::Settings::default(),
|
||||
flake8_pytest_style: flake8_pytest_style::settings::Settings::default(),
|
||||
flake8_quotes: flake8_quotes::settings::Settings::default(),
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ use crate::cache::cache_dir;
|
|||
use crate::registry::{Rule, RuleSelector, SuffixLength, CATEGORIES, INCOMPATIBLE_CODES};
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_tidy_imports,
|
||||
flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle, pydocstyle, pylint,
|
||||
pyupgrade,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
flake8_tidy_imports, flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle,
|
||||
pydocstyle, pylint, pyupgrade,
|
||||
};
|
||||
use crate::settings::configuration::Configuration;
|
||||
use crate::settings::types::{PerFileIgnore, PythonVersion, SerializationFormat, Version};
|
||||
|
|
@ -109,6 +109,7 @@ pub struct Settings {
|
|||
pub flake8_bugbear: flake8_bugbear::settings::Settings,
|
||||
pub flake8_builtins: flake8_builtins::settings::Settings,
|
||||
pub flake8_errmsg: flake8_errmsg::settings::Settings,
|
||||
pub flake8_implicit_str_concat: flake8_implicit_str_concat::settings::Settings,
|
||||
pub flake8_import_conventions: flake8_import_conventions::settings::Settings,
|
||||
pub flake8_pytest_style: flake8_pytest_style::settings::Settings,
|
||||
pub flake8_quotes: flake8_quotes::settings::Settings,
|
||||
|
|
@ -174,6 +175,10 @@ impl Settings {
|
|||
flake8_bugbear: config.flake8_bugbear.map(Into::into).unwrap_or_default(),
|
||||
flake8_builtins: config.flake8_builtins.map(Into::into).unwrap_or_default(),
|
||||
flake8_errmsg: config.flake8_errmsg.map(Into::into).unwrap_or_default(),
|
||||
flake8_implicit_str_concat: config
|
||||
.flake8_implicit_str_concat
|
||||
.map(Into::into)
|
||||
.unwrap_or_default(),
|
||||
flake8_import_conventions: config
|
||||
.flake8_import_conventions
|
||||
.map(Into::into)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::registry::RuleSelector;
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_tidy_imports,
|
||||
flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle, pydocstyle, pylint,
|
||||
pyupgrade,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
flake8_tidy_imports, flake8_unused_arguments, isort, mccabe, pep8_naming, pycodestyle,
|
||||
pydocstyle, pylint, pyupgrade,
|
||||
};
|
||||
use crate::settings::types::{PythonVersion, SerializationFormat, Version};
|
||||
|
||||
|
|
@ -440,6 +440,9 @@ pub struct Options {
|
|||
/// Options for the `flake8-tidy-imports` plugin.
|
||||
pub flake8_tidy_imports: Option<flake8_tidy_imports::options::Options>,
|
||||
#[option_group]
|
||||
/// Options for the `flake8-implicit-str-concat` plugin.
|
||||
pub flake8_implicit_str_concat: Option<flake8_implicit_str_concat::settings::Options>,
|
||||
#[option_group]
|
||||
/// Options for the `flake8-import-conventions` plugin.
|
||||
pub flake8_import_conventions: Option<flake8_import_conventions::settings::Options>,
|
||||
#[option_group]
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ mod tests {
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -264,6 +265,7 @@ line-length = 79
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -326,6 +328,7 @@ exclude = ["foo.py"]
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -388,6 +391,7 @@ select = ["E501"]
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -451,6 +455,7 @@ ignore = ["E501"]
|
|||
flake8_pytest_style: None,
|
||||
flake8_quotes: None,
|
||||
flake8_tidy_imports: None,
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_import_conventions: None,
|
||||
flake8_unused_arguments: None,
|
||||
isort: None,
|
||||
|
|
@ -582,6 +587,7 @@ other-attribute = 1
|
|||
]),
|
||||
mark_parentheses: Some(false),
|
||||
}),
|
||||
flake8_implicit_str_concat: None,
|
||||
flake8_quotes: Some(flake8_quotes::settings::Options {
|
||||
inline_quotes: Some(Quote::Single),
|
||||
multiline_quotes: Some(Quote::Double),
|
||||
|
|
|
|||
Loading…
Reference in New Issue