Skip to content

Commit 1a58d4e

Browse files
committed
Initial commit
0 parents  commit 1a58d4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7260
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.classpath
2+
.project
3+
.settings/
4+
target/
5+
6+
# Exclude OS X folder attributes
7+
.DS_Store
8+
9+
# IntelliJ files
10+
*.ipr
11+
*.iml
12+
*.iws
13+
.idea

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SonarQube Plugin for Flutter / Dart
2+
3+
## develop
4+
5+
#### Breaking
6+
7+
- None.
8+
9+
#### Experimental
10+
11+
- None.
12+
13+
#### Enhancements
14+
15+
- None
16+
17+
#### Bug Fixes
18+
19+
- None
20+
21+
## 0.1.0
22+
23+
#### Breaking
24+
25+
- Initial release.
26+
27+
#### Experimental
28+
29+
- None.
30+
31+
#### Enhancements
32+
33+
- None.
34+
35+
#### Bug Fixes
36+
37+
- None.

LICENSE.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
​ GNU LESSER GENERAL PUBLIC LICENSE
2+
​ Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5+
Everyone is permitted to copy and distribute verbatim copies
6+
of this license document, but changing it is not allowed.
7+
8+
9+
This version of the GNU Lesser General Public License incorporates
10+
the terms and conditions of version 3 of the GNU General Public
11+
License, supplemented by the additional permissions listed below.
12+
13+
0. Additional Definitions.
14+
15+
As used herein, "this License" refers to version 3 of the GNU Lesser
16+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17+
General Public License.
18+
19+
"The Library" refers to a covered work governed by this License,
20+
other than an Application or a Combined Work as defined below.
21+
22+
An "Application" is any work that makes use of an interface provided
23+
by the Library, but which is not otherwise based on the Library.
24+
Defining a subclass of a class defined by the Library is deemed a mode
25+
of using an interface provided by the Library.
26+
27+
A "Combined Work" is a work produced by combining or linking an
28+
Application with the Library. The particular version of the Library
29+
with which the Combined Work was made is also called the "Linked
30+
Version".
31+
32+
The "Minimal Corresponding Source" for a Combined Work means the
33+
Corresponding Source for the Combined Work, excluding any source code
34+
for portions of the Combined Work that, considered in isolation, are
35+
based on the Application, and not on the Linked Version.
36+
37+
The "Corresponding Application Code" for a Combined Work means the
38+
object code and/or source code for the Application, including any data
39+
and utility programs needed for reproducing the Combined Work from the
40+
Application, but excluding the System Libraries of the Combined Work.
41+
42+
1. Exception to Section 3 of the GNU GPL.
43+
44+
You may convey a covered work under sections 3 and 4 of this License
45+
without being bound by section 3 of the GNU GPL.
46+
47+
2. Conveying Modified Versions.
48+
49+
If you modify a copy of the Library, and, in your modifications, a
50+
facility refers to a function or data to be supplied by an Application
51+
that uses the facility (other than as an argument passed when the
52+
facility is invoked), then you may convey a copy of the modified
53+
version:
54+
55+
a) under this License, provided that you make a good faith effort to
56+
ensure that, in the event an Application does not supply the
57+
function or data, the facility still operates, and performs
58+
whatever part of its purpose remains meaningful, or
59+
60+
b) under the GNU GPL, with none of the additional permissions of
61+
this License applicable to that copy.
62+
63+
3. Object Code Incorporating Material from Library Header Files.
64+
65+
The object code form of an Application may incorporate material from
66+
a header file that is part of the Library. You may convey such object
67+
code under terms of your choice, provided that, if the incorporated
68+
material is not limited to numerical parameters, data structure
69+
layouts and accessors, or small macros, inline functions and templates
70+
(ten or fewer lines in length), you do both of the following:
71+
72+
a) Give prominent notice with each copy of the object code that the
73+
Library is used in it and that the Library and its use are
74+
covered by this License.
75+
76+
b) Accompany the object code with a copy of the GNU GPL and this license
77+
document.
78+
79+
4. Combined Works.
80+
81+
You may convey a Combined Work under terms of your choice that,
82+
taken together, effectively do not restrict modification of the
83+
portions of the Library contained in the Combined Work and reverse
84+
engineering for debugging such modifications, if you also do each of
85+
the following:
86+
87+
a) Give prominent notice with each copy of the Combined Work that
88+
the Library is used in it and that the Library and its use are
89+
covered by this License.
90+
91+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
92+
document.
93+
94+
c) For a Combined Work that displays copyright notices during
95+
execution, include the copyright notice for the Library among
96+
these notices, as well as a reference directing the user to the
97+
copies of the GNU GPL and this license document.
98+
99+
d) Do one of the following:
100+
101+
​ 0) Convey the Minimal Corresponding Source under the terms of this
102+
​ License, and the Corresponding Application Code in a form
103+
​ suitable for, and under terms that permit, the user to
104+
​ recombine or relink the Application with a modified version of
105+
​ the Linked Version to produce a modified Combined Work, in the
106+
​ manner specified by section 6 of the GNU GPL for conveying
107+
​ Corresponding Source.
108+
109+
​ 1) Use a suitable shared library mechanism for linking with the
110+
​ Library. A suitable mechanism is one that (a) uses at run time
111+
​ a copy of the Library already present on the user's computer
112+
​ system, and (b) will operate properly with a modified version
113+
​ of the Library that is interface-compatible with the Linked
114+
​ Version.
115+
116+
e) Provide Installation Information, but only if you would otherwise
117+
be required to provide such information under section 6 of the
118+
GNU GPL, and only to the extent that such information is
119+
necessary to install and execute a modified version of the
120+
Combined Work produced by recombining or relinking the
121+
Application with a modified version of the Linked Version. (If
122+
you use option 4d0, the Installation Information must accompany
123+
the Minimal Corresponding Source and Corresponding Application
124+
Code. If you use option 4d1, you must provide the Installation
125+
Information in the manner specified by section 6 of the GNU GPL
126+
for conveying Corresponding Source.)
127+
128+
5. Combined Libraries.
129+
130+
You may place library facilities that are a work based on the
131+
Library side by side in a single library together with other library
132+
facilities that are not Applications and are not covered by this
133+
License, and convey such a combined library under terms of your
134+
choice, if you do both of the following:
135+
136+
a) Accompany the combined library with a copy of the same work based
137+
on the Library, uncombined with any other library facilities,
138+
conveyed under the terms of this License.
139+
140+
b) Give prominent notice with the combined library that part of it
141+
is a work based on the Library, and explaining where to find the
142+
accompanying uncombined form of the same work.
143+
144+
6. Revised Versions of the GNU Lesser General Public License.
145+
146+
The Free Software Foundation may publish revised and/or new versions
147+
of the GNU Lesser General Public License from time to time. Such new
148+
versions will be similar in spirit to the present version, but may
149+
differ in detail to address new problems or concerns.
150+
151+
Each version is given a distinguishing version number. If the
152+
Library as you received it specifies that a certain numbered version
153+
of the GNU Lesser General Public License "or any later version"
154+
applies to it, you have the option of following the terms and
155+
conditions either of that published version or of any later version
156+
published by the Free Software Foundation. If the Library as you
157+
received it does not specify a version number of the GNU Lesser
158+
General Public License, you may choose any version of the GNU Lesser
159+
General Public License ever published by the Free Software Foundation.
160+
161+
If the Library as you received it specifies that a proxy can decide
162+
whether future versions of the GNU Lesser General Public License shall
163+
apply, that proxy's public statement of acceptance of any version is
164+
permanent authorization for you to choose that version for the
165+
Library.

README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# SonarQube plugin for Flutter / Dart
2+
3+
A plugin to enabable analysis of Dart and Flutter projects into SonarQube.
4+
5+
<p style="text-align: center">
6+
<img src="screenshots/dashboard.png" alt="dashboard.png" width="80%"/>
7+
<br/>
8+
<img src="screenshots/profile.png" alt="profile" width="300"/>
9+
</p>
10+
11+
## Features
12+
13+
| Feature | Supported |
14+
|------------|------------------------|
15+
| Size | YES |
16+
| Issues | YES ([dartanalyer](https://dart.dev/tools/dartanalyzer) rules)|
17+
| Tests | YES |
18+
| Coverage | YES |
19+
| Complexity | NO |
20+
| Syntax | NO |
21+
22+
The plugin is compatible with sonarQube 6.7+.
23+
24+
## Download
25+
26+
Checkout the [Releases](https://github.com/insideapp-oss/sonar-flutter/releases) page.
27+
28+
Changelog is available [here](https://github.com/insideapp-oss/sonar-flutter/blob/develop/CHANGELOG.md).
29+
30+
## Prerequisites
31+
32+
### Flutter SDK
33+
34+
Install Flutter as explained on the official documentaiton page.
35+
36+
[Installation instructions](https://flutter.dev/docs/get-started/install)
37+
38+
### Dart
39+
40+
Dart is downloaded by the Flutter SDK in **$FLUTTER_HOME/bin/cache/dart-sdk**, however command lines are not on the path by default (dartanalyzer must be on the path).
41+
42+
It is recommanded to install Dart SDK separately as explained here : [Install the Dart SDK](https://dart.dev/get-dart) for more reliability in a CI/CD environement.
43+
44+
### sonar-scanner (requires Java)
45+
46+
Install sonar-scanner as explained in the official documentation.
47+
48+
[Installation instructions](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/)
49+
50+
51+
## Installation (on the server)
52+
53+
- Download the plugin binary into the **$SONARQUBE_HOME/extensions/plugins** directory.
54+
- Restart the server.
55+
56+
## Project configuration
57+
58+
Create a **sonar-project.properties** file at the root with this content :
59+
60+
# Project identification
61+
sonar.projectKey=flutter_rocks
62+
sonar.projectName=Flutter Rocks
63+
sonar.projectVersion=1.0
64+
65+
# Source code location.
66+
# Path is relative to the sonar-project.properties file. Defaults to .
67+
# Use commas to specify more than one folder.
68+
sonar.sources=lib
69+
sonar.tests=test
70+
71+
# Encoding of the source code. Default is default system encoding.
72+
sonar.sourceEncoding=UTF-8
73+
74+
*For a complete list of available options, please refer to the [SonarQube documentation](https://docs.sonarqube.org/latest/analysis/analysis-parameters/).*
75+
76+
77+
## Run analysis
78+
79+
Use the following commands from the root folder to start an analysis:
80+
81+
# Download dependencies
82+
flutter pub get
83+
# Run tests
84+
flutter test --machine > tests.output
85+
# Compute coverage (--machine and --coverage cannot be run at once...)
86+
flutter test --coverage
87+
# Run the analysis and publish to the SonarQube server
88+
sonar-scanner
89+
90+
## Contributing
91+
92+
Any help is welcome, and PRs will be greatly appreciated!
93+
94+
95+
## License
96+
97+
SonarQube Plugin for Flutter / Dart is released under the GNU LGPL v3 license. See the [LICENSE](https://github.com/insideapp-oss/sonar-flutter/blob/develop/LICENSE) file for more information.

build-and-deploy.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
# Build and install snapshot plugin in Sonar
3+
4+
# Build first and check status
5+
mvn clean license:format install
6+
if [ "$?" != 0 ]; then
7+
echo "ERROR - Java build failed!" 1>&2
8+
exit $?
9+
fi
10+
11+
# Deploy new version of plugin in Sonar dir
12+
rm sonar-flutter-plugin/target/*sources.jar
13+
rm $SONARQUBE_HOME/extensions/plugins/sonar-flutter*
14+
cp sonar-flutter-plugin/target/sonar-flutter*.jar $SONARQUBE_HOME/extensions/plugins
15+
rm $SONARQUBE_HOME/extensions/plugins/*sources.jar
16+
17+
# Stop/start Sonar
18+
unset GEM_PATH GEM_HOME
19+
$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh stop
20+
$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh start
21+

dart-lang/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>sonar-flutter</artifactId>
7+
<groupId>fr.insideapp.sonarqube</groupId>
8+
<version>0.1.0</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>dart-lang</artifactId>
13+
14+
15+
</project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* SonarQube Flutter Plugin
3+
* Copyright (C) 2020 inside|app
4+
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
package fr.insideapp.sonarqube.dart.lang;
21+
22+
import org.sonar.api.config.Configuration;
23+
import org.sonar.api.resources.AbstractLanguage;
24+
25+
26+
public class Dart extends AbstractLanguage {
27+
public static final String KEY = "dart";
28+
private final Configuration config;
29+
30+
public Dart(Configuration config) {
31+
super(KEY, "Dart");
32+
this.config = config;
33+
}
34+
35+
public String[] getFileSuffixes() {
36+
return new String[]{"dart"};
37+
}
38+
}

0 commit comments

Comments
 (0)