mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
Fix remaining Copyright rule references (#5577)
This commit is contained in:
parent
cd4718988a
commit
b11492e940
6 changed files with 11 additions and 11 deletions
|
@ -389,8 +389,8 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||||
(Flake8Simplify, "401") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::IfElseBlockInsteadOfDictGet),
|
(Flake8Simplify, "401") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::IfElseBlockInsteadOfDictGet),
|
||||||
(Flake8Simplify, "910") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
(Flake8Simplify, "910") => (RuleGroup::Unspecified, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
||||||
|
|
||||||
// copyright
|
// flake8-copyright
|
||||||
(Copyright, "001") => (RuleGroup::Nursery, rules::flake8_copyright::rules::MissingCopyrightNotice),
|
(Flake8Copyright, "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),
|
||||||
|
|
|
@ -82,9 +82,9 @@ pub enum Linter {
|
||||||
/// [flake8-commas](https://pypi.org/project/flake8-commas/)
|
/// [flake8-commas](https://pypi.org/project/flake8-commas/)
|
||||||
#[prefix = "COM"]
|
#[prefix = "COM"]
|
||||||
Flake8Commas,
|
Flake8Commas,
|
||||||
/// Copyright-related rules
|
/// [flake8-copyright](https://pypi.org/project/flake8-copyright/)
|
||||||
#[prefix = "CPY"]
|
#[prefix = "CPY"]
|
||||||
Copyright,
|
Flake8Copyright,
|
||||||
/// [flake8-comprehensions](https://pypi.org/project/flake8-comprehensions/)
|
/// [flake8-comprehensions](https://pypi.org/project/flake8-comprehensions/)
|
||||||
#[prefix = "C4"]
|
#[prefix = "C4"]
|
||||||
Flake8Comprehensions,
|
Flake8Comprehensions,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Rules related to copyright notices.
|
//! Rules from [flake8-copyright](https://pypi.org/project/flake8-copyright/).
|
||||||
pub(crate) mod rules;
|
pub(crate) mod rules;
|
||||||
|
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
|
|
|
@ -498,7 +498,7 @@ pub struct Options {
|
||||||
/// Options for the `flake8-comprehensions` plugin.
|
/// Options for the `flake8-comprehensions` plugin.
|
||||||
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 `flake8-copyright` plugin.
|
||||||
pub flake8_copyright: Option<flake8_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.
|
||||||
|
|
|
@ -21,9 +21,9 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenS
|
||||||
let mut parsed = Vec::new();
|
let mut parsed = Vec::new();
|
||||||
|
|
||||||
let mut common_prefix_match_arms = quote!();
|
let mut common_prefix_match_arms = quote!();
|
||||||
let mut name_match_arms = quote!(Self::Ruff => "Ruff-specific rules", Self::Numpy => "NumPy-specific rules", Self::Copyright => "Copyright-related rules", );
|
let mut name_match_arms =
|
||||||
let mut url_match_arms =
|
quote!(Self::Ruff => "Ruff-specific rules", Self::Numpy => "NumPy-specific rules", );
|
||||||
quote!(Self::Ruff => None, Self::Numpy => None, Self::Copyright => None, );
|
let mut url_match_arms = quote!(Self::Ruff => None, Self::Numpy => None, );
|
||||||
|
|
||||||
let mut all_prefixes = HashSet::new();
|
let mut all_prefixes = HashSet::new();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenS
|
||||||
|
|
||||||
let variant_ident = variant.ident;
|
let variant_ident = variant.ident;
|
||||||
|
|
||||||
if variant_ident != "Ruff" && variant_ident != "Numpy" && variant_ident != "Copyright" {
|
if variant_ident != "Ruff" && variant_ident != "Numpy" {
|
||||||
let (name, url) = parse_doc_attr(doc_attr)?;
|
let (name, url) = parse_doc_attr(doc_attr)?;
|
||||||
name_match_arms.extend(quote! {Self::#variant_ident => #name,});
|
name_match_arms.extend(quote! {Self::#variant_ident => #name,});
|
||||||
url_match_arms.extend(quote! {Self::#variant_ident => Some(#url),});
|
url_match_arms.extend(quote! {Self::#variant_ident => Some(#url),});
|
||||||
|
|
2
ruff.schema.json
generated
2
ruff.schema.json
generated
|
@ -199,7 +199,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"flake8-copyright": {
|
"flake8-copyright": {
|
||||||
"description": "Options for the `copyright` plugin.",
|
"description": "Options for the `flake8-copyright` plugin.",
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/Flake8CopyrightOptions"
|
"$ref": "#/definitions/Flake8CopyrightOptions"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue