mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
Rename ruff
crate to ruff_linter
(#7529)
This commit is contained in:
parent
dcbd8eacd8
commit
5849a75223
4397 changed files with 93921 additions and 93915 deletions
|
@ -17,18 +17,22 @@ use crate::options::{
|
|||
use anyhow::{anyhow, Result};
|
||||
use glob::{glob, GlobError, Paths, PatternError};
|
||||
use regex::Regex;
|
||||
use ruff::line_width::{LineLength, TabSize};
|
||||
use ruff::registry::RuleNamespace;
|
||||
use ruff::registry::{Rule, RuleSet, INCOMPATIBLE_CODES};
|
||||
use ruff::rule_selector::Specificity;
|
||||
use ruff::settings::rule_table::RuleTable;
|
||||
use ruff::settings::types::{
|
||||
use ruff_cache::cache_dir;
|
||||
use ruff_linter::line_width::{LineLength, TabSize};
|
||||
use ruff_linter::registry::RuleNamespace;
|
||||
use ruff_linter::registry::{Rule, RuleSet, INCOMPATIBLE_CODES};
|
||||
use ruff_linter::rule_selector::Specificity;
|
||||
use ruff_linter::settings::rule_table::RuleTable;
|
||||
use ruff_linter::settings::types::{
|
||||
FilePattern, FilePatternSet, PerFileIgnore, PreviewMode, PythonVersion, SerializationFormat,
|
||||
Version,
|
||||
};
|
||||
use ruff::settings::{defaults, resolve_per_file_ignores, AllSettings, CliSettings, Settings};
|
||||
use ruff::{fs, warn_user, warn_user_once, warn_user_once_by_id, RuleSelector, RUFF_PKG_VERSION};
|
||||
use ruff_cache::cache_dir;
|
||||
use ruff_linter::settings::{
|
||||
defaults, resolve_per_file_ignores, AllSettings, CliSettings, Settings,
|
||||
};
|
||||
use ruff_linter::{
|
||||
fs, warn_user, warn_user_once, warn_user_once_by_id, RuleSelector, RUFF_PKG_VERSION,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use shellexpand;
|
||||
use shellexpand::LookupError;
|
||||
|
@ -802,10 +806,10 @@ pub fn resolve_src(src: &[String], project_root: &Path) -> Result<Vec<PathBuf>>
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::configuration::{Configuration, RuleSelection};
|
||||
use ruff::codes::{Flake8Copyright, Pycodestyle, Refurb};
|
||||
use ruff::registry::{Linter, Rule, RuleSet};
|
||||
use ruff::settings::types::PreviewMode;
|
||||
use ruff::RuleSelector;
|
||||
use ruff_linter::codes::{Flake8Copyright, Pycodestyle, Refurb};
|
||||
use ruff_linter::registry::{Linter, Rule, RuleSet};
|
||||
use ruff_linter::settings::types::PreviewMode;
|
||||
use ruff_linter::RuleSelector;
|
||||
|
||||
const NURSERY_RULES: &[Rule] = &[
|
||||
Rule::MissingCopyrightNotice,
|
||||
|
|
|
@ -10,6 +10,6 @@ mod tests {
|
|||
use std::path::Path;
|
||||
|
||||
pub(crate) fn test_resource_path(path: impl AsRef<Path>) -> std::path::PathBuf {
|
||||
Path::new("../ruff/resources/test/").join(path)
|
||||
Path::new("../ruff_linter/resources/test/").join(path)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
use regex::Regex;
|
||||
use ruff::line_width::{LineLength, TabSize};
|
||||
use ruff::rules::flake8_pytest_style::settings::SettingsError;
|
||||
use ruff::rules::flake8_pytest_style::types;
|
||||
use ruff::rules::flake8_quotes::settings::Quote;
|
||||
use ruff::rules::flake8_tidy_imports::settings::{ApiBan, Strictness};
|
||||
use ruff::rules::isort::settings::RelativeImportsOrder;
|
||||
use ruff::rules::isort::{ImportSection, ImportType};
|
||||
use ruff::rules::pydocstyle::settings::Convention;
|
||||
use ruff::rules::pylint::settings::ConstantType;
|
||||
use ruff::rules::{
|
||||
use ruff_linter::line_width::{LineLength, TabSize};
|
||||
use ruff_linter::rules::flake8_pytest_style::settings::SettingsError;
|
||||
use ruff_linter::rules::flake8_pytest_style::types;
|
||||
use ruff_linter::rules::flake8_quotes::settings::Quote;
|
||||
use ruff_linter::rules::flake8_tidy_imports::settings::{ApiBan, Strictness};
|
||||
use ruff_linter::rules::isort::settings::RelativeImportsOrder;
|
||||
use ruff_linter::rules::isort::{ImportSection, ImportType};
|
||||
use ruff_linter::rules::pydocstyle::settings::Convention;
|
||||
use ruff_linter::rules::pylint::settings::ConstantType;
|
||||
use ruff_linter::rules::{
|
||||
flake8_copyright, flake8_errmsg, flake8_gettext, flake8_implicit_str_concat,
|
||||
flake8_import_conventions, flake8_pytest_style, flake8_quotes, flake8_self,
|
||||
flake8_tidy_imports, flake8_type_checking, flake8_unused_arguments, isort, mccabe, pep8_naming,
|
||||
pycodestyle, pydocstyle, pyflakes, pylint, pyupgrade,
|
||||
};
|
||||
use ruff::settings::types::{IdentifierPattern, PythonVersion, SerializationFormat, Version};
|
||||
use ruff::{warn_user_once, RuleSelector};
|
||||
use ruff_linter::settings::types::{
|
||||
IdentifierPattern, PythonVersion, SerializationFormat, Version,
|
||||
};
|
||||
use ruff_linter::{warn_user_once, RuleSelector};
|
||||
use ruff_macros::{CombineOptions, ConfigurationOptions};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -683,8 +685,8 @@ pub struct Flake8AnnotationsOptions {
|
|||
}
|
||||
|
||||
impl Flake8AnnotationsOptions {
|
||||
pub fn into_settings(self) -> ruff::rules::flake8_annotations::settings::Settings {
|
||||
ruff::rules::flake8_annotations::settings::Settings {
|
||||
pub fn into_settings(self) -> ruff_linter::rules::flake8_annotations::settings::Settings {
|
||||
ruff_linter::rules::flake8_annotations::settings::Settings {
|
||||
mypy_init_return: self.mypy_init_return.unwrap_or(false),
|
||||
suppress_dummy_args: self.suppress_dummy_args.unwrap_or(false),
|
||||
suppress_none_returning: self.suppress_none_returning.unwrap_or(false),
|
||||
|
@ -727,11 +729,11 @@ pub struct Flake8BanditOptions {
|
|||
}
|
||||
|
||||
impl Flake8BanditOptions {
|
||||
pub fn into_settings(self) -> ruff::rules::flake8_bandit::settings::Settings {
|
||||
ruff::rules::flake8_bandit::settings::Settings {
|
||||
pub fn into_settings(self) -> ruff_linter::rules::flake8_bandit::settings::Settings {
|
||||
ruff_linter::rules::flake8_bandit::settings::Settings {
|
||||
hardcoded_tmp_directory: self
|
||||
.hardcoded_tmp_directory
|
||||
.unwrap_or_else(ruff::rules::flake8_bandit::settings::default_tmp_dirs)
|
||||
.unwrap_or_else(ruff_linter::rules::flake8_bandit::settings::default_tmp_dirs)
|
||||
.into_iter()
|
||||
.chain(self.hardcoded_tmp_directory_extend.unwrap_or_default())
|
||||
.collect(),
|
||||
|
@ -764,8 +766,8 @@ pub struct Flake8BugbearOptions {
|
|||
}
|
||||
|
||||
impl Flake8BugbearOptions {
|
||||
pub fn into_settings(self) -> ruff::rules::flake8_bugbear::settings::Settings {
|
||||
ruff::rules::flake8_bugbear::settings::Settings {
|
||||
pub fn into_settings(self) -> ruff_linter::rules::flake8_bugbear::settings::Settings {
|
||||
ruff_linter::rules::flake8_bugbear::settings::Settings {
|
||||
extend_immutable_calls: self.extend_immutable_calls.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
@ -786,8 +788,8 @@ pub struct Flake8BuiltinsOptions {
|
|||
}
|
||||
|
||||
impl Flake8BuiltinsOptions {
|
||||
pub fn into_settings(self) -> ruff::rules::flake8_builtins::settings::Settings {
|
||||
ruff::rules::flake8_builtins::settings::Settings {
|
||||
pub fn into_settings(self) -> ruff_linter::rules::flake8_builtins::settings::Settings {
|
||||
ruff_linter::rules::flake8_builtins::settings::Settings {
|
||||
builtins_ignorelist: self.builtins_ignorelist.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
@ -808,8 +810,8 @@ pub struct Flake8ComprehensionsOptions {
|
|||
}
|
||||
|
||||
impl Flake8ComprehensionsOptions {
|
||||
pub fn into_settings(self) -> ruff::rules::flake8_comprehensions::settings::Settings {
|
||||
ruff::rules::flake8_comprehensions::settings::Settings {
|
||||
pub fn into_settings(self) -> ruff_linter::rules::flake8_comprehensions::settings::Settings {
|
||||
ruff_linter::rules::flake8_comprehensions::settings::Settings {
|
||||
allow_dict_calls_with_keyword_arguments: self
|
||||
.allow_dict_calls_with_keyword_arguments
|
||||
.unwrap_or_default(),
|
||||
|
@ -2241,7 +2243,7 @@ impl PyUpgradeOptions {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::options::Flake8SelfOptions;
|
||||
use ruff::rules::flake8_self;
|
||||
use ruff_linter::rules::flake8_self;
|
||||
|
||||
#[test]
|
||||
fn flake8_self_options() {
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::options::Options;
|
||||
use anyhow::Result;
|
||||
use log::debug;
|
||||
use pep440_rs::VersionSpecifiers;
|
||||
use ruff::settings::types::PythonVersion;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use ruff_linter::settings::types::PythonVersion;
|
||||
|
||||
use crate::options::Options;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
struct Tools {
|
||||
ruff: Option<Options>,
|
||||
|
@ -152,14 +154,16 @@ pub fn load_options<P: AsRef<Path>>(path: P) -> Result<Options> {
|
|||
mod tests {
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_linter::codes;
|
||||
use ruff_linter::line_width::LineLength;
|
||||
use ruff_linter::settings::types::PatternPrefixPair;
|
||||
|
||||
use crate::options::Options;
|
||||
use crate::pyproject::{find_settings_toml, parse_pyproject_toml, Pyproject, Tools};
|
||||
use crate::tests::test_resource_path;
|
||||
use anyhow::Result;
|
||||
use ruff::codes;
|
||||
use ruff::line_width::LineLength;
|
||||
use ruff::settings::types::PatternPrefixPair;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
@ -13,12 +13,13 @@ use log::debug;
|
|||
use path_absolutize::path_dedot;
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use ruff_linter::fs;
|
||||
use ruff_linter::packaging::is_package;
|
||||
use ruff_linter::settings::{AllSettings, Settings};
|
||||
|
||||
use crate::configuration::Configuration;
|
||||
use crate::pyproject;
|
||||
use crate::pyproject::settings_toml;
|
||||
use ruff::fs;
|
||||
use ruff::packaging::is_package;
|
||||
use ruff::settings::{AllSettings, Settings};
|
||||
|
||||
/// The configuration information from a `pyproject.toml` file.
|
||||
pub struct PyprojectConfig {
|
||||
|
@ -503,11 +504,11 @@ mod tests {
|
|||
use path_absolutize::Absolutize;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use ruff_linter::settings::types::FilePattern;
|
||||
use ruff_linter::settings::AllSettings;
|
||||
|
||||
use crate::configuration::Configuration;
|
||||
use crate::pyproject::find_settings_toml;
|
||||
use ruff::settings::types::FilePattern;
|
||||
use ruff::settings::AllSettings;
|
||||
|
||||
use crate::resolver::{
|
||||
is_file_excluded, match_exclusion, python_files_in_path, resolve_settings_with_processor,
|
||||
ConfigProcessor, PyprojectConfig, PyprojectDiscoveryStrategy, Relativity, Resolver,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue