forked from checkstyle/sonar-checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkstyle#191 - add SQ 7.6 compatibility
- Loading branch information
Showing
13 changed files
with
420 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...style-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/rule/ActiveRuleWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// checkstyle: Checks Java source code for adherence to a set of rules. | ||
// Copyright (C) 2001-2017 the original author or authors. | ||
// | ||
// This library is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 3 of the License, or (at your option) any later version. | ||
// | ||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
package org.sonar.plugins.checkstyle.rule; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Due to our usage of {@link org.sonar.plugins.checkstyle.CheckstyleProfileExporter} | ||
* on the {@link org.sonar.api.batch.ScannerSide} for generating CheckStyle configurations, | ||
* we must make it compatible for the new {@link org.sonar.api.batch.rule.ActiveRules}. | ||
* | ||
* Hence, to gain compatibility with server and scanner side in the exporter, | ||
* we have to wrap either {@link org.sonar.api.batch.rule.ActiveRule} or | ||
* {@link org.sonar.api.rules.ActiveRule} for usage in the exporter. | ||
*/ | ||
public interface ActiveRuleWrapper { | ||
String getInternalKey(); | ||
|
||
String getRuleKey(); | ||
|
||
String getTemplateRuleKey(); | ||
|
||
String getSeverity(); | ||
|
||
Map<String, String> getParams(); | ||
} |
61 changes: 61 additions & 0 deletions
61
...-plugin/src/main/java/org/sonar/plugins/checkstyle/rule/ActiveRuleWrapperScannerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// checkstyle: Checks Java source code for adherence to a set of rules. | ||
// Copyright (C) 2001-2017 the original author or authors. | ||
// | ||
// This library is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 3 of the License, or (at your option) any later version. | ||
// | ||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
package org.sonar.plugins.checkstyle.rule; | ||
|
||
import java.util.Map; | ||
|
||
import org.sonar.api.batch.rule.ActiveRule; | ||
import org.sonar.plugins.checkstyle.CheckstyleSeverityUtils; | ||
|
||
/** | ||
* Wrapper as per {@link ActiveRuleWrapper} for the new scanner side {@link ActiveRule}. | ||
*/ | ||
public class ActiveRuleWrapperScannerImpl implements ActiveRuleWrapper { | ||
private final ActiveRule activeRule; | ||
|
||
public ActiveRuleWrapperScannerImpl(ActiveRule activeRule) { | ||
this.activeRule = activeRule; | ||
} | ||
|
||
@Override | ||
public String getInternalKey() { | ||
return activeRule.internalKey(); | ||
} | ||
|
||
@Override | ||
public String getRuleKey() { | ||
return activeRule.ruleKey().rule(); | ||
} | ||
|
||
@Override | ||
public String getTemplateRuleKey() { | ||
return activeRule.templateRuleKey(); | ||
} | ||
|
||
@Override | ||
public String getSeverity() { | ||
return CheckstyleSeverityUtils.toSeverity(activeRule.severity()); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getParams() { | ||
return activeRule.params(); | ||
} | ||
} |
Oops, something went wrong.