Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
racodond committed Nov 18, 2016
0 parents commit c9b855d
Show file tree
Hide file tree
Showing 362 changed files with 15,889 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Maven
target/

# IntelliJ IDEA
*.iws
*.iml
*.ipr
.idea/

# Eclipse
.classpath
.project
.settings

# ---- Mac OS X
.DS_Store
Icon?
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes

# ---- Windows
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini

log.txt
*~
*versionsBackup

.sonar/
.sonarlint/
sonarlint.json
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: java

jdk:
- oraclejdk8

addons:
sonarqube: true

env:
global:
- secure: "CSzKqFmcrE0QC/wDQPirPPAWQBD0jsM8urbUjis/EEb00vjroI/uSNvDdzPyR0ZvMB6AaiZmYhyfXvVjw5doIyzEaI6pKiHFGvzoQAFfPI4Or1ST7AI3c2sD3mf1FQE3T+lvpoDmGj7gA+rLWsxzrqcfWiWbkggs7E3N2PxLhXGEu4o6gbkt8kiseIiRspIwZpg7ftqL7UGefWGaYFIlf9jX0Xd9ySpCBGbquWHK9+TdgKhhl+nBR7R1SbDgUABfJbhRyTQmR1oyuz+BxwZi5w6twoZsDYiCisIBdioBCmYZNShb+7EpMZLuKPMRkVhLvlJ6aI2taw+UPqlK7r14f9TDU57Hr2cEp/k4YDJZxkaOH8Cxc5OWY9CP1cuf9t0HoK9mwBTHjbxZ5Xm0+u4b0ydUsFq5h9lH7hh9/OHeXTPjBCW9hPyWoWa1JkYikk1WwunLV8TyA6jMBKQlHNjCSADoV7AeedldwCpfRIVOZYO+cewyMxfhBwqyJEOGjuEzpuoc7VyRJnpSoTf4TQkLbG5JeTp8cZOgCRwbEPcaVU0kwYBdXSm03WkTBEyCIC01h94yk3KczVUmbzopXs0uAGoFjXIs48RG38S3D3jKJ9vZN57iTf+8bw8ywUYfnbud5Hz/O9r/cTdsjNakdNeNTmzIpaZX87VGC3DItrbOfZg="
- secure: "mx3sD7v64/4HdNe9RCPkJun3JQ57cDVZv7tMgcb7x0RUZAjSkyGb6lenzC7MirBmjEEe2kYHtsJ/0P6qa8VeqrEhVAOHtssk9UZAc37E9Nj5x60DY7n2xG91kg9ih2li8IoKFM1ywuC2jOd0SgKXllfEN97Z3tsgL2AQdSypsasaNzKXZMZmVdHyBngBzWSlPVhnpHlD3UR60ikQyVn8UEX/28KUVap/Alg4upwC8R1RRHUfZ9W9gyg77lADJAKkd/7QIVdECVKHy9RdR091aUfx7OOhhJzRTw+O2G6Fb6lJEtQ3NqGEPUM3tQ2wp7y1P10V+DPCqZtQMVZTqPp5NJsASSYqbLEzURZzMPNMECgjd+bQbdmOQUeCsCXEWlRQA7AmX7vX9tqLsE2fbwVKuxSRwieitZ5MLp3hFZeu2m0TaREezOc6iYqf7ob5aYoCia7/LMoFa+R9w8679e3+ilveJKErhWFuEFb81oC4XDt8+Ztet249JcypwcInFyz29pITLjeAJiMWUzm7RqfSTlMXLAXd4Z+a9pH6+yocnPhGJRSQ+hXo4NZK4s8U04bU1ejF5FrNfEFfbLKbyt/Cwl7LT8L28BQK6nbPIUBAtD20RWOu+bbH8PUvYgeESmdh0YxugdFyhXqt8pSOji5yg/oP7w0ECPrqDw8x1q+Lhz8="
matrix:
- SQ_VERSION=LTS
- SQ_VERSION=LATEST_RELEASE
- SQ_VERSION=DEV

cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'

script: ./travis.sh
165 changes: 165 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
SonarQube Cucumber Gherkin Plugin
=================================

[![Build Status](https://api.travis-ci.org/racodond/sonar-gherkin-plugin.svg?branch=master)](https://travis-ci.org/racodond/sonar-gherkin-plugin)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/hhh9gsp77hatvai1/branch/master?svg=true)](https://ci.appveyor.com/project/racodond/sonar-gherkin-plugin/branch/master)
[![Quality Gate](https://sonarqube.com/api/badges/gate?key=com.racodond.sonarqube.plugin.gherkin:gherkin)](https://sonarqube.com/overview?id=com.racodond.sonarqube.plugin.gherkin%3Agherkin)

## Description
This plugin enables code QA analysis of [Cucumber Gherkin feature files](https://github.com/cucumber/cucumber/wiki/Gherkin) within [SonarQube](http://www.sonarqube.org):

* Computes metrics: lines of code, comments lines, etc.
* Performs more than [15 checks](#available-checks)
* Provide the ability to write your own checks

## Usage

1. [Download and install](http://docs.sonarqube.org/display/SONAR/Setup+and+Upgrade) SonarQube
1. Install the Cucumber Gherkin plugin either by a [direct download](https://github.com/racodond/sonar-gherkin-plugin/releases) or through the [Update Center](http://docs.sonarqube.org/display/SONAR/Update+Center).
1. [Install your favorite analyzer](http://docs.sonarqube.org/display/SONAR/Analyzing+Source+Code#AnalyzingSourceCode-RunningAnalysis) (SonarQube Scanner, Maven, Ant, etc.) and analyze your code. Note that Java 8 is required to run an analysis.

Plugin versions and compatibility with SonarQube versions: [http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix](http://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix)

## Metrics

### Statements
Number of steps.

### Functions
Number of scenarios and scenario outlines.

### Classes
Number of features.


## Available Checks

### Standard

* "Examples" table should contain data
* "FIXME" tags should be handled
* "TODO" tags should be handled
* All comments should be formatted consistently
* Byte Order Mark (BOM) should not be used for UTF-8 files
* End-line characters should be consistent
* Features should not contain too many scenarios
* Features that do not define any scenario should be removed
* File names should comply with a naming convention
* Files should contain an empty new line at the end
* Files that do not define any feature should be removed
* Lines should not end with trailing whitespaces
* Only tags from the whitelist should be used
* Scenarios should not contain too many steps
* Source code should be properly indented
* Star (*) step prefix should not be used
* Tabulation characters should not be used
* Tags should comply with a naming convention

### Templates

* Regular expression on comment


## Custom Checks

You're thinking of new valuable rules? Version 1.0 or greater provides an API to write your own custom checks.
A sample plugin with detailed explanations is available [here](https://github.com/racodond/sonar-gherkin-custom-rules-plugin).
If your custom rules may benefit the community, feel free to create a pull request in order to make the rule available in the Cucumber Gherkin plugin.

You're thinking of new rules that may benefit the community but don't have the time or the skills to write them? Feel free to create an [issue](https://github.com/racodond/sonar-gherkin-plugin/issues) for your rules to be taken under consideration.
30 changes: 30 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "{build}"

cache:
- C:\Users\appveyor\.m2

install:
- SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0
- SET PATH=C:\maven\apache-maven-3.3.9\bin;%JAVA_HOME%\bin;%PATH%

- appveyor DownloadFile http://www.us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
- 7z x apache-maven-3.3.9-bin.zip -oC:\maven

environment:
matrix:
- SQ_VERSION: "LTS"
- SQ_VERSION: "LATEST_RELEASE"
- SQ_VERSION: "DEV"

platform:
- x86
- x64

build_script:
- mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B

test_script:
- mvn clean install -B
- cd its
- mvn -B clean install -Dsonar.runtimeVersion=%SQ_VERSION%

51 changes: 51 additions & 0 deletions gherkin-checks-testkit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.racodond.sonarqube.plugin.gherkin</groupId>
<artifactId>gherkin</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>gherkin-checks-testkit</artifactId>
<name>SonarQube Gherkin Analyzer :: Check Test Toolkit</name>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gherkin-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit c9b855d

Please sign in to comment.