Skip to content

Commit

Permalink
feat(noSecrets): refine the entropy computation to avoid some false p…
Browse files Browse the repository at this point in the history
…ositives (#4118)

Co-authored-by: Victorien Elvinger <[email protected]>
  • Loading branch information
SaadBazaz and Conaclos authored Oct 7, 2024
1 parent 055b0db commit 731d00d
Show file tree
Hide file tree
Showing 8 changed files with 640 additions and 130 deletions.
8 changes: 7 additions & 1 deletion crates/biome_analyze/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub enum RuleSource {
EslintTypeScript(&'static str),
/// Rules from [Eslint Plugin Unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
EslintUnicorn(&'static str),
/// Rules from [Eslint Plugin Unused Imports](https://github.com/sweepline/eslint-plugin-unused-imports)
/// Rules from [Eslint Plugin Unused Imports](https://github.com/sweepline/eslint-plugin-unused-imports)
EslintUnusedImports(&'static str),
/// Rules from [Eslint Plugin Mysticatea](https://github.com/mysticatea/eslint-plugin)
EslintMysticatea(&'static str),
Expand All @@ -130,6 +130,8 @@ pub enum RuleSource {
EslintNext(&'static str),
/// Rules from [Stylelint](https://github.com/stylelint/stylelint)
Stylelint(&'static str),
/// Rules from [Eslint Plugin No Secrets](https://github.com/nickdeis/eslint-plugin-no-secrets)
EslintNoSecrets(&'static str),
}

impl PartialEq for RuleSource {
Expand Down Expand Up @@ -162,6 +164,7 @@ impl std::fmt::Display for RuleSource {
Self::EslintN(_) => write!(f, "eslint-plugin-n"),
Self::EslintNext(_) => write!(f, "@next/eslint-plugin-next"),
Self::Stylelint(_) => write!(f, "Stylelint"),
Self::EslintNoSecrets(_) => write!(f, "eslint-plugin-no-secrets"),
}
}
}
Expand Down Expand Up @@ -211,6 +214,7 @@ impl RuleSource {
| Self::EslintBarrelFiles(rule_name)
| Self::EslintN(rule_name)
| Self::EslintNext(rule_name)
| Self::EslintNoSecrets(rule_name)
| Self::Stylelint(rule_name) => rule_name,
}
}
Expand All @@ -237,6 +241,7 @@ impl RuleSource {
Self::EslintN(rule_name) => format!("n/{rule_name}"),
Self::EslintNext(rule_name) => format!("@next/{rule_name}"),
Self::Stylelint(rule_name) => format!("stylelint/{rule_name}"),
Self::EslintNoSecrets(rule_name) => format!("no-secrets/{rule_name}"),
}
}

Expand All @@ -263,6 +268,7 @@ impl RuleSource {
Self::EslintN(rule_name) => format!("https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/{rule_name}.md"),
Self::EslintNext(rule_name) => format!("https://nextjs.org/docs/messages/{rule_name}"),
Self::Stylelint(rule_name) => format!("https://github.com/stylelint/stylelint/blob/main/lib/rules/{rule_name}/README.md"),
Self::EslintNoSecrets(_) => "https://github.com/nickdeis/eslint-plugin-no-secrets/blob/master/README.md".to_string(),
}
}

Expand Down
Loading

0 comments on commit 731d00d

Please sign in to comment.