Merge branch 'pmd' into 'master'

Add PMD



See merge request !221
This commit is contained in:
Peter Serwylo 2016-03-04 22:14:22 +00:00
commit 018a8231d6
4 changed files with 23 additions and 3 deletions

View File

@ -8,6 +8,7 @@ test:
- cd ..
- ./gradlew build
- ./gradlew checkstyle
- ./gradlew pmd
- echo no | android create avd --force -n fcl-test -t android-10 -b armeabi
- emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window &
- ./tools/wait-for-emulator

View File

@ -1,6 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'witness'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
repositories {
jcenter()
@ -203,11 +204,29 @@ task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src', 'test/src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
pmd {
toolVersion = '5.4.1'
consoleOutput = true
}
task pmd(type: Pmd, dependsOn: assembleDebug) {
ruleSets = [
//'java-basic',
//'java-unusedcode',
'java-android',
'java-clone',
'java-finalizers',
'java-imports',
'java-migrating',
]
source 'src'
include '**/org/fdroid/**/*.java'
}
// This person took the example code below from another blogpost online, however
// I lost the reference to it:
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation

View File

@ -176,6 +176,7 @@ public class FDroidApp extends Application {
@TargetApi(9)
@Override
public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT >= 9 && BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
@ -187,7 +188,6 @@ public class FDroidApp extends Application {
.build());
}
updateLanguage();
super.onCreate();
ACRA.init(this);
// Needs to be setup before anything else tries to access it.

View File

@ -595,12 +595,12 @@ public class SwapService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
Utils.debugLog(TAG, "Destroying service, will disable swapping if required, and unregister listeners.");
disableAllSwapping();
Preferences.get().unregisterLocalRepoHttpsListeners(httpsEnabledListener);
LocalBroadcastManager.getInstance(this).unregisterReceiver(onWifiChange);
LocalBroadcastManager.getInstance(this).unregisterReceiver(receiveSwapStatusChanged);
super.onDestroy();
}
private Notification createNotification() {