Skip to content

Commit

Permalink
Java 1.8 Compatibility (#6)
Browse files Browse the repository at this point in the history
* Add Google Checkstyle standard
* Add LGTM badge
* Adjust checkstyle badge
* Add log statements
* Add Code Climate badges
* Add Funding button

Fixes #5
Fixes #1
  • Loading branch information
aensley authored Jul 31, 2019
1 parent 3f6d6e6 commit d9206a6
Show file tree
Hide file tree
Showing 14 changed files with 983 additions and 568 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ charset = utf-8
# Java settings
[*.java]
indent_style = space
indent_size = 4
indent_size = 2

# XML settings
[*.xml]
Expand Down
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#github: aensley
custom: https://paypal.me/AndrewEnsley

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: trusty
language: java
jdk:
- oraclejdk11
- oraclejdk8
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

[![License](https://img.shields.io/github/license/aensley/sonar-teams-notifier)](LICENSE)
[![Build Status](https://travis-ci.com/aensley/sonar-teams-notifier.svg?branch=master)](https://travis-ci.com/aensley/sonar-teams-notifier)
[![Checkstyle](https://img.shields.io/badge/checkstyle-google-blue?style=flat&logoWidth=8&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAQBAMAAADZpCNOAAAAFVBMVEVvcm3/AAD/sLX/zAD/1Nf/6gD88cWfIbEzAAAAAXRSTlMAQObYZgAAACxJREFUCNdjcHFSUmJAEGAQGmxsTIBIDUs2Y2BLS0tgYEhLA2oRFAQSjAIMACYODUYHdu83AAAAAElFTkSuQmCC)](https://checkstyle.sourceforge.io/google_style.html)
[![Downloads](https://img.shields.io/github/downloads/aensley/sonar-teams-notifier/total)](https://github.com/aensley/sonar-teams-notifier/releases)

[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/aensley/sonar-teams-notifier.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/aensley/sonar-teams-notifier/context:java)
[![Maintainability](https://api.codeclimate.com/v1/badges/29bdfe58f74e805ece51/maintainability)](https://codeclimate.com/github/aensley/sonar-teams-notifier/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/29bdfe58f74e805ece51/test_coverage)](https://codeclimate.com/github/aensley/sonar-teams-notifier/test_coverage)

This SonarQube plugin notifies WebEx Teams of Scan Results.


Expand Down
Binary file not shown.
99 changes: 88 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,55 @@

<groupId>com.andrewensley.sonarteamsnotifier</groupId>
<artifactId>sonar-teams-notifier</artifactId>
<version>1.0</version>
<version>1.1.1</version>

<packaging>sonar-plugin</packaging>

<name>Sonar Teams Notifier</name>
<description>Sends notifications to WebEx Teams</description>
<url>https://github.com/aensley/sonar-teams-notifier</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.pluginName>Sonar Teams Notifier</sonar.pluginName>
<project.targetJdk>11</project.targetJdk>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.targetJdk>1.8</project.targetJdk>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<!-- JaCoCo support -->
<argLine />
<sonar.version>7.9.1</sonar.version>
</properties>

<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<id>aensley</id>
<name>Andrew Ensley</name>
<url>https://github.com/aensley</url>
<organization>Andrew Ensley</organization>
<organizationUrl>https://andrewensley.com</organizationUrl>
</developer>
</developers>

<organization>
<name>Andrew Ensley</name>
<url>https://andrewensley.com</url>
</organization>

<scm>
<connection>scm:git:[email protected]:aensley/sonar-teams-notifier.git</connection>
<url>scm:git:[email protected]:aensley/sonar-teams-notifier.git</url>
<developerConnection>scm:git:[email protected]:aensley/sonar-teams-notifier.git</developerConnection>
<tag>teams-1.0</tag>
<tag>v${project.version}</tag>
</scm>

<dependencies>
Expand All @@ -43,13 +67,25 @@
<scope>provided</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>

<!-- Testing dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -73,7 +109,6 @@

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down Expand Up @@ -138,6 +173,35 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.23</version>
</dependency>
</dependencies>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand All @@ -155,15 +219,12 @@
<version>1.18.0.372</version>
<extensions>true</extensions>
<configuration>
<!-- the entry-point class that extends org.sonar.api.SonarPlugin -->
<pluginClass>com.andrewensley.sonarteamsnotifier.TeamsNotifierPlugin</pluginClass>

<!-- advanced properties can be set here. See paragraph "Advanced Build Properties". -->
<jarName>sonar-teams-notifier-${project.version}</jarName>
<pluginKey>sonar-teams-notifier</pluginKey>
<pluginName>Sonar Teams Notifier</pluginName>
<pluginDescription>Sends notifications to WebEx Teams</pluginDescription>
<sonarQubeMinVersion>6.7</sonarQubeMinVersion>
<sonarQubeMinVersion>7.9.1</sonarQubeMinVersion>
<pluginUrl>https://github.com/aensley/sonar-teams-notifier</pluginUrl>
<pluginIssueTrackerUrl>https://github.com/aensley/sonar-teams-notifier/issues</pluginIssueTrackerUrl>
<pluginSourcesUrl>https://github.com/aensley/sonar-teams-notifier</pluginSourcesUrl>
Expand All @@ -173,4 +234,20 @@
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,97 @@
import com.andrewensley.sonarteamsnotifier.domain.Constants;
import com.andrewensley.sonarteamsnotifier.extension.TeamsPostProjectAnalysisTask;
import com.andrewensley.sonarteamsnotifier.extension.TeamsSensor;

import java.util.ArrayList;
import java.util.List;

import org.sonar.api.Plugin;
import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import java.util.ArrayList;
import java.util.List;


/**
* Base Plugin class.
*/
public class TeamsNotifierPlugin implements Plugin {

/**
* Defines this plugin's hooks.
*
* @param context The SonarQube context.
*/
@Override
public void define(Context context) {
List<Object> extensions = pluginPropertyDefinitions();
/**
* Defines this plugin's hooks.
*
* @param context The SonarQube context.
*/
@Override
public void define(Context context) {
List<Object> extensions = pluginPropertyDefinitions();

extensions.add(TeamsSensor.class);
extensions.add(TeamsPostProjectAnalysisTask.class);
extensions.add(TeamsSensor.class);
extensions.add(TeamsPostProjectAnalysisTask.class);

context.addExtensions(extensions);
}
context.addExtensions(extensions);
}

/**
* Gets this plugin's property definitions.
*
* @return A list of this plugin's property definitions.
*/
private List<Object> pluginPropertyDefinitions() {
List<Object> extensions = new ArrayList<>();
extensions.add(PropertyDefinition.builder(Constants.ENABLED)
.name("Plugin enabled")
.description("Are Teams notifications enabled in general?")
.defaultValue("false")
.type(PropertyType.BOOLEAN)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(0)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_IP)
.name("Proxy Server")
.description("Domain or IP address of proxy server to use")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(1)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PORT)
.name("Proxy port")
.description("Port for proxy server")
.defaultValue("8080")
.type(PropertyType.INTEGER)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(2)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PROTOCOL)
.name("Proxy protocol")
.description("Protocol to use to connect to proxy server")
.defaultValue("HTTP")
.type(PropertyType.SINGLE_SELECT_LIST)
.options("DIRECT", "HTTP", "SOCKS")
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(3)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_USER)
.name("Proxy User")
.description("User name for proxy authentication")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(4)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PASS)
.name("Proxy Password")
.description("Password for proxy authentication")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(5)
.build());
return extensions;
}
/**
* Gets this plugin's property definitions.
*
* @return A list of this plugin's property definitions.
*/
private List<Object> pluginPropertyDefinitions() {
List<Object> extensions = new ArrayList<>();
extensions.add(PropertyDefinition.builder(Constants.ENABLED)
.name("Plugin enabled")
.description("Are Teams notifications enabled in general?")
.defaultValue("false")
.type(PropertyType.BOOLEAN)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(0)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_IP)
.name("Proxy Server")
.description("Domain or IP address of proxy server to use")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(1)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PORT)
.name("Proxy port")
.description("Port for proxy server")
.defaultValue("8080")
.type(PropertyType.INTEGER)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(2)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PROTOCOL)
.name("Proxy protocol")
.description("Protocol to use to connect to proxy server")
.defaultValue("HTTP")
.type(PropertyType.SINGLE_SELECT_LIST)
.options("DIRECT", "HTTP", "SOCKS")
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(3)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_USER)
.name("Proxy User")
.description("User name for proxy authentication")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(4)
.build());
extensions.add(PropertyDefinition.builder(Constants.PROXY_PASS)
.name("Proxy Password")
.description("Password for proxy authentication")
.defaultValue("")
.type(PropertyType.STRING)
.category(Constants.CATEGORY)
.subCategory(Constants.SUBCATEGORY)
.index(5)
.build());
return extensions;
}
}
Loading

0 comments on commit d9206a6

Please sign in to comment.