Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use line-length setting for isort #8235

Merged
merged 1 commit into from Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -120,7 +120,7 @@ pub(crate) fn organize_imports(
block,
comments,
locator,
settings.pycodestyle.max_line_length,
settings.line_length,
LineWidthBuilder::new(settings.tab_size).add_str(indentation),
stylist,
&settings.src,
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff_linter/src/settings/mod.rs
Expand Up @@ -14,6 +14,7 @@ use rustc_hash::FxHashSet;
use crate::codes::RuleCodePrefix;
use ruff_macros::CacheKey;

use crate::line_width::LineLength;
use crate::registry::{Linter, Rule, RuleSet};
use crate::rules::{
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_comprehensions,
Expand Down Expand Up @@ -59,6 +60,7 @@ pub struct LinterSettings {
pub namespace_packages: Vec<PathBuf>,
pub src: Vec<PathBuf>,
pub tab_size: IndentWidth,
pub line_length: LineLength,
pub task_tags: Vec<String>,
pub typing_modules: Vec<String>,

Expand Down Expand Up @@ -155,6 +157,7 @@ impl LinterSettings {
src: vec![path_dedot::CWD.clone()],
// Needs duplicating
tab_size: IndentWidth::default(),
line_length: LineLength::default(),

task_tags: TASK_TAGS.iter().map(ToString::to_string).collect(),
typing_modules: vec![],
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_workspace/src/configuration.rs
Expand Up @@ -228,6 +228,7 @@ impl Configuration {
.unwrap_or_else(|| DUMMY_VARIABLE_RGX.clone()),
external: lint.external.unwrap_or_default(),
ignore_init_module_imports: lint.ignore_init_module_imports.unwrap_or_default(),
line_length,
tab_size: self.indent_width.unwrap_or_default(),
namespace_packages: self.namespace_packages.unwrap_or_default(),
per_file_ignores: resolve_per_file_ignores(
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_workspace/src/options.rs
Expand Up @@ -352,7 +352,7 @@ pub struct Options {

// Global Formatting options
/// The line length to use when enforcing long-lines violations (like `E501`)
/// and at which the formatter prefers to wrap lines.
/// and at which `isort` and the formatter prefers to wrap lines.
///
/// The length is determined by the number of characters per line, except for lines containing East Asian characters or emojis.
/// For these lines, the [unicode width](https://unicode.org/reports/tr11/) of each character is added up to determine the length.
Expand Down
2 changes: 1 addition & 1 deletion ruff.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.