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 .. - cd ..
- ./gradlew build - ./gradlew build
- ./gradlew checkstyle - ./gradlew checkstyle
- ./gradlew pmd
- echo no | android create avd --force -n fcl-test -t android-10 -b armeabi - 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 & - emulator -force-32bit -avd fcl-test -no-skin -no-audio -no-window &
- ./tools/wait-for-emulator - ./tools/wait-for-emulator

View File

@ -1,6 +1,7 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'witness' apply plugin: 'witness'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
apply plugin: 'pmd'
repositories { repositories {
jcenter() jcenter()
@ -203,11 +204,29 @@ task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml") configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src', 'test/src' source 'src', 'test/src'
include '**/*.java' include '**/*.java'
exclude '**/gen/**'
classpath = files() 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 // This person took the example code below from another blogpost online, however
// I lost the reference to it: // I lost the reference to it:
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation // http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation

View File

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

View File

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