-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
46 changed files
with
1,782 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# flowable-ex | ||
# crp-flowable-ex | ||
|
||
# gpg public key | ||
``` | ||
------------------------------------------------- | ||
pub ed25519 2022-05-05 [SC] | ||
8F1F8EA5D80A19261D4225C151F1832CEE783D36 | ||
uid [ultimate] crystal-processes <[email protected]> | ||
``` |
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,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>crp-flowable-ex</artifactId> | ||
<groupId>io.github.crystal-processes</groupId> | ||
<version>0.0.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>crp-bpm-sonarqube-plugin</artifactId> | ||
<packaging>sonar-plugin</packaging> | ||
<version>0.0.4-SNAPSHOT</version> | ||
|
||
<name>BPM Sonarqube plugin</name> | ||
<description>Business process management plugin for Sonarqube</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<sonar.apiVersion>8.3.1.34397</sonar.apiVersion> | ||
<jdk.min.version>1.8</jdk.min.version> | ||
<sonar.sources>src/main/java</sonar.sources> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.sonarsource.sonarqube</groupId> | ||
<artifactId>sonar-plugin-api</artifactId> | ||
<version>${sonar.apiVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<!-- packaged with the plugin --> | ||
<groupId>commons-lang</groupId> | ||
<artifactId>commons-lang</artifactId> | ||
<version>2.6</version> | ||
</dependency> | ||
|
||
<!-- unit tests --> | ||
<dependency> | ||
<groupId>org.sonarsource.sonarqube</groupId> | ||
<artifactId>sonar-testing-harness</artifactId> | ||
<version>${sonar.apiVersion}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>3.3.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId> | ||
<artifactId>sonar-packaging-maven-plugin</artifactId> | ||
<version>1.18.0.372</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<pluginKey>BPM</pluginKey> | ||
<pluginClass>org.crp.sonarsource.plugins.bpm.BpmPlugin</pluginClass> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>${jdk.min.version}</source> | ||
<target>${jdk.min.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<!-- UTF-8 bundles are not supported by Java, so they must be converted during build --> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>native2ascii-maven-plugin</artifactId> | ||
<version>2.0.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>resources</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
22 changes: 22 additions & 0 deletions
22
crp-bpm-sonarqube-plugin/src/main/java/org/crp/sonarsource/plugins/bpm/BpmPlugin.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,22 @@ | ||
package org.crp.sonarsource.plugins.bpm; | ||
|
||
import org.crp.sonarsource.plugins.bpm.languages.BpmnLanguage; | ||
import org.crp.sonarsource.plugins.bpm.languages.BpmnQualityProfile; | ||
import org.crp.sonarsource.plugins.bpm.rules.BpmnCoverageLoaderSensor; | ||
import org.crp.sonarsource.plugins.bpm.settings.BpmnLanguageProperties; | ||
import org.sonar.api.Plugin; | ||
|
||
/** | ||
* Business process management plugin for sonarqube | ||
*/ | ||
public class BpmPlugin implements Plugin { | ||
|
||
@Override | ||
public void define(Context context) { | ||
context.addExtensions(BpmnLanguage.class, BpmnQualityProfile.class); | ||
context.addExtensions(BpmnLanguageProperties.getProperties()); | ||
|
||
context | ||
.addExtension(BpmnCoverageLoaderSensor.class); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...onarqube-plugin/src/main/java/org/crp/sonarsource/plugins/bpm/languages/BpmnLanguage.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,27 @@ | ||
package org.crp.sonarsource.plugins.bpm.languages; | ||
|
||
import org.crp.sonarsource.plugins.bpm.settings.BpmnLanguageProperties; | ||
import org.sonar.api.config.Configuration; | ||
import org.sonar.api.resources.AbstractLanguage; | ||
|
||
/** | ||
* This class defines the bpmn language. | ||
*/ | ||
public final class BpmnLanguage extends AbstractLanguage { | ||
|
||
public static final String NAME = "BPMN"; | ||
public static final String KEY = "bpmn"; | ||
|
||
private final Configuration config; | ||
|
||
public BpmnLanguage(Configuration config) { | ||
super(KEY, NAME); | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public String[] getFileSuffixes() { | ||
return config.getStringArray(BpmnLanguageProperties.FILE_SUFFIXES_KEY); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...be-plugin/src/main/java/org/crp/sonarsource/plugins/bpm/languages/BpmnQualityProfile.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,18 @@ | ||
package org.crp.sonarsource.plugins.bpm.languages; | ||
|
||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | ||
|
||
/** | ||
* Default, BuiltIn Quality Profile for the projects having bpmn files | ||
*/ | ||
public final class BpmnQualityProfile implements BuiltInQualityProfilesDefinition { | ||
|
||
@Override | ||
public void define(Context context) { | ||
NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile("BPMN Rules", BpmnLanguage.KEY); | ||
profile.setDefault(true); | ||
|
||
profile.done(); | ||
} | ||
|
||
} |
106 changes: 106 additions & 0 deletions
106
...sonarqube-plugin/src/main/java/org/crp/sonarsource/plugins/bpm/languages/ReportEvent.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,106 @@ | ||
package org.crp.sonarsource.plugins.bpm.languages; | ||
|
||
public class ReportEvent { | ||
protected String fileName; | ||
protected String processDefinitionKey; | ||
protected String flowElementId; | ||
protected int lineNumber; | ||
protected int hits; | ||
protected String event; | ||
|
||
private ReportEvent(String fileName, String processDefinitionKey, String flowElementId, int lineNumber, int hits, String event) { | ||
this.fileName = fileName; | ||
this.processDefinitionKey = processDefinitionKey; | ||
this.flowElementId = flowElementId; | ||
this.lineNumber = lineNumber; | ||
this.hits = hits; | ||
this.event = event; | ||
} | ||
|
||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public String getProcessDefinitionKey() { | ||
return processDefinitionKey; | ||
} | ||
|
||
public String getFlowElementId() { | ||
return flowElementId; | ||
} | ||
|
||
public int getLineNumber() { | ||
return lineNumber; | ||
} | ||
|
||
public String getEvent() { | ||
return event; | ||
} | ||
|
||
public int getHits() { | ||
return hits; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return fileName + '|' + | ||
processDefinitionKey + '|' + | ||
flowElementId + '|' + | ||
lineNumber + '|' + | ||
hits + '|' + | ||
event + '|'; | ||
} | ||
|
||
public void addHit() { | ||
hits++; | ||
} | ||
|
||
public void addHits(int hits) { | ||
this.hits += hits; | ||
} | ||
|
||
public static class Builder { | ||
protected String fileName; | ||
protected String processDefinitionKey; | ||
protected String flowElementId; | ||
protected int lineNumber = -1; | ||
protected int hits = 0; | ||
protected String event; | ||
|
||
public Builder() { | ||
} | ||
|
||
public Builder fileName(String fileName) { | ||
this.fileName = fileName; | ||
return this; | ||
} | ||
|
||
public Builder processDefinitionKey(String processDefinitionKey) { | ||
this.processDefinitionKey = processDefinitionKey; | ||
return this; | ||
} | ||
|
||
public Builder flowElementId(String flowElementId) { | ||
this.flowElementId = flowElementId; | ||
return this; | ||
} | ||
|
||
public Builder lineNumber(int lineNumber) { | ||
this.lineNumber = lineNumber; | ||
return this; | ||
} | ||
|
||
public Builder event(String event) { | ||
this.event = event; | ||
return this; | ||
} | ||
|
||
public ReportEvent build() { | ||
return new ReportEvent(fileName, processDefinitionKey, flowElementId, lineNumber, hits, event); | ||
} | ||
public static ReportEvent build(String eventCSV) { | ||
String[] eventCSVArray = eventCSV.split("\\|"); | ||
return new ReportEvent(eventCSVArray[0], eventCSVArray[1], eventCSVArray[2], Integer.parseInt(eventCSVArray[3]), Integer.parseInt(eventCSVArray[4]), ""); | ||
} | ||
} | ||
} |
Oops, something went wrong.