
Tell the Jackson JSON parser to ignore App/Apk fields that should never come from the index, but instead are set locally to keep track of the current state of things on the device. There are two forms of tests to enforce that the proper things get ignored. It is not possible to do this with decorators alone, so I chose to use @JsonIgnore and leave the variables we want filled in undecorated. Also, all of the instance variables in Apk/App/Repo should come directly from the index metadata so that they are pure data classes. Currently some state info is stored in them, those are decorated with @JsonIgnore. The tests then include lists of accepted and ignored properties, and anything that is not in those lists will cause the tests to fail. So if someone is adding a new instance variable, they will get a fail until the tests are updated. One set of tests actually writes blank instances out as JSON since that's the easiest test to write, and Jackson treats @JsonIgnore the same in both directions. Then there is another test that reads a JSON file with added, unsupported values to make sure that they are properly ignored.
133 lines
5.8 KiB
XML
133 lines
5.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
<!DOCTYPE module PUBLIC
|
|
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
|
|
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
|
<module name="Checker">
|
|
|
|
<property name="charset" value="UTF-8"/>
|
|
|
|
<module name="FileTabCharacter" />
|
|
|
|
<module name="RegexpSingleline">
|
|
<property name="format" value="\s+$" />
|
|
<property name="message" value="Line has trailing spaces." />
|
|
</module>
|
|
|
|
<module name="TreeWalker">
|
|
|
|
<module name="ConstantName">
|
|
<property name="format" value="^[A-Z_][A-Z0-9]*(_[A-Z0-9]+)*$"/>
|
|
</module>
|
|
<module name="LocalFinalVariableName" />
|
|
<module name="LocalVariableName" />
|
|
<module name="MemberName">
|
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
|
</module>
|
|
<module name="MethodName" />
|
|
<module name="PackageName" />
|
|
<module name="ParameterName" />
|
|
<module name="StaticVariableName" />
|
|
<module name="TypeName" />
|
|
<module name="MethodTypeParameterName" />
|
|
<module name="InterfaceTypeParameterName" />
|
|
<module name="ClassTypeParameterName" />
|
|
|
|
<module name="AvoidStarImport" />
|
|
<module name="AvoidStaticImport">
|
|
<property name="excludes"
|
|
value="org.fdroid.fdroid.Assert.*, org.assertj.core.api.Assertions.*, org.junit.Assert.*, org.junit.Assume.*, org.junit.internal.matchers.ThrowableMessageMatcher.*, org.hamcrest.core.IsNot.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.springframework.boot.configurationprocessor.ConfigurationMetadataMatchers.*, org.springframework.boot.configurationprocessor.TestCompiler.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*, org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*, org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo" />
|
|
</module>
|
|
<module name="RedundantImport" />
|
|
<module name="UnusedImports" />
|
|
<module name="OuterTypeFilename" />
|
|
|
|
<module name="Indentation">
|
|
<property name="basicOffset" value="4"/>
|
|
<property name="braceAdjustment" value="0"/>
|
|
<property name="caseIndent" value="4"/>
|
|
<property name="throwsIndent" value="8"/>
|
|
<property name="lineWrappingIndentation" value="8"/>
|
|
<property name="arrayInitIndent" value="4"/>
|
|
</module>
|
|
<module name="CommentsIndentation"/>
|
|
<module name="EmptyLineSeparator">
|
|
<property name="allowNoEmptyLineBetweenFields" value="true" />
|
|
<property name="allowMultipleEmptyLines" value="false" />
|
|
</module>
|
|
<module name="SeparatorWrap">
|
|
<property name="tokens" value="DOT" />
|
|
<property name="option" value="nl"/>
|
|
</module>
|
|
<module name="SeparatorWrap">
|
|
<property name="tokens" value="COMMA"/>
|
|
<property name="option" value="EOL"/>
|
|
</module>
|
|
<module name="NoLineWrap"/>
|
|
|
|
<module name="OneTopLevelClass" />
|
|
<module name="OneStatementPerLine" />
|
|
|
|
<module name="EmptyBlock">
|
|
<property name="option" value="TEXT"/>
|
|
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
|
</module>
|
|
|
|
<module name="EmptyForIteratorPad" />
|
|
<module name="GenericWhitespace" />
|
|
<module name="MethodParamPad" />
|
|
<module name="NoWhitespaceAfter" />
|
|
<module name="NoWhitespaceBefore" />
|
|
<!--<module name="OperatorWrap" />-->
|
|
<module name="ParenPad" />
|
|
<module name="TypecastParenPad" />
|
|
<module name="WhitespaceAfter" />
|
|
<module name="WhitespaceAround" />
|
|
<module name="UnnecessaryParentheses" />
|
|
|
|
<module name="ModifierOrder" />
|
|
<module name="RedundantModifier" />
|
|
<module name="AnnotationLocation" />
|
|
|
|
<module name="AvoidNestedBlocks" />
|
|
<module name="LeftCurly">
|
|
<property name="maxLineLength" value="100"/>
|
|
</module>
|
|
<module name="NeedBraces">
|
|
<property name="allowSingleLineStatement" value="true"/>
|
|
</module>
|
|
<module name="RightCurly"/>
|
|
<module name="RightCurly">
|
|
<property name="option" value="alone"/>
|
|
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
|
|
</module>
|
|
|
|
<module name="EmptyStatement" />
|
|
<module name="IllegalInstantiation" />
|
|
<module name="InnerAssignment" />
|
|
<module name="DefaultComesLast" />
|
|
<module name="FallThrough" />
|
|
|
|
<module name="FinalClass" />
|
|
|
|
<module name="ArrayTypeStyle" />
|
|
<module name="ArrayTrailingComma" />
|
|
<module name="UpperEll" />
|
|
|
|
<module name="StringLiteralEquality" />
|
|
<module name="EqualsAvoidNull" />
|
|
|
|
<module name="IllegalTokenText">
|
|
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
|
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
|
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
|
|
</module>
|
|
<module name="AvoidEscapedUnicodeCharacters">
|
|
<property name="allowEscapesForControlCharacters" value="true"/>
|
|
<property name="allowByTailComment" value="true"/>
|
|
<property name="allowNonPrintableEscapes" value="true"/>
|
|
</module>
|
|
|
|
</module>
|
|
|
|
</module>
|