Skip to content

Commit 7301f7a

Browse files
committed
introduce PMD check
1 parent ebf67e0 commit 7301f7a

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed

changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[SNAPSHOT]
2+
* add PMD checks on compile
3+
14
[6.5.1]
25
* cleanup deprecates methods
36

pmd.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="ScribeJava PMD ruleset"
3+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
6+
7+
<description>
8+
This ruleset defines the PMD rules for project "ScribeJava".
9+
</description>
10+
11+
</ruleset>

pom.xml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<version>3.8.0</version>
148148
<configuration>
149149
<encoding>UTF-8</encoding>
150-
<release>7</release>
150+
<release>${java.release}</release>
151151
<showDeprecation>true</showDeprecation>
152152
</configuration>
153153
</plugin>
@@ -225,9 +225,58 @@
225225
</execution>
226226
</executions>
227227
</plugin>
228+
<plugin>
229+
<groupId>org.apache.maven.plugins</groupId>
230+
<artifactId>maven-pmd-plugin</artifactId>
231+
<version>3.11.0</version>
232+
<dependencies>
233+
<dependency>
234+
<groupId>net.sourceforge.pmd</groupId>
235+
<artifactId>pmd-core</artifactId>
236+
<version>${pmdVersion}</version>
237+
</dependency>
238+
<dependency>
239+
<groupId>net.sourceforge.pmd</groupId>
240+
<artifactId>pmd-java</artifactId>
241+
<version>${pmdVersion}</version>
242+
</dependency>
243+
<dependency>
244+
<groupId>net.sourceforge.pmd</groupId>
245+
<artifactId>pmd-javascript</artifactId>
246+
<version>${pmdVersion}</version>
247+
</dependency>
248+
<dependency>
249+
<groupId>net.sourceforge.pmd</groupId>
250+
<artifactId>pmd-jsp</artifactId>
251+
<version>${pmdVersion}</version>
252+
</dependency>
253+
</dependencies>
254+
<configuration>
255+
<targetJdk>1.${java.release}</targetJdk>
256+
<linkXRef>false</linkXRef>
257+
<rulesets>
258+
<ruleset>../pmd.xml</ruleset>
259+
</rulesets>
260+
<verbose>true</verbose>
261+
<analysisCache>true</analysisCache>
262+
<includeTests>true</includeTests>
263+
</configuration>
264+
<executions>
265+
<execution>
266+
<goals>
267+
<goal>check</goal>
268+
</goals>
269+
</execution>
270+
</executions>
271+
</plugin>
228272
</plugins>
229273
</build>
230274

275+
<properties>
276+
<java.release>7</java.release>
277+
<pmdVersion>6.12.0</pmdVersion>
278+
</properties>
279+
231280
<profiles>
232281
<profile>
233282
<id>release-sign-artifacts</id>

scribejava-core/src/test/java/com/github/scribejava/core/oauth/OAuth20ServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void shouldProduceCorrectRequestSync() throws IOException, InterruptedExc
3939
final String authorize = base64Encoder.encodeToString(
4040
String.format("%s:%s", service.getApiKey(), service.getApiSecret()).getBytes(Charset.forName("UTF-8")));
4141

42-
assertEquals(OAuthConstants.BASIC + " " + authorize, map.get(OAuthConstants.HEADER));
42+
assertEquals(OAuthConstants.BASIC + ' ' + authorize, map.get(OAuthConstants.HEADER));
4343

4444
assertEquals("user1", map.get("query-username"));
4545
assertEquals("password1", map.get("query-password"));
@@ -65,7 +65,7 @@ public void shouldProduceCorrectRequestAsync() throws ExecutionException, Interr
6565
final String authorize = base64Encoder.encodeToString(
6666
String.format("%s:%s", service.getApiKey(), service.getApiSecret()).getBytes(Charset.forName("UTF-8")));
6767

68-
assertEquals(OAuthConstants.BASIC + " " + authorize, map.get(OAuthConstants.HEADER));
68+
assertEquals(OAuthConstants.BASIC + ' ' + authorize, map.get(OAuthConstants.HEADER));
6969

7070
assertEquals("user1", map.get("query-username"));
7171
assertEquals("password1", map.get("query-password"));

0 commit comments

Comments
 (0)