Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPohl committed Mar 1, 2018
2 parents 1909d80 + 92ad2f2 commit 8afa0d5
Show file tree
Hide file tree
Showing 692 changed files with 9,625 additions and 2,255 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
esql-checks/src/test/resources/FileHeaderCheck/*.esql text eol=lf
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: java
sudo: false

jdk:
- oraclejdk8

git:
submodules: false

install: true
script: "mvn clean install -P coverage-per-test"
matrix:
fast_finish: true

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

before_cache:
- find $HOME/.m2 -name resolver-status.properties -exec rm {} \;

notifications:
email: false

after_success:
- bash <(curl -s https://codecov.io/bash) -t b5356ca9-9cef-4be3-a67e-013d18ebd73a
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# How to contribute

Contributions are welcome!

### 1. GitHub issue
If you found a bug or have a feature request, you can create a [GitHub issue](https://github.com/EXXETA/sonar-esql-plugin/issues/new).

### 2. Pull Request
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
sonar-esql-plugin
=================
# sonar-esql-plugin [![Build Status](https://travis-ci.org/EXXETA/sonar-esql-plugin.svg)](https://travis-ci.org/EXXETA/sonar-esql-plugin) [![codecov](https://codecov.io/gh/EXXETA/sonar-esql-plugin/branch/develop/graph/badge.svg)](https://codecov.io/gh/EXXETA/sonar-esql-plugin)


This open source plugin can be used to analyze the ESQL-sourcecode of IBM Websphere Message Broker / IBM Integration Bus projects.

## Features
* \>75 rules
* Support for Broker 7, 8, 9, 10
* Metrics (complexity, number of lines, ...)
* Import of traces as coverage reports


## Installation

Expand All @@ -11,7 +17,7 @@ This open source plugin can be used to analyze the ESQL-sourcecode of IBM Websph

## Requirements

- SonarQube 5.6
- SonarQube 6.7


## Contributing
Expand All @@ -24,6 +30,8 @@ This open source plugin can be used to analyze the ESQL-sourcecode of IBM Websph

## History

- 2.3.0 - Additional rules, upgrade to SonarQube 6.7, copy paste detector
- 2.2.0 - Code coverage analysis
- 2.1.0 - A few bugfixes and a lot more checks/rules
- 2.0.0 - complete refactoring and upgrade to SonarQube 5.6
- 1.1.0 - Fix issues #7(https://github.com/EXXETA/sonar-esql-plugin/issues/7) and #8(https://github.com/EXXETA/sonar-esql-plugin/issues/8)
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.exxeta.iss</groupId>
<artifactId>sonar-msgflow-plugin</artifactId>
<version>1.1.1</version>
<description>POM was created from install:install-file</description>
</project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.exxeta.iss</groupId>
<artifactId>sonar-msgflow-plugin</artifactId>
<version>1.1.1</version>
<description>POM was created from install:install-file</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.exxeta.iss</groupId>
<artifactId>sonar-msgflow-plugin</artifactId>
<versioning>
<release>1.1.1</release>
<versions>
<version>1.1.1</version>
</versions>
<lastUpdated>20171228051943</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.exxeta.iss</groupId>
<artifactId>sonar-msgflow-plugin</artifactId>
<versioning>
<release>1.1.1</release>
<versions>
<version>1.1.1</version>
</versions>
<lastUpdated>20171228051927</lastUpdated>
</versioning>
</metadata>
2 changes: 1 addition & 1 deletion esql-checks-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.exxeta.iss</groupId>
<artifactId>sonar-esql-plugin</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -63,11 +63,11 @@ public static CheckMessagesVerifier issues(EsqlCheck check, File file) {
* source file where you expect an issue. For example:
*
* <pre>
* var x = 1; -- Noncompliant {{A message for this line.}}
* SET x = 1; -- Noncompliant {{A message for this line.}}
*
* function foo() { -- Noncompliant [[effortToFix=2]] [[secondary=+0,+1]]
* -- [[sc=5;ec=6;el=+0]]
* }
* function foo() BEGIN -- Noncompliant [[effortToFix=2]] [[secondary=+0,+1]]
* -- [[sc=5;ec=6;el=+0]]
* END
* </pre>
*
* How to write these comments:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,17 +17,20 @@
*/
package com.exxeta.iss.sonar.esql.checks.verifier;

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

import javax.annotation.Nullable;

import com.exxeta.iss.sonar.esql.api.tree.Tree;
import com.exxeta.iss.sonar.esql.api.tree.Tree.Kind;
import com.exxeta.iss.sonar.esql.api.tree.lexical.SyntaxToken;
import com.exxeta.iss.sonar.esql.api.tree.lexical.SyntaxTrivia;
import com.exxeta.iss.sonar.esql.api.visitors.EsqlVisitorContext;
import com.exxeta.iss.sonar.esql.api.visitors.SubscriptionVisitorCheck;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;

class ExpectedIssuesParser extends SubscriptionVisitorCheck {

Expand All @@ -43,8 +46,8 @@ static List<TestIssue> parseExpectedIssues(EsqlVisitorContext context) {
}

@Override
public List<Kind> nodesToVisit() {
return ImmutableList.of(Kind.TOKEN);
public Set<Kind> nodesToVisit() {
return ImmutableSet.of(Kind.TOKEN);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,8 +17,6 @@
*/
package com.exxeta.iss.sonar.esql.checks.verifier;

import static com.exxeta.iss.sonar.esql.compat.CompatibilityHelper.wrap;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
Expand All @@ -27,8 +25,8 @@

import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.config.MapSettings;
import org.sonar.api.config.Settings;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.config.internal.MapSettings;

import com.exxeta.iss.sonar.esql.api.tree.ProgramTree;
import com.exxeta.iss.sonar.esql.api.tree.Tree;
Expand Down Expand Up @@ -58,15 +56,16 @@ public static EsqlVisitorContext createParallelContext(InputFile file) {
private static EsqlVisitorContext createContext(InputFile file, ActionParser<Tree> parser) {
try {
ProgramTree programTree = (ProgramTree) parser.parse(file.contents());
return new EsqlVisitorContext(programTree, wrap(file), settings());
return new EsqlVisitorContext(programTree,file, new MapSettings().asConfig());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}

public static DefaultInputFile createTestInputFile(String baseDir, String relativePath) {
return new DefaultInputFile("module1", relativePath).setModuleBaseDir(Paths.get(baseDir))
.setLanguage("esql").setCharset(StandardCharsets.UTF_8).setType(InputFile.Type.MAIN);
return new TestInputFileBuilder("module1", relativePath).setModuleBaseDir(Paths.get(baseDir))
.setLanguage("esql").setCharset(StandardCharsets.UTF_8).setType(InputFile.Type.MAIN)
.build();
}

public static DefaultInputFile createTestInputFile(File baseDir, String relativePath) {
Expand All @@ -78,13 +77,9 @@ public static DefaultInputFile createTestInputFile(String relativePath) {
}

public static DefaultInputFile createTestInputFile(File baseDir, String relativePath, Charset charset) {
return new DefaultInputFile(baseDir.getAbsolutePath(), relativePath)
.setModuleBaseDir(Paths.get(baseDir.getAbsolutePath())).setLanguage("esql").setCharset(charset);
return new TestInputFileBuilder(baseDir.getAbsolutePath(), relativePath)
.setModuleBaseDir(Paths.get(baseDir.getAbsolutePath())).setLanguage("esql").setCharset(charset)
.build();
}

private static Settings settings() {
Settings settings = new MapSettings();

return settings;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Sonar ESQL Plugin
* Copyright (C) 2013-2017 Thomas Pohl and EXXETA AG
* Copyright (C) 2013-2018 Thomas Pohl and EXXETA AG
* http://www.exxeta.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
91 changes: 54 additions & 37 deletions esql-checks/pom.xml
Original file line number Diff line number Diff line change
@@ -1,48 +1,65 @@
<?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>
<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>com.exxeta.iss</groupId>
<artifactId>sonar-esql-plugin</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</parent>

<artifactId>esql-checks</artifactId>
<artifactId>esql-checks</artifactId>

<name>ESQL :: Checks</name>
<name>ESQL :: Checks</name>

<dependencies>
<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>esql-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sonar-msgflow-plugin</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>esql-checks-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>local-dependency-repo</id>
<url>file://${project.basedir}/../dependency-repo</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>esql-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>esql-checks-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 8afa0d5

Please sign in to comment.