Skip to content

Commit

Permalink
Merge pull request #812 from NotMyFault/feat/master/stylelint
Browse files Browse the repository at this point in the history
Add Stylelint as additional alias for the CheckStyle parser
  • Loading branch information
uhafner committed Jul 10, 2022
2 parents 2d42aa0 + 0dede61 commit d9daf37
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
23 changes: 22 additions & 1 deletion SUPPORTED-FORMATS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- DO NOT EDIT - Generated by ParserRegistry at 2022-07-09T00:22:29.097164-->
<!--- DO NOT EDIT - Generated by ParserRegistry at 2022-07-10T14:22:16.257664-->
# Supported Report Formats

The static analysis model supports the following report formats.
Expand Down Expand Up @@ -1821,6 +1821,27 @@ analyze - iccxxxxcompiler_opts cstat2.c</pre></code>For details check the IAR C-
-
</td>
</tr>
<tr>
<td>
stylelint
</td>
<td>
<img src="https://cdn.worldvectorlogo.com/logos/stylelint.svg" alt="Stylelint" height="64" width="64">
</td>
<td>
<a href="https://stylelint.io/">
Stylelint
</a>
</td>
<td>
-
</td>
</tr>
<tr>
<td colspan="4">
:bulb: Requires <a href='https://www.npmjs.com/package/stylelint-checkstyle-reporter'>stylelint-checkstyle-reporter</a>.<br/>Use --custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml
</td>
</tr>
<tr>
<td>
swiftlint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public class ParserRegistry {
new SphinxBuildDescriptor(),
new SpotBugsDescriptor(),
new StyleCopDescriptor(),
new StylelintDescriptor(),
new SunCDescriptor(),
new SwiftLintDescriptor(),
new TaglistDescriptor(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <a href='https://www.npmjs.com/package/stylelint-checkstyle-reporter'>stylelint-checkstyle-reporter</a>."
+ "<br/>Use <code>--custom-formatter node_modules/stylelint-checkstyle-reporter/index.js -o stylelint-warnings.xml</code>";
}

@Override
public String getUrl() {
return "https://stylelint.io/";
}

@Override
public String getIconUrl() {
return "https://cdn.worldvectorlogo.com/logos/stylelint.svg";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down

0 comments on commit d9daf37

Please sign in to comment.