From 1711ecc603195967af2a6aba8fed12bff398b674 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 10 Jul 2022 14:27:24 +0200 Subject: [PATCH 1/2] feat: Add Stylelint --- SUPPORTED-FORMATS.md | 23 ++++++++++- .../analysis/registry/ParserRegistry.java | 1 + .../registry/StylelintDescriptor.java | 39 +++++++++++++++++++ .../hafner/analysis/registry/ParsersTest.java | 2 +- 4 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java diff --git a/SUPPORTED-FORMATS.md b/SUPPORTED-FORMATS.md index 4047d2175..0ae7f7827 100644 --- a/SUPPORTED-FORMATS.md +++ b/SUPPORTED-FORMATS.md @@ -1,4 +1,4 @@ - + # Supported Report Formats The static analysis model supports the following report formats. @@ -1821,6 +1821,27 @@ analyze - iccxxxxcompiler_opts cstat2.cFor details check the IAR C- - + + + stylelint + + + Stylelint + + + + Stylelint + + + + - + + + + + :bulb: Requires stylelint-checkstyle-reporter.
Use --custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml + + swiftlint diff --git a/src/main/java/edu/hm/hafner/analysis/registry/ParserRegistry.java b/src/main/java/edu/hm/hafner/analysis/registry/ParserRegistry.java index b9b0f4255..76e49bfd4 100644 --- a/src/main/java/edu/hm/hafner/analysis/registry/ParserRegistry.java +++ b/src/main/java/edu/hm/hafner/analysis/registry/ParserRegistry.java @@ -141,6 +141,7 @@ public class ParserRegistry { new SphinxBuildDescriptor(), new SpotBugsDescriptor(), new StyleCopDescriptor(), + new StylelintDescriptor(), new SunCDescriptor(), new SwiftLintDescriptor(), new TaglistDescriptor(), diff --git a/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java b/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java new file mode 100644 index 000000000..169d3f60d --- /dev/null +++ b/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java @@ -0,0 +1,39 @@ +package edu.hm.hafner.analysis.registry; + +import edu.hm.hafner.analysis.IssueParser; +import edu.hm.hafner.analysis.parser.checkstyle.CheckStyleParser; + +/** + * A descriptor for Stylelint. Delegates to {@link CheckStyleParser}. + * + * @author Alexander Brandes + */ +class StylelintDescriptor extends ParserDescriptor { + private static final String ID = "stylelint"; + private static final String NAME = "Stylelint"; + + StylelintDescriptor() { + super(ID, NAME); + } + + @Override + public IssueParser createParser(final Option... options) { + return new CheckStyleParser(); + } + + @Override + public String getHelp() { + return "Requires stylelint-checkstyle-reporter." + + "
Use --custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml"; + } + + @Override + public String getUrl() { + return "https://stylelint.io/"; + } + + @Override + public String getIconUrl() { + return "https://cdn.worldvectorlogo.com/logos/stylelint.svg"; + } +} diff --git a/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java b/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java index 143f9a0ea..584c7baf6 100644 --- a/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java +++ b/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java @@ -80,7 +80,7 @@ void shouldSilentlyIgnoreWrongFile() { @Test void shouldFindAllIssuesForCheckStyleAlias() { for (String tool : Arrays.asList("detekt", "eslint", "ktlint", "php-code-sniffer", - "swiftlint", "tslint")) { + "swiftlint", "stylelint", "tslint")) { findIssuesOfTool(4, tool, "checkstyle.xml"); } } From 0dede618d7a5230579bc9ffae04a8577cc6cfadd Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 10 Jul 2022 16:51:50 +0200 Subject: [PATCH 2/2] Update src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java Co-authored-by: Ullrich Hafner --- .../edu/hm/hafner/analysis/registry/StylelintDescriptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java b/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java index 169d3f60d..4b0f06ff3 100644 --- a/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java +++ b/src/main/java/edu/hm/hafner/analysis/registry/StylelintDescriptor.java @@ -24,7 +24,7 @@ public IssueParser createParser(final Option... options) { @Override public String getHelp() { return "Requires stylelint-checkstyle-reporter." - + "
Use --custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml"; + + "
Use --custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml"; } @Override