Skip to content

Commit f148bbb

Browse files
author
Gilles Grousset
committed
Merge branch 'develop'
2 parents a6bdb73 + 541c14e commit f148bbb

File tree

69 files changed

+1238
-2237
lines changed

Some content is hidden

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

69 files changed

+1238
-2237
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# _SonarQube Plugin for Swift_ Changelog
22

3+
## v0.4.3
4+
- Added support for SonarQube 7.3
5+
36
## v0.4.2
47
- Fixed "rule does not exist" crash on Objective-C sensors
58

README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

commons/pom.xml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<artifactId>backelite-swift</artifactId>
2626
<groupId>com.backelite.sonarqube</groupId>
27-
<version>0.4.2</version>
27+
<version>0.4.3</version>
2828
</parent>
2929
<modelVersion>4.0.0</modelVersion>
3030

@@ -41,36 +41,15 @@
4141
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
4242
<artifactId>sslr-squid-bridge</artifactId>
4343
</dependency>
44-
<dependency>
45-
<groupId>commons-lang</groupId>
46-
<artifactId>commons-lang</artifactId>
47-
</dependency>
48-
<dependency>
49-
<groupId>commons-io</groupId>
50-
<artifactId>commons-io</artifactId>
51-
</dependency>
5244
<dependency>
5345
<groupId>ch.qos.logback</groupId>
5446
<artifactId>logback-classic</artifactId>
5547
</dependency>
56-
<dependency>
57-
<groupId>com.google.guava</groupId>
58-
<artifactId>guava</artifactId>
59-
</dependency>
60-
<dependency>
61-
<groupId>com.google.code.gson</groupId>
62-
<artifactId>gson</artifactId>
63-
</dependency>
6448
<dependency>
6549
<groupId>ant</groupId>
6650
<artifactId>ant</artifactId>
6751
</dependency>
6852

69-
<dependency>
70-
<groupId>com.googlecode.json-simple</groupId>
71-
<artifactId>json-simple</artifactId>
72-
</dependency>
73-
7453
<!-- Test dependencies -->
7554
<dependency>
7655
<groupId>junit</groupId>
@@ -111,6 +90,11 @@
11190
<groupId>org.slf4j</groupId>
11291
<artifactId>slf4j-api</artifactId>
11392
</dependency>
93+
<dependency>
94+
<groupId>commons-lang</groupId>
95+
<artifactId>commons-lang</artifactId>
96+
<version>2.6</version>
97+
</dependency>
11498

11599
</dependencies>
116100

commons/src/main/java/com/backelite/sonarqube/commons/Constants.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,5 @@
2121
* Created by gillesgrousset on 23/08/2018.
2222
*/
2323
public final class Constants {
24-
25-
// Common constants
26-
public static final String FALSE = "false";
27-
2824
public static final String PROPERTY_PREFIX = "sonar.swift";
29-
30-
public static final String TEST_FRAMEWORK_KEY = PROPERTY_PREFIX + ".testframework";
31-
public static final String TEST_FRAMEWORK_DEFAULT = "ghunit";
32-
3325
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,11 @@
1515
* You should have received a copy of the GNU Lesser General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
18-
package com.backelite.sonarqube.commons.surefire;
18+
package com.backelite.sonarqube.commons;
1919

2020
import org.sonar.api.batch.fs.FileSystem;
2121
import org.sonar.api.batch.fs.InputFile;
2222

23-
import javax.annotation.Nullable;
24-
25-
/**
26-
* Created by gillesgrousset on 28/08/2018.
27-
*/
2823
public interface TestFileFinder {
29-
30-
@Nullable
3124
InputFile getUnitTestResource(FileSystem fileSystem, String classname);
3225
}
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,20 @@
1515
* You should have received a copy of the GNU Lesser General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
18-
package com.backelite.sonarqube.commons.surefire;
18+
package com.backelite.sonarqube.commons;
1919

2020
import org.sonar.api.batch.fs.FileSystem;
2121
import org.sonar.api.batch.fs.InputFile;
2222

23-
import javax.annotation.Nullable;
2423
import java.util.ArrayList;
2524
import java.util.List;
2625

2726
public class TestFileFinders {
28-
2927
private static TestFileFinders instance;
30-
31-
3228
private final List<TestFileFinder> finders = new ArrayList<>();
33-
34-
private TestFileFinders() {
35-
36-
}
29+
private TestFileFinders() {}
3730

3831
public static synchronized TestFileFinders getInstance() {
39-
4032
if (instance == null) {
4133
instance = new TestFileFinders();
4234
}
@@ -47,9 +39,7 @@ public void addFinder(TestFileFinder finder) {
4739
finders.add(finder);
4840
}
4941

50-
@Nullable
51-
InputFile getUnitTestResource(FileSystem fileSystem, String classname) {
52-
42+
public InputFile getUnitTestResource(FileSystem fileSystem, String classname) {
5343
for (TestFileFinder finder : finders) {
5444
InputFile result = finder.getUnitTestResource(fileSystem, classname);
5545
if (result != null) {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* commons - Enables analysis of Swift and Objective-C projects into SonarQube.
3+
* Copyright © 2015 Backelite (${email})
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
package com.backelite.sonarqube.commons.surefire;
19+
20+
import org.codehaus.staxmate.SMInputFactory;
21+
import com.ctc.wstx.stax.WstxInputFactory;
22+
import java.io.File;
23+
import java.io.FileInputStream;
24+
import java.io.IOException;
25+
import javax.xml.stream.XMLInputFactory;
26+
import javax.xml.stream.XMLStreamException;
27+
import org.codehaus.staxmate.in.SMHierarchicCursor;
28+
29+
public class StaxParser {
30+
31+
private SMInputFactory inf;
32+
private SurefireStaxHandler streamHandler;
33+
34+
public StaxParser(UnitTestIndex index) {
35+
this.streamHandler = new SurefireStaxHandler(index);
36+
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
37+
if (xmlInputFactory instanceof WstxInputFactory) {
38+
WstxInputFactory wstxInputfactory = (WstxInputFactory) xmlInputFactory;
39+
wstxInputfactory.configureForLowMemUsage();
40+
wstxInputfactory.getConfig().setUndeclaredEntityResolver((String publicID, String systemID, String baseURI, String namespace) -> namespace);
41+
}
42+
this.inf = new SMInputFactory(xmlInputFactory);
43+
}
44+
45+
public void parse(File xmlFile) throws XMLStreamException {
46+
try(FileInputStream input = new FileInputStream(xmlFile)) {
47+
parse(inf.rootElementCursor(input));
48+
} catch (IOException e) {
49+
throw new XMLStreamException(e);
50+
}
51+
}
52+
53+
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException {
54+
try {
55+
streamHandler.stream(rootCursor);
56+
} finally {
57+
rootCursor.getStreamReader().closeCompletely();
58+
}
59+
}
60+
}

commons/src/main/java/com/backelite/sonarqube/commons/surefire/SurefireParser.java

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)