Skip to content

Commit f65849c

Browse files
Hotfix 1.0.2 , allow tabs and slash in files
1 parent 0943e63 commit f65849c

File tree

11 files changed

+186
-9
lines changed

11 files changed

+186
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ If you are running behind an enterprise proxy, specify the java proxy options on
206206

207207
Validate that all is correct:
208208

209-
`mvn package -Prelease`
209+
`mvn clean package -Prelease`
210210

211211
Deploy:
212212

213-
`mvn deploy -Prelease`
213+
`mvn clean deploy -Prelease`
214214

its/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
77
<artifactId>dosonarapi</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

openapi-checks/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
77
<artifactId>dosonarapi</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

openapi-front-end/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
77
<artifactId>dosonarapi</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

openapi-test-tools/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
77
<artifactId>dosonarapi</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
1111
<artifactId>dosonarapi</artifactId>
12-
<version>1.0.1</version>
12+
<version>1.0.2</version>
1313
<packaging>pom</packaging>
1414

1515
<name>SonarOpenAPI</name>

sonar-openapi-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.apiaddicts.apitools.dosonarapi</groupId>
77
<artifactId>dosonarapi</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

sonar-openapi-plugin/src/main/java/org/apiaddicts/apitools/dosonarapi/plugin/OpenApiAnalyzer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,16 @@ private void scanFile(InputFile inputFile) {
149149

150150
/**
151151
* This method is required to avoid a parsing issue with yaml,
152-
* sometimes, when an empty line is followed by a comment, it breaks the parser
152+
* sometimes, when an empty line is followed by a comment, it breaks the parser,
153+
* it also replaces tabs by spaces to avoid another parsin error
153154
*
154155
* FIXME: Try to solve in the yaml parser lib
155156
*/
156157
private String getContent(InputFile inputFile) throws IOException {
157158
String [] lines = inputFile.contents().split("\n");
158159
for (int i = 1; i < lines.length; i++) {
160+
lines[i] = lines[i].replace("\t", " ");
161+
lines[i] = lines[i].replace("\\/", "/");
159162
if (!lines[i].trim().isEmpty()) continue;
160163
int n = lines[i-1].indexOf(lines[i-1].trim());
161164
if (n < 0) n = 0;

sonar-openapi-plugin/src/test/java/org/apiaddicts/apitools/dosonarapi/plugin/OpenApiScannerSensorTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,30 @@ public void parse_yaml_break_comment_ok() {
141141
assertThat(context.allAnalysisErrors()).hasSize(0);
142142
}
143143

144+
@Test
145+
public void parse_yaml_slash_ok() {
146+
inputFile("parse-error-slash.json");
147+
activeRules = (new ActiveRulesBuilder())
148+
.create(RuleKey.of(CheckList.REPOSITORY_KEY, ParsingErrorCheck.CHECK_KEY))
149+
.activate()
150+
.build();
151+
sensor().execute(context);
152+
assertThat(context.allIssues()).hasSize(0);
153+
assertThat(context.allAnalysisErrors()).hasSize(0);
154+
}
155+
156+
@Test
157+
public void parse_yaml_tabs_ok() {
158+
inputFile("parse-error-tabs.json");
159+
activeRules = (new ActiveRulesBuilder())
160+
.create(RuleKey.of(CheckList.REPOSITORY_KEY, ParsingErrorCheck.CHECK_KEY))
161+
.activate()
162+
.build();
163+
sensor().execute(context);
164+
assertThat(context.allIssues()).hasSize(0);
165+
assertThat(context.allAnalysisErrors()).hasSize(0);
166+
}
167+
144168
@Test
145169
public void cancelled_analysis() {
146170
InputFile inputFile = inputFile("file1.yaml");
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[
2+
{
3+
"provider_name": "Vimeo",
4+
"provider_url": "https:\/\/vimeo.com\/",
5+
"endpoints": [
6+
{
7+
"schemes": [
8+
"https:\/\/vimeo.com\/*",
9+
"https:\/\/vimeo.com\/album\/*\/video\/*",
10+
"https:\/\/vimeo.com\/channels\/*\/*",
11+
"https:\/\/vimeo.com\/groups\/*\/videos\/*",
12+
"https:\/\/vimeo.com\/ondemand\/*\/*",
13+
"https:\/\/player.vimeo.com\/video\/*"
14+
],
15+
"url": "https:\/\/vimeo.com\/api\/oembed.{format}",
16+
"discovery": true
17+
}
18+
]
19+
},
20+
{
21+
"provider_name": "Twitter",
22+
"provider_url": "http:\/\/www.twitter.com\/",
23+
"endpoints": [
24+
{
25+
"schemes": [
26+
"https:\/\/twitter.com\/*\/status\/*",
27+
"https:\/\/*.twitter.com\/*\/status\/*"
28+
],
29+
"url": "https:\/\/publish.twitter.com\/oembed"
30+
31+
}
32+
]
33+
},
34+
{
35+
"provider_name": "CollegeHumor",
36+
"provider_url": "http:\/\/www.collegehumor.com\/",
37+
"endpoints": [
38+
{
39+
"schemes": [
40+
"http:\/\/www.collegehumor.com\/video\/*"
41+
],
42+
"url": "http:\/\/www.collegehumor.com\/oembed.{format}",
43+
"discovery": true
44+
}
45+
]
46+
},
47+
{
48+
"provider_name": "Flickr",
49+
"provider_url": "http:\/\/www.flickr.com\/",
50+
"endpoints": [
51+
{
52+
"schemes": [
53+
"http:\/\/*.flickr.com\/photos\/*",
54+
"http:\/\/flic.kr\/p\/*"
55+
],
56+
"url": "http:\/\/www.flickr.com\/services\/oembed\/",
57+
"discovery": true
58+
}
59+
]
60+
},
61+
{
62+
"provider_name": "YouTube",
63+
"provider_url": "https://www.youtube.com/",
64+
"endpoints": [
65+
{
66+
"schemes": [
67+
"https://*.youtube.com/watch*",
68+
"https://*.youtube.com/v/*\"",
69+
"https://youtu.be/*"
70+
],
71+
"url": "https://www.youtube.com/oembed",
72+
"discovery": true
73+
}
74+
]
75+
}
76+
]

0 commit comments

Comments
 (0)