mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
refactor(clippy): allow clippy::too_many_lines
This commit is contained in:
parent
eaeb63072f
commit
db5417f9a9
41 changed files with 58 additions and 98 deletions
|
|
@ -53,8 +53,9 @@ rustflags = [
|
||||||
|
|
||||||
# This rule is too pedantic, I don't want to force this because naming things are hard.
|
# This rule is too pedantic, I don't want to force this because naming things are hard.
|
||||||
"-Aclippy::module_name_repetitions",
|
"-Aclippy::module_name_repetitions",
|
||||||
# Most usages are ignored in our codebase, so this is ignored.
|
# All triggers are mostly ignored in our codebase, so this is ignored globally.
|
||||||
"-Aclippy::struct_excessive_bools",
|
"-Aclippy::struct_excessive_bools",
|
||||||
|
"-Aclippy::too_many_lines",
|
||||||
|
|
||||||
# #[must_use] is creating too much noise for this codebase, it does not add much value execept nagging
|
# #[must_use] is creating too much noise for this codebase, it does not add much value execept nagging
|
||||||
# the programmer to add a #[must_use] after clippy has been run.
|
# the programmer to add a #[must_use] after clippy has been run.
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ impl<'a> AstKind<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetSpan for AstKind<'a> {
|
impl<'a> GetSpan for AstKind<'a> {
|
||||||
#[allow(clippy::match_same_arms, clippy::too_many_lines)]
|
#[allow(clippy::match_same_arms)]
|
||||||
fn span(&self) -> Span {
|
fn span(&self) -> Span {
|
||||||
match self {
|
match self {
|
||||||
Self::Program(x) => x.span,
|
Self::Program(x) => x.span,
|
||||||
|
|
@ -386,7 +386,7 @@ impl<'a> GetSpan for AstKind<'a> {
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
impl<'a> AstKind<'a> {
|
impl<'a> AstKind<'a> {
|
||||||
#[allow(clippy::match_same_arms, clippy::too_many_lines)]
|
#[allow(clippy::match_same_arms)]
|
||||||
/// Get the AST kind name with minimal details. Particularly useful for
|
/// Get the AST kind name with minimal details. Particularly useful for
|
||||||
/// when debugging an iteration over an AST.
|
/// when debugging an iteration over an AST.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,6 @@ fn full_array_method_name(array_method: &'static str) -> Atom {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,6 @@ impl Rule for GetterReturn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,6 @@ impl NoConstantBinaryExpression {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ impl Rule for NoConstantCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ impl Rule for NoDuplicateCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,6 @@ fn get_real_parent<'a, 'b>(node: &AstNode, ctx: &'a LintContext<'b>) -> Option<&
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,6 @@ impl NoLossOfPrecision {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,6 @@ fn has_error_handler<'a>(node: &AstNode<'a>, ctx: &LintContext<'a>) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ impl Rule for NoSetterReturn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ impl Rule for NoUselessCatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,6 @@ fn check_template(string: &str) -> Vec<usize> {
|
||||||
offsets
|
offsets
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,6 @@ fn is_target_callee<'a>(callee: &'a Expression<'a>) -> Option<&'static str> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,6 @@ const VALID_TYPES: Set<&'static str> = phf_set! {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,6 @@ fn convert_pattern(pattern: &str) -> String {
|
||||||
format!("(?ui)^{pattern}(\\.|$)")
|
format!("(?ui)^{pattern}(\\.|$)")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ fn check_parents<'a>(node: &AstNode<'a>, ctx: &LintContext<'a>, in_conditional:
|
||||||
check_parents(parent, ctx, in_conditional)
|
check_parents(parent, ctx, in_conditional)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,6 @@ fn is_jest_call(name: &Atom) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,6 @@ impl Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ impl Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ fn is_var_declarator_or_test_block<'a>(
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ impl Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,6 @@ fn test_1() {
|
||||||
Tester::new(ValidExpect::NAME, pass, fail).test_and_snapshot();
|
Tester::new(ValidExpect::NAME, pass, fail).test_and_snapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,6 @@ impl Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,6 @@ impl Rule for AdjacentOverloadSignatures {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,6 @@ pub fn find_ts_comment_directive(raw: &str, single_line: bool) -> Option<(&str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ impl Rule for BanTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ impl Rule for NoDuplicateEnumValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ mod tests {
|
||||||
Tester::new_without_config(NoExplicitAny::NAME, pass, fail).test();
|
Tester::new_without_config(NoExplicitAny::NAME, pass, fail).test();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
let pass = vec![
|
let pass = vec![
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ fn is_declaration(node: &AstNode, ctx: &LintContext) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,6 @@ fn report_diagnostic(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ declare_oxc_lint!(
|
||||||
);
|
);
|
||||||
|
|
||||||
impl Rule for NoThenable {
|
impl Rule for NoThenable {
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||||
match node.kind() {
|
match node.kind() {
|
||||||
AstKind::ObjectExpression(expr) => {
|
AstKind::ObjectExpression(expr) => {
|
||||||
|
|
@ -281,7 +280,6 @@ fn contains_then(key: &PropertyKey, ctx: &LintContext) -> Option<Span> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ impl Rule for PreferArrayFlatMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test() {
|
fn test() {
|
||||||
use crate::tester::Tester;
|
use crate::tester::Tester;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ impl Parse for AllLintRulesMeta {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cognitive_complexity, clippy::too_many_lines)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
pub fn declare_all_lint_rules(metadata: AllLintRulesMeta) -> TokenStream {
|
pub fn declare_all_lint_rules(metadata: AllLintRulesMeta) -> TokenStream {
|
||||||
let AllLintRulesMeta { rules } = metadata;
|
let AllLintRulesMeta { rules } = metadata;
|
||||||
// all the top-level module trees
|
// all the top-level module trees
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,6 @@ impl<'a> Compressor<'a> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn try_fold_unary_operator(
|
fn try_fold_unary_operator(
|
||||||
&mut self,
|
&mut self,
|
||||||
unary_expr: &UnaryExpression<'a>,
|
unary_expr: &UnaryExpression<'a>,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(clippy::too_many_lines)]
|
|
||||||
|
|
||||||
mod closure;
|
mod closure;
|
||||||
mod esbuild;
|
mod esbuild;
|
||||||
mod oxc;
|
mod oxc;
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ impl<'a> Parser<'a> {
|
||||||
Ok(self.ast.class_body(self.end_span(span), body))
|
Ok(self.ast.class_body(self.end_span(span), body))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
pub(crate) fn parse_class_element(&mut self) -> Result<ClassElement<'a>> {
|
pub(crate) fn parse_class_element(&mut self) -> Result<ClassElement<'a>> {
|
||||||
let span = self.start_span();
|
let span = self.start_span();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -478,7 +478,6 @@ impl Kind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
pub fn to_str(self) -> &'static str {
|
pub fn to_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Undetermined => "Unknown",
|
Undetermined => "Unknown",
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ impl<'a, 'b: 'a> trustfall::provider::Adapter<'a> for &'a Adapter<'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn resolve_property(
|
fn resolve_property(
|
||||||
&self,
|
&self,
|
||||||
contexts: ContextIterator<'a, Self::Vertex>,
|
contexts: ContextIterator<'a, Self::Vertex>,
|
||||||
|
|
@ -301,7 +300,6 @@ impl<'a, 'b: 'a> trustfall::provider::Adapter<'a> for &'a Adapter<'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn resolve_neighbors(
|
fn resolve_neighbors(
|
||||||
&self,
|
&self,
|
||||||
contexts: ContextIterator<'a, Self::Vertex>,
|
contexts: ContextIterator<'a, Self::Vertex>,
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,6 @@ impl Typename for Vertex<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
impl<'a> From<AstNode<'a>> for Vertex<'a> {
|
impl<'a> From<AstNode<'a>> for Vertex<'a> {
|
||||||
fn from(ast_node: AstNode<'a>) -> Self {
|
fn from(ast_node: AstNode<'a>) -> Self {
|
||||||
match ast_node.kind() {
|
match ast_node.kind() {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ fn imports_field(value: serde_json::Value) -> MatchObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn test_cases() {
|
fn test_cases() {
|
||||||
let test_cases = [
|
let test_cases = [
|
||||||
TestCase {
|
TestCase {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue