Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit to jenkins-astree-plugin repo on GitHub
- Loading branch information
Showing
15 changed files
with
1,198 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The AbsInt Astrée Jenkins Plugin will be part of the continuous integration build process on DEV@cloud. | ||
You will be able to directly access and install the plugin from your Jenkins -> Manage Jenkins -> Manage Plugins site. | ||
|
||
|
||
If you want to manually build the plugin you can use the following Maven command in the "pom.xml" project directory: | ||
"mvn package" | ||
|
||
A "target" directory including the "astree.hpi" binary version of the plugin will be generated. |
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 @@ | ||
Jenkins plugin for the AbsInt Astrée analyzer |
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,85 @@ | ||
<?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> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>2.3</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
|
||
<groupId>com.absint</groupId> | ||
<artifactId>astree</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>hpi</packaging> | ||
|
||
<properties> | ||
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. --> | ||
<jenkins.version>1.625.3</jenkins.version> | ||
<!-- Java Level to use. Java 7 required when using core >= 1.612 --> | ||
<java.level>7</java.level> | ||
<!-- Jenkins Test Harness version you use to test the plugin. --> | ||
<!-- For Jenkins version >= 1.580.1 use JTH 2.x or higher. --> | ||
<jenkins-test-harness.version>2.1</jenkins-test-harness.version> | ||
<!-- Other properties you may want to use: | ||
~ hpi-plugin.version: The HPI Maven Plugin version used by the plugin.. | ||
~ stapler-plugin.version: The Stapler Maven plugin version required by the plugin. | ||
--> | ||
</properties> | ||
|
||
<name>AbsInt Astrée Plugin for Jenkins</name> | ||
<description>Integration of AbsInt's Astrée into the Jenkins continuous integration system</description> | ||
<url>n/a</url> | ||
|
||
<!-- The default licence for Jenkins OSS Plugins is MIT. Substitute for the applicable one if needed. --> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>http://opensource.org/licenses/MIT</url> | ||
</license> | ||
</licenses> | ||
|
||
<!-- If you want this to appear on the wiki page: | ||
<developers> | ||
<developer> | ||
<id>bhacker</id> | ||
<name>Bob Q. Hacker</name> | ||
<email>bhacker@nowhere.net</email> | ||
</developer> | ||
</developers> | ||
--> | ||
<!-- Assuming you want to host on @jenkinsci: | ||
<scm> | ||
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection> | ||
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection> | ||
<url>http://github.com/jenkinsci/${project.artifactId}-plugin</url> | ||
</scm> | ||
--> | ||
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
<!-- If you want to depend on other plugins: | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>credentials</artifactId> | ||
<version>1.9.4</version> | ||
</dependency> | ||
</dependencies> | ||
--> | ||
|
||
</project> |
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,170 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2016, AbsInt Angewandte Informatik GmbH | ||
* Author: Dr.-Ing. Joerg Herter | ||
* Email: herter@absint.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package com.absint.astree; | ||
|
||
import java.io.*; | ||
|
||
|
||
/** | ||
* Stores an analysis (result) summary and provides an interface to the analysis result for the | ||
* Astrée PlugIn classes. | ||
* | ||
* | ||
* @author AbsInt Angewandte Informatik GmbH | ||
*/ | ||
public class AnalysisSummary { | ||
|
||
private int numberOfErrors; | ||
private int numberOfAlarms; | ||
private int numberOfDataflowAnomalies; | ||
private int numberOfRuleViolations; | ||
private int numberOfTrueAlarms; // not implemented yet | ||
private int numberOfUncommentedAlarms; // not implemented yet | ||
|
||
/** | ||
* Private constructor. | ||
*/ | ||
private AnalysisSummary(int numberOfErrors, int numberOfAlarms, | ||
int numberOfDataflowAnomalies, int numberOfRuleViolations, | ||
int numberOfTrueAlarms, int numberOfUncommentedAlarms ) { | ||
this.numberOfErrors = numberOfErrors; | ||
this.numberOfAlarms = numberOfAlarms; | ||
this.numberOfDataflowAnomalies = numberOfDataflowAnomalies; | ||
this.numberOfRuleViolations = numberOfRuleViolations; | ||
this.numberOfTrueAlarms = numberOfTrueAlarms; | ||
this.numberOfUncommentedAlarms = numberOfUncommentedAlarms; | ||
} | ||
|
||
/** | ||
* Constructs an AnalyisSummary object from a report file (txt version). | ||
* | ||
* @param path Path (as {@link java.lang.String}) to the Astrée text report | ||
* from which the object is to be constructed. | ||
* @return AnalysisSummary object providing easy access to data of an Astrée report | ||
*/ | ||
static public AnalysisSummary readFromReportFile(String path) { | ||
int numberOfErrors = 0; | ||
int numberOfAlarms = 0; | ||
int numberOfDataflowAnomalies = 0; | ||
int numberOfRuleViolations = 0; | ||
int numberOfTrueAlarms = 0; // not implemented yet | ||
int numberOfUncommentedAlarms = 0; // not implemented yet | ||
try{ | ||
FileReader fr = new FileReader( new File(path) ); | ||
BufferedReader br = new BufferedReader(fr); | ||
String line = br.readLine(); | ||
boolean skipping = true; | ||
while(line != null) { | ||
if(!skipping) { | ||
if(line.trim().startsWith("Errors:")) | ||
numberOfErrors = Integer.parseInt( | ||
line.substring(line.indexOf(":") + 1, line.length()).trim()); | ||
else if(line.trim().startsWith("Run-time errors:")) | ||
numberOfAlarms = Integer.parseInt( | ||
line.substring(line.indexOf(":") + 1, line.length()).trim()); | ||
else if(line.trim().startsWith("Data flow anomalies:")) | ||
numberOfDataflowAnomalies = Integer.parseInt( | ||
line.substring(line.indexOf(":") + 1, line.length()).trim()); | ||
else if(line.trim().startsWith("Rule violations:")) | ||
numberOfRuleViolations = Integer.parseInt( | ||
line.substring(line.indexOf(":") + 1, line.length()).trim()); | ||
|
||
|
||
} | ||
// skip report until Summary section is reached | ||
if(skipping && line.trim().startsWith("/* Result summary */")) | ||
skipping = false; | ||
line = br.readLine(); | ||
} | ||
br.close(); | ||
} catch(Exception e) { | ||
return null; | ||
} | ||
return new AnalysisSummary(numberOfErrors, numberOfAlarms, | ||
numberOfDataflowAnomalies, numberOfRuleViolations, | ||
numberOfTrueAlarms, numberOfUncommentedAlarms ); | ||
} | ||
|
||
|
||
/* | ||
* Interface for Astrée PlugIn class. | ||
*/ | ||
|
||
/** | ||
* Returns the number of reported definite runtime errors ("errors"). | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfErrors() { | ||
return this.numberOfErrors; | ||
} | ||
|
||
/** | ||
* Returns the number of reported potential runtime errors ("alarms"). | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfAlarms() { | ||
return this.numberOfAlarms; | ||
} | ||
|
||
/** | ||
* Returns the number of reported data-flow anaomalies ("Type D alarms"). | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfDataflowAnomalies() { | ||
return this.numberOfDataflowAnomalies; | ||
} | ||
|
||
/** | ||
* Returns the number of reported rule violations ("Type R alarms"). | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfRuleViolations() { | ||
return this.numberOfRuleViolations; | ||
} | ||
|
||
/** | ||
* Returns the number of reported potential runtime errors ("alarms") classified as "true". | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfTrueAlarms() { | ||
return this.numberOfTrueAlarms; | ||
} | ||
|
||
/** | ||
* Returns the number of reported potential runtime errors ("alarms") not commented. | ||
* | ||
* @return int | ||
*/ | ||
public int getNumberOfUncommentedAlarms() { | ||
return this.numberOfUncommentedAlarms; | ||
} | ||
} |
Oops, something went wrong.