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

Ignore more rules for stub files #14541

Merged
merged 7 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ pub(crate) fn boolean_default_value_positional_argument(
decorator_list: &[Decorator],
parameters: &Parameters,
) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
// Allow Boolean defaults in explicitly-allowed functions.
if is_allowed_func_def(name) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ impl Violation for BooleanPositionalValueInCall {
}

pub(crate) fn boolean_positional_value_in_call(checker: &mut Checker, call: &ast::ExprCall) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
dylwil3 marked this conversation as resolved.
Show resolved Hide resolved
if allow_boolean_trap(call, checker) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ pub(crate) fn boolean_type_hint_positional_argument(
decorator_list: &[Decorator],
parameters: &Parameters,
) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
// Allow Boolean type hints in explicitly-allowed functions.
if is_allowed_func_def(name) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ pub(crate) fn no_slots_in_namedtuple_subclass(
stmt: &Stmt,
class: &StmtClassDef,
) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let Some(Arguments { args: bases, .. }) = class.arguments.as_deref() else {
return;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ impl Violation for NoSlotsInStrSubclass {

/// SLOT000
pub(crate) fn no_slots_in_str_subclass(checker: &mut Checker, stmt: &Stmt, class: &StmtClassDef) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let Some(Arguments { args: bases, .. }) = class.arguments.as_deref() else {
return;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl Violation for NoSlotsInTupleSubclass {

/// SLOT001
pub(crate) fn no_slots_in_tuple_subclass(checker: &mut Checker, stmt: &Stmt, class: &StmtClassDef) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let Some(Arguments { args: bases, .. }) = class.arguments.as_deref() else {
return;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ impl Violation for BadDunderMethodName {

/// PLW3201
pub(crate) fn bad_dunder_method_name(checker: &mut Checker, method: &ast::StmtFunctionDef) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
// If the name isn't a dunder, skip it.
if !method.name.starts_with('_') || !method.name.ends_with('_') {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ impl Violation for TooManyArguments {

/// PLR0913
pub(crate) fn too_many_arguments(checker: &mut Checker, function_def: &ast::StmtFunctionDef) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let semantic = checker.semantic();

let num_arguments = function_def
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ pub(crate) fn too_many_positional_arguments(
checker: &mut Checker,
function_def: &ast::StmtFunctionDef,
) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let semantic = checker.semantic();

// Count the number of positional arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ pub(crate) fn too_many_public_methods(
class_def: &ast::StmtClassDef,
max_methods: usize,
) {
// https://github.com/astral-sh/ruff/issues/14535
if checker.source_type.is_stub() {
return;
}
let methods = class_def
.body
.iter()
Expand Down
Loading