-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff66bca
commit e1cf83f
Showing
32 changed files
with
1,333 additions
and
229 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
4 changes: 3 additions & 1 deletion
4
src/main/java/org/jenkinsci/plugins/sonargerrit/sonar/AnalysisStrategy.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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
package org.jenkinsci.plugins.sonargerrit.sonar; | ||
|
||
import hudson.FilePath; | ||
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import java.io.IOException; | ||
import org.jenkinsci.plugins.sonargerrit.gerrit.Revision; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
public interface AnalysisStrategy { | ||
|
||
InspectionReport analyse(TaskListener listener, Revision revision, FilePath workspace) | ||
InspectionReport analyse( | ||
Run<?, ?> run, TaskListener listener, Revision revision, FilePath workspace) | ||
throws IOException, InterruptedException; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/org/jenkinsci/plugins/sonargerrit/sonar/Component.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,14 @@ | ||
package org.jenkinsci.plugins.sonargerrit.sonar; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
public interface Component { | ||
String getKey(); | ||
|
||
@Nullable | ||
String getPath(); | ||
|
||
@Nullable | ||
String getModuleKey(); | ||
} |
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
47 changes: 47 additions & 0 deletions
47
src/main/java/org/jenkinsci/plugins/sonargerrit/sonar/Rule.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,47 @@ | ||
package org.jenkinsci.plugins.sonargerrit.sonar; | ||
|
||
import java.io.UnsupportedEncodingException; | ||
import java.net.URLEncoder; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
|
||
/** @author Réda Housni Alaoui */ | ||
@Restricted(NoExternalUse.class) | ||
public class Rule { | ||
|
||
private final String id; | ||
|
||
public Rule(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String id() { | ||
return id; | ||
} | ||
|
||
public String createLink(String sonarQubeUrl) { | ||
if (sonarQubeUrl == null) { | ||
return id; | ||
} | ||
StringBuilder sb = new StringBuilder(); | ||
String url = sonarQubeUrl.trim(); | ||
if (!(url.startsWith("http://") || sonarQubeUrl.startsWith("https://"))) { | ||
sb.append("http://"); | ||
} | ||
sb.append(url); | ||
if (!(url.endsWith("/"))) { | ||
sb.append("/"); | ||
} | ||
sb.append("coding_rules#rule_key="); | ||
sb.append(escapeHttp(id)); // squid%3AS1319 | ||
return sb.toString(); | ||
} | ||
|
||
private String escapeHttp(String query) { | ||
try { | ||
return URLEncoder.encode(query, "UTF-8"); | ||
} catch (UnsupportedEncodingException e) { | ||
return query; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.