Skip to content

Instantly share code, notes, and snippets.

View dmytrodanylyk's full-sized avatar

Dmytro Danylyk dmytrodanylyk

View GitHub Profile
apply plugin: 'pmd'
task pmd(type: Pmd) {
ruleSetFiles = files("$project.rootDir/tools/rules-pmd.xml")
source = fileTree('src/main/java/')
reports {
xml.enabled = false
html.enabled = true
html.destination = "$project.buildDir/outputs/pmd/pmd.html"
<FindBugsFilter>
<Bug pattern="SF_SWITCH_NO_DEFAULT" />
<Bug pattern="SF_SWITCH_FALLTHROUGH" />
</FindBugsFilter>
// MainActivity.java
...
private void someMethod(int variable) {
switch (variable) {
case 1:
System.out.println("1");
case 2:
System.out.println("2");
apply plugin: 'com.android.application'
apply from: "$project.rootDir/tools/script-findbugs.gradle"
...
apply plugin: 'findbugs'
task findbugs(type: FindBugs) {
excludeFilter = file("$project.rootDir/tools/rules-findbugs.xml")
classes = fileTree("$project.buildDir/intermediates/classes/dev/debug/com/dd")
source = fileTree("$project.rootDir/src/main/java/com/dd/")
classpath = files()
reports {
xml.enabled = false
<?xml version="1.0" encoding="utf-8"?>
<lint>
<issue id="GoogleAppIndexingWarning" severity="ignore" />
</lint>
apply plugin: 'com.android.application'
apply from: "$project.rootDir/tools/script-lint.gradle"
...
android {
lintOptions {
lintConfig file("$project.rootDir/tools/rules-lint.xml")
htmlOutput file("$project.buildDir/outputs/lint/lint.html")
warningsAsErrors true
xmlReport false
}
}
@dmytrodanylyk
dmytrodanylyk / Test1.java
Last active March 6, 2018 12:57
Realm test
// Test 1
for (int i = 0; i < 10; i++) {
// spawn new thread which call queryNoTransaction()
}
void queryNoTransaction() {
try (Realm realm = Realm.getDefaultInstance()) {
long start = System.currentTimeMillis();
RealmResults<UserProfile> users = realm.where(UserProfile.class).findAll();
List<UserProfile> userCopy = realm.copyFromRealm(users);
# Add project specific ProGuard rules here.
-dontobfuscate
-dontoptimize
-ignorewarnings