diff options
| -rw-r--r-- | .gitignore | 39 | ||||
| -rw-r--r-- | .travis.yml | 16 | ||||
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | pom.xml | 182 | ||||
| -rw-r--r-- | sonar-css-plugin/pom.xml | 132 | ||||
| -rw-r--r-- | sonar-css-plugin/src/main/java/org/sonar/css/plugin/CssPlugin.java | 31 | ||||
| -rw-r--r-- | third-party-licenses.sh | 4 | ||||
| -rwxr-xr-x | travis.sh | 16 | 
8 files changed, 435 insertions, 1 deletions
| diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..882cf0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# ---- 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 + +# ---- IntelliJ IDEA +*.iws +*.iml +*.ipr +.idea/ +out/ + +# ---- Eclipse +.project +.settings/ +.classpath +bin/ + +# --- SonarQube +.sonar/ +.sonarlint/ +.scannerwork/ + +# --- Gradle +.gradle/ +build/ + +# --- Maven and Orchestrator +target/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ba0ed7c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: java +sudo: false +install: true +jdk: +- oraclejdk8 +script: "./travis.sh" +cache: +  directories: +  - "$HOME/.m2/repository" +  - "$HOME/.sonar" +  - "$HOME/maven" +notifications: +  email: false +  webhooks: +  - secure: 'rLDjr1N4uet5voRzrLBoeeKvTxPJtf77ZeWSUeMAd0IQKclOW06Gnr7Xnq9ksrydUJaOnd5/Fk1vqoyutC5I0zpGRW0l8FxknWDTJKRnXWNLfq557SfACOYQEZpMTiIEGHSOfbJ4iTrImRNde8Gw1ICvrNTBvH8Kbwg2jb3D0lRJ9krpCYgUYhNX7SPrqNG8SIiPPPMm7MRxjhAsW03WK98pV+PdEfhNDJQmGyZgFSI1nMkHxJiSVKz2mFxShwnAgaTNSxT8wJqskyV2ageuYuaZ8oKNjfOO3/4uj0UbJJYu3Ki6mW9mV1HvAAlhkLl4MblAlbeJ7+PnEWuuA9QAKvTk35fvRW7Byj9tCPguSLyrbA3smbqps2CKwAwu9cSiGJ42+I6YYCQZ4mN84rnB/QySJz2QUlYXXbmi9Zgz2K7bqLM9lgQRlIbI1I9V+5MRdbMaLxptMf62PMcatYZaQ30/Uubydm8Txilm/qWTQI2q1IPlIjEKIrt0tzssBJonh2bnxXR3PSoSAeFDuCe6sQbDmICrI1koM6cnSjSmINff9VEqmYM0S2wIj9O8M/G08M7em6UuiPObC79XQ6THZqxPhUoow8YOuiea8gFN+jpZcSHZQPJczV/bABJvIxfydAQG347Hn4yqYpeBN6YVppbMcoYyT+7ubSMaKIGNDbc=' +  on_start: always @@ -1,2 +1,16 @@ -# sonar-css +# SonarCSS  SonarCSS: CSS Analyzer for SonarQube + + +## Building + +```bash +mvn package +``` +    +     +## License + +Copyright 2018-2018 SonarSource. + +Licensed under the [GNU Lesser General Public License, Version 3.0](http://www.gnu.org/licenses/lgpl.txt) @@ -0,0 +1,182 @@ +<?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.sonarsource.parent</groupId> +        <artifactId>parent</artifactId> +        <version>45</version> +    </parent> + +    <groupId>org.sonarsource.css</groupId> +    <artifactId>css</artifactId> +    <version>1.0.0-SNAPSHOT</version> +    <packaging>pom</packaging> + +    <name>SonarCSS</name> +    <description>SonarQube CSS Analyzer</description> +    <url>http://redirect.sonarsource.com/plugins/css.html</url> +    <inceptionYear>2018</inceptionYear> +    <organization> +        <name>SonarSource</name> +        <url>http://www.sonarsource.com</url> +    </organization> +    <licenses> +        <license> +            <name>GNU LGPL 3</name> +            <url>http://www.gnu.org/licenses/lgpl.txt</url> +            <distribution>repo</distribution> +        </license> +    </licenses> + +    <developers> +        <developer> +            <id>vilchik-elena</id> +            <name>Elena Vilchik</name> +            <organization>SonarSource</organization> +        </developer> +        <developer> +            <id>saberduck</id> +            <name>Tibor Blenessy</name> +            <organization>SonarSource</organization> +        </developer> +        <developer> +            <id>stylianos-agapiou-sonarsource</id> +            <name>Stylianos Agapiou</name> +            <organization>SonarSource</organization> +        </developer> +    </developers> + +    <modules> +        <module>sonar-css-plugin</module> +    </modules> + +    <scm> +        <connection>scm:git:git@github.com:SonarSource/sonar-css.git</connection> +        <developerConnection>scm:git:git@github.com:SonarSource/sonar-css.git</developerConnection> +        <url>https://github.com/SonarSource/sonar-css</url> +        <tag>HEAD</tag> +    </scm> +    <issueManagement> +        <system>GitHub</system> +        <url>https://github.com/SonarSource/sonar-css/issues</url> +    </issueManagement> +    <ciManagement> +        <system>Travis</system> +        <url>https://travis-ci.org/SonarSource/sonar-css</url> +    </ciManagement> + +    <properties> +        <gitRepositoryName>sonar-css</gitRepositoryName> +        <license.title>SonarCSS</license.title> + +        <slf4j.version>1.7.25</slf4j.version> +        <assertj.version>3.10.0</assertj.version> +        <junit.version>4.12</junit.version> +        <sonar.version>7.2.0.11647</sonar.version> +        <sonar.min.version>6.7</sonar.min.version> +        <sonar-orchestrator.version>3.17.0.1491</sonar-orchestrator.version> +        <sonarlint.version>3.1.0.1376</sonarlint.version> +        <jsr305.version>3.0.2</jsr305.version> +        <mockito.version>2.18.3</mockito.version> +        <sonar-analyzer-commons.version>1.7.0.243</sonar-analyzer-commons.version> + +        <artifactsToPublish>${project.groupId}:sonar-css-plugin:jar</artifactsToPublish> +    </properties> + +    <dependencyManagement> +        <dependencies> +            <!-- Default dependencies (compile) --> +            <dependency> +                <groupId>com.google.code.findbugs</groupId> +                <artifactId>jsr305</artifactId> +                <version>${jsr305.version}</version> +            </dependency> +            <dependency> +                <groupId>org.sonarsource.analyzer-commons</groupId> +                <artifactId>sonar-analyzer-commons</artifactId> +                <version>${sonar-analyzer-commons.version}</version> +            </dependency> + +            <!-- Test dependencies --> +            <dependency> +                <groupId>com.google.guava</groupId> +                <artifactId>guava</artifactId> +                <version>${guava.version}</version> +                <scope>test</scope> +            </dependency> +            <dependency> +                <groupId>junit</groupId> +                <artifactId>junit</artifactId> +                <version>${junit.version}</version> +                <scope>test</scope> +            </dependency> +            <dependency> +                <groupId>org.assertj</groupId> +                <artifactId>assertj-core</artifactId> +                <version>${assertj.version}</version> +                <scope>test</scope> +            </dependency> +            <dependency> +                <groupId>org.sonarsource.sonarqube</groupId> +                <artifactId>sonar-testing-harness</artifactId> +                <version>${sonar.version}</version> +                <scope>test</scope> +            </dependency> +            <dependency> +                <groupId>org.sonarsource.orchestrator</groupId> +                <artifactId>sonar-orchestrator</artifactId> +                <version>${sonar-orchestrator.version}</version> +                <scope>test</scope> +                <exclusions> +                    <exclusion> +                        <groupId>com.oracle</groupId> +                        <artifactId>ojdbc6</artifactId> +                    </exclusion> +                </exclusions> +            </dependency> +            <dependency> +                <groupId>org.mockito</groupId> +                <artifactId>mockito-core</artifactId> +                <version>${mockito.version}</version> +                <scope>test</scope> +            </dependency> +            <dependency> +                <groupId>org.awaitility</groupId> +                <artifactId>awaitility</artifactId> +                <version>3.1.0</version> +                <scope>test</scope> +            </dependency> + +            <!-- Provided dependencies --> +            <dependency> +                <groupId>org.sonarsource.sonarqube</groupId> +                <artifactId>sonar-plugin-api</artifactId> +                <version>${sonar.min.version}</version> +                <scope>provided</scope> +            </dependency> +            <dependency> +                <groupId>org.slf4j</groupId> +                <artifactId>slf4j-api</artifactId> +                <version>${slf4j.version}</version> +                <scope>provided</scope> +            </dependency> + +        </dependencies> +    </dependencyManagement> + +    <!-- +    TODO: enable when ITs are added + +    <profiles> +        <profile> +            <id>its</id> +            <modules> +                <module>its</module> +            </modules> +        </profile> +    </profiles> +    --> + +</project> diff --git a/sonar-css-plugin/pom.xml b/sonar-css-plugin/pom.xml new file mode 100644 index 0000000..26e8477 --- /dev/null +++ b/sonar-css-plugin/pom.xml @@ -0,0 +1,132 @@ +<?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.sonarsource.css</groupId> +        <artifactId>css</artifactId> +        <version>1.0.0-SNAPSHOT</version> +    </parent> + +    <artifactId>sonar-css-plugin</artifactId> +    <packaging>sonar-plugin</packaging> + +    <name>SonarCSS :: Plugin</name> +    <!-- Be careful when altering <description> as its value shows up in the SonarQube GUI --> +    <description>Code Analyzer for CSS</description> +    <url>http://redirect.sonarsource.com/plugins/css.html</url> + +    <scm> +        <connection>scm:git:git@github.com:SonarSource/sonar-css.git</connection> +        <developerConnection>scm:git:git@github.com:SonarSource/sonar-css.git</developerConnection> +        <url>https://github.com/SonarSource/sonar-css</url> +        <tag>HEAD</tag> +    </scm> + +    <dependencies> +        <dependency> +            <groupId>org.slf4j</groupId> +            <artifactId>slf4j-api</artifactId> +        </dependency> +        <dependency> +            <groupId>org.sonarsource.sonarqube</groupId> +            <artifactId>sonar-plugin-api</artifactId> +        </dependency> +        <dependency> +            <groupId>org.sonarsource.analyzer-commons</groupId> +            <artifactId>sonar-analyzer-commons</artifactId> +        </dependency> +        <dependency> +            <groupId>org.sonarsource.sonarqube</groupId> +            <artifactId>sonar-testing-harness</artifactId> +        </dependency> +        <dependency> +            <groupId>junit</groupId> +            <artifactId>junit</artifactId> +        </dependency> +        <dependency> +            <groupId>org.assertj</groupId> +            <artifactId>assertj-core</artifactId> +        </dependency> +        <dependency> +            <groupId>com.google.code.findbugs</groupId> +            <artifactId>jsr305</artifactId> +        </dependency> +        <dependency> +            <groupId>org.mockito</groupId> +            <artifactId>mockito-core</artifactId> +        </dependency> +        <dependency> +            <groupId>org.awaitility</groupId> +            <artifactId>awaitility</artifactId> +        </dependency> +    </dependencies> + +    <build> +        <plugins> +            <plugin> +                <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId> +                <artifactId>sonar-packaging-maven-plugin</artifactId> +                <configuration> +                    <!-- This value shows up in the SonarQube GUI --> +                    <pluginName>SonarCSS</pluginName> +                    <pluginClass>org.sonar.css.plugin.CssPlugin</pluginClass> +                    <skipDependenciesPackaging>true</skipDependenciesPackaging> +                    <sonarLintSupported>false</sonarLintSupported> +                    <sonarQubeMinVersion>${sonar.min.version}</sonarQubeMinVersion> +                </configuration> +            </plugin> + +            <plugin> +                <artifactId>maven-shade-plugin</artifactId> +                <executions> +                    <execution> +                        <phase>package</phase> +                        <goals> +                            <goal>shade</goal> +                        </goals> +                        <configuration> +                            <shadedArtifactAttached>false</shadedArtifactAttached> +                            <minimizeJar>true</minimizeJar> +                            <createDependencyReducedPom>false</createDependencyReducedPom> +                            <filters> +                                <filter> +                                    <artifact>cglib:cglib-nodep</artifact> +                                    <includes> +                                        <include>**</include> +                                    </includes> +                                </filter> +                            </filters> +                        </configuration> +                    </execution> +                </executions> +            </plugin> + +            <plugin> +                <artifactId>maven-enforcer-plugin</artifactId> +                <executions> +                    <execution> +                        <id>enforce-plugin-size</id> +                        <goals> +                            <goal>enforce</goal> +                        </goals> +                        <phase>verify</phase> +                        <configuration> +                            <rules> +                                <requireFilesSize> +                                    <minsize>10000</minsize> +                                    <maxsize>50000</maxsize> +                                    <files> +                                        <file>${project.build.directory}/${project.build.finalName}.jar</file> +                                    </files> +                                </requireFilesSize> +                            </rules> +                        </configuration> +                    </execution> +                </executions> +            </plugin> + +        </plugins> +    </build> + +</project> diff --git a/sonar-css-plugin/src/main/java/org/sonar/css/plugin/CssPlugin.java b/sonar-css-plugin/src/main/java/org/sonar/css/plugin/CssPlugin.java new file mode 100644 index 0000000..8d2a12b --- /dev/null +++ b/sonar-css-plugin/src/main/java/org/sonar/css/plugin/CssPlugin.java @@ -0,0 +1,31 @@ +/* + * SonarCSS + * Copyright (C) 2018-2018 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. + */ +package org.sonar.css.plugin; + +import org.sonar.api.Plugin; + +public class CssPlugin implements Plugin { + + +  @Override +  public void define(Context context) { + +  } +} diff --git a/third-party-licenses.sh b/third-party-licenses.sh new file mode 100644 index 0000000..6728f1d --- /dev/null +++ b/third-party-licenses.sh @@ -0,0 +1,4 @@ +#!/bin/sh +mvn org.codehaus.mojo:license-maven-plugin:aggregate-add-third-party -Dlicense.includedScopes=compile + +cat target/generated-sources/license/THIRD-PARTY.txt diff --git a/travis.sh b/travis.sh new file mode 100755 index 0000000..e6c9913 --- /dev/null +++ b/travis.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +function configureTravis { +  mkdir -p ~/.local +  curl -sSL https://github.com/SonarSource/travis-utils/tarball/v48 | tar zx --strip-components 1 -C ~/.local +  source ~/.local/bin/install +} +configureTravis +. installJDK8 +. ~/.local/bin/installMaven35 + +export DEPLOY_PULL_REQUEST=true + +regular_mvn_build_deploy_analyze | 
