diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..187ea46 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,43 @@ +> We LOVE to help with any issues or bug you have! + +> **Questions**: If you have questions about how to use Realm, please ask on [SO](http://stackoverflow.com/questions/ask?tags=realm) - we monitor the Realm tag. + +> **Feature Request**: Just fill in the first two sections below. + +> **Bugs**: To help you as fast as possible with an issue or bug please describe your issue and the steps you have taken to reproduce it in as many details as possible. +> +> Thanks for helping us help you :-) +> +> Remove this and above before submitting. + +#### Goal + +> What do you want to achieve? + +#### Expected Results + +> ? + +#### Actual Results + +> E.g. full stack trace with exception + +#### Steps & Code to Reproduce + +> Describe your current debugging efforts. + +#### Code Sample + +```java + +> Your code here. Bigger samples should ideally be as separate Android Studio project, +> in gists/repositories or privately at help@realm.io) + +``` + +#### Version of Realm and tooling +Realm version(s): ? + +Android Studio version: ? + +Which Android version and device: ? diff --git a/adapters/build.gradle b/adapters/build.gradle index 5ce8cd0..2e842a7 100644 --- a/adapters/build.gradle +++ b/adapters/build.gradle @@ -3,6 +3,9 @@ apply plugin: 'maven-publish' apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.jfrog.bintray' +apply plugin: 'findbugs' +apply plugin: 'pmd' +apply plugin: 'checkstyle' apply plugin: 'realm-android' android { @@ -33,6 +36,60 @@ dependencies { javadoc "io.realm:realm-annotations:${rootProject.realmVersion}" } +task findbugs(type: FindBugs) { + dependsOn assembleDebug + group = 'Verification' + + ignoreFailures = false + effort = "default" + reportLevel = "medium" + excludeFilter = file("${projectDir}/../config/findbugs/findbugs-filter.xml") + classes = files("${projectDir}/build/intermediates/classes") + source = fileTree('src/main/java/') + classpath = files() + reports { + xml.enabled = false + html.enabled = true + xml { + destination "$project.buildDir/findbugs/findbugs-output.xml" + } + html { + destination "$project.buildDir/findbugs/findbugs-output.html" + } + } +} + +task pmd(type: Pmd) { + group = 'Verification' + print "${projectDir}" + source = fileTree('src/main/java') + ruleSetFiles = files("${projectDir}/../config/pmd/ruleset.xml") + ruleSets = [] // This needs to be here to remove the default checks + + reports { + xml.enabled = false + html.enabled = true + } +} + +task checkstyle(type: Checkstyle) { + group = 'Test' + + source 'src' + include '**/*.java' + exclude '**/gen/**' + exclude '**/R.java' + exclude '**/BuildConfig.java' + + def configProps = ['proj.module.dir': projectDir.absolutePath] + configProperties configProps + + configFile = file("${projectDir}/../config/checkstyle/checkstyle.xml") + + // empty classpath + classpath = files() +} + task javadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += configurations.javadoc diff --git a/adapters/src/androidTest/java/io/realm/RealmBaseAdapterTests.java b/adapters/src/androidTest/java/io/realm/RealmBaseAdapterTests.java index 3ea9d96..24fb319 100644 --- a/adapters/src/androidTest/java/io/realm/RealmBaseAdapterTests.java +++ b/adapters/src/androidTest/java/io/realm/RealmBaseAdapterTests.java @@ -35,6 +35,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @RunWith(AndroidJUnit4.class) @@ -222,4 +223,5 @@ public void testNullToNonNullResults() { assertEquals(TEST_DATA_SIZE, realmAdapter.getCount()); } + } diff --git a/adapters/src/androidTest/java/io/realm/entity/AllJavaTypes.java b/adapters/src/androidTest/java/io/realm/entity/AllJavaTypes.java index b69f1c5..69b2ac4 100644 --- a/adapters/src/androidTest/java/io/realm/entity/AllJavaTypes.java +++ b/adapters/src/androidTest/java/io/realm/entity/AllJavaTypes.java @@ -27,19 +27,19 @@ public class AllJavaTypes extends RealmObject { public static final String CLASS_NAME = "AllJavaTypes"; - public static String FIELD_IGNORED = "fieldIgnored"; - public static String FIELD_STRING = "fieldString"; - public static String FIELD_SHORT = "fieldShort"; - public static String FIELD_INT = "fieldInt"; - public static String FIELD_LONG = "fieldLong"; - public static String FIELD_BYTE = "fieldByte"; - public static String FIELD_FLOAT = "fieldFloat"; - public static String FIELD_DOUBLE = "fieldDouble"; - public static String FIELD_BOOLEAN = "fieldBoolean"; - public static String FIELD_DATE = "fieldDate"; - public static String FIELD_BINARY = "fieldBinary"; - public static String FIELD_OBJECT = "fieldObject"; - public static String FIELD_LIST = "fieldList"; + public static final String FIELD_IGNORED = "fieldIgnored"; + public static final String FIELD_STRING = "fieldString"; + public static final String FIELD_SHORT = "fieldShort"; + public static final String FIELD_INT = "fieldInt"; + public static final String FIELD_LONG = "fieldLong"; + public static final String FIELD_BYTE = "fieldByte"; + public static final String FIELD_FLOAT = "fieldFloat"; + public static final String FIELD_DOUBLE = "fieldDouble"; + public static final String FIELD_BOOLEAN = "fieldBoolean"; + public static final String FIELD_DATE = "fieldDate"; + public static final String FIELD_BINARY = "fieldBinary"; + public static final String FIELD_OBJECT = "fieldObject"; + public static final String FIELD_LIST = "fieldList"; @Ignore private String fieldIgnored; @Index private String fieldString; diff --git a/config/checkstyle/checkstyle-suppressions.xml b/config/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 0000000..6e71089 --- /dev/null +++ b/config/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..b390372 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/findbugs/findbugs-filter.xml b/config/findbugs/findbugs-filter.xml new file mode 100644 index 0000000..06476e3 --- /dev/null +++ b/config/findbugs/findbugs-filter.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/pmd/ruleset.xml b/config/pmd/ruleset.xml new file mode 100644 index 0000000..a3596aa --- /dev/null +++ b/config/pmd/ruleset.xml @@ -0,0 +1,17 @@ + + + + + Realm PMD ruleset + + + + + + + + + \ No newline at end of file