72 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
3d05363c31 enable Espresso tests with some basic UI tasks 2018-08-17 10:09:59 +02:00
Hans-Christoph Steiner
898c731fcc don't run checkstyle or pmd on zipsigner, the format is too different
If someone wants to clean this up, feel free...
2018-04-19 16:19:21 +02:00
Hans-Christoph Steiner
96fb01ca52 Merge branch 'error-prone' into 'master'
Configure error prone

fdroidclient!635
2018-02-13 20:30:23 +01:00
Hans-Christoph Steiner
a4d35244bc errorprone: All Disabled Checks As Warnings 2018-02-13 20:20:02 +01:00
Hans-Christoph Steiner
3c341b7e4b move errorprone config to its own gitlab CI job 2018-02-13 20:19:45 +01:00
Hans-Christoph Steiner
bb37a013a8 checkstyle: do not include URLs in line length checks 2018-02-06 00:17:43 +01:00
Hans-Christoph Steiner
91b67a9b39 gitlab-ci: add nightly repo to deploy builds as default enabled 2018-01-04 23:01:00 +01:00
Hans-Christoph Steiner
0983a6a0b0 gitlab-ci: nightly builds using fdroid nightly 2018-01-04 23:00:55 +01:00
Hans-Christoph Steiner
d4d9707631 on debug builds, set versionCode using DB_VERSION + commit count
This provides an automatic way to generate updates from each new debug
build, it is build from the developer's machine or via the nightly repo.
2017-11-23 10:55:13 +01:00
Hans-Christoph Steiner
f0438a67b1 gitlab-ci: push nightly builds to fdroid repo on gitlab
If a repo is set with the gitlab-ci Secret Variable DEBUG_KEYSTORE and
there is a repo named the same as this repo with -nightly appended,
then this will automatically generate an fdroid repo of each build
produced by gitlab-ci runs on the master branch.

closes fdroidserver#256
2017-10-11 23:48:12 +02:00
Hans-Christoph Steiner
48fd6d287d enforce max line length at 118
gitlab's diff views wrap badly when lines are longer than 118.  Android
Studio places a grey line in the UI at 120.

@SuppressWarnings("LineLength") is added to a bunch of files to prevent
making this commit huge.  People can remove that as they work on those
files, and fix the issues then.

I also ran Android Studio's default Ctrl-Alt-L code formatter, where it was
easy to do, and I was already in the file.
2017-06-06 16:12:23 +02:00
Hans-Christoph Steiner
40643855c4 do not let Jackson set instance vars that never come from index
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.
2017-03-31 09:09:31 +11:00
Peter Serwylo
4f7116fcfb Add checkstyle rule to catch usage of member variables prefixed with 'm' 2016-12-05 22:56:26 +11:00
Daniel Martí
8af44b1af5 checkstyle: bump to 7.0
Remove LITERAL_DO from the config in RightCurly as we want this:

        do {
            foo;
        } while (bar);

Not this:

        do {
            foo;
        }
        while (bar);

This went unnoticed as LITERAL_DO was broken in RightCurly in earlier
Checkstyle versions.
2016-07-04 11:31:41 +01:00
Peter Serwylo
53e74dcdbd Appease checkstyle for test code.
Like PMD, we also had to add a concession to allow static imports.
This time, it was achieved by moving the assertions to a more generally
named `Assert` class, and then allowing static imports from that.
2016-06-09 10:44:40 +10:00
Peter Serwylo
4e73d1e5e6 Finish porting tests to Robolectric, and appease PMD.
To appease PMD, we now have a three rulesets in `config/pmd/*.xml`:

 * `rules.xml`: The bulk of the rules, used by both main and test code.
 * `rules-main.xml`: Rules specific to the andoid client code.
 * `rules-test.xml`: Rules specific to test code.

The rationale is because checkstyle by default checks for "too many static
imports", which is a fair call. However in JUnit4 code, it is common to
import many `assert*` static methods.
2016-06-09 10:44:40 +10:00
Daniel Martí
c432bf1ea0 PMD: Enable most empty code rules 2016-05-12 13:34:20 +01:00
Daniel Martí
65e2931fe8 PMD: Enable UnnecessaryWrapperObjectCreation 2016-05-12 13:34:20 +01:00
Hans-Christoph Steiner
7fbdfaaae7 enable PMD's java-basic ruleset
* CollapsibleIfStatements is pedantic
* that one NOPMD is for debug logging, it'll go away

closes #623 https://gitlab.com/fdroid/fdroidclient/issues/623
2016-05-12 09:36:08 +02:00
Daniel Martí
78af79cd4f checkstyle: enable OneTopLevelClass
The only remaining error was ClipboardCompat, which was unnecessarily
exposing three top-level classes. Make the two implementation classes be
nested, private and static.
2016-05-07 21:28:06 +01:00
Daniel Martí
023a6d01bd PMD: Enable some extra boolean/logic rules 2016-04-29 19:22:30 +01:00
Daniel Martí
ac8d3ff600 PMD: Enable and obey UnnecessaryParentheses
This works on statements, not expressions, so it's a lot easier and
saner to obey than UselessParentheses.
2016-04-29 19:22:04 +01:00
Daniel Martí
e5bc365b64 PMD: Enable a bunch of strictexception rules
We already obey them.
2016-04-28 17:17:17 +01:00
Daniel Martí
50b2e6f7a5 PMD: Enable and obey SingularField 2016-04-23 17:27:22 +01:00
Daniel Martí
68db3ae353 PMD: Enable and obey ImmutableField 2016-04-23 17:27:22 +01:00
Daniel Martí
c746a49b15 PMD: Enable some design.xml rules we already obey 2016-04-23 17:27:22 +01:00
Daniel Martí
f655f49aee PMD: Enable and obey UnnecessaryConstructor 2016-04-23 16:17:55 +01:00
Daniel Martí
857b0ea1c7 PMD: Enable and obey AddEmptyString 2016-04-23 16:14:05 +01:00
Daniel Martí
5d3d8786e2 PMD: Enable and obey PrematureDeclaration 2016-04-23 16:06:41 +01:00
Daniel Martí
32c67d05ec PMD: XML config file, enable most of unnecessary 2016-04-23 15:59:04 +01:00
Hans-Christoph Steiner
9656de0147 remove checkstyle ExplicitInitialization check
"Variable explicitly initialized to 'false' (default value for its type)"

I never remember what the default init value of booleans are, so this error
is quite annoying to me, and I can't see the harm of this behavior.
checkstyle says: "So in this case, x gets initialized to 0 twice, and bar
gets initialized to null twice. So there is a minor inefficiency."
2016-03-29 10:57:55 +02:00
Hans-Christoph Steiner
538830d5a3 ignore checkstyle AvoidStaticImport for test frameworks
For whatever reason, both JUnit and Google recommend using static method
imports when writing tests.
2016-03-29 10:57:55 +02:00
Daniel Martí
17c731ef1d checkstyle: obey ConstantName 2016-02-17 15:59:04 +00:00
Daniel Martí
a6b804e93a checkstyle: obey NeedBraces on multi-line stmts
We still allow them in single-line statements, like:

	if (foo) bar;
	for (int i : ints) bar;

Everything else should use braces to help readability and avoid silly
human mistakes that might result in bugs.

These changes were completely automated via a python script.
2016-02-17 12:04:36 +00:00
Daniel Martí
6ab5299e40 checkstyle: clean up modules we'll never use 2016-01-06 21:51:23 +01:00
Daniel Martí
3a8051898a checkstyle: be more strict with curly rules 2015-12-29 22:18:38 +01:00
Daniel Martí
c1d4248723 checkstyle: Check comment indentation too 2015-12-29 22:10:19 +01:00
Daniel Martí
9efe173380 checkstyle: Finally add proper indentation checks
Somewhat painful conversion, but should go much smoother from here
onward.
2015-12-29 22:00:23 +01:00
Daniel Martí
dd4420965d checkstyle: Add more rules that we already obey 2015-12-29 21:43:29 +01:00
Daniel Martí
7ed03bdcba checkstyle: EmptyLineSeparator is now fixed 2015-12-29 12:59:21 +01:00
Daniel Martí
0f27374452 checkstyle: forbid inner assignments 2015-12-29 12:55:29 +01:00
Daniel Martí
8405ba7d87 checkstyle: proper multiple empty line check
Hopefully checkstyle could catch all of these on its own one day. For
now, help it via a multiline regex.
2015-11-30 11:30:49 +01:00
Daniel Martí
1e79b6d1d5 checkstyle: add TODO regarding func wrapping 2015-11-30 11:04:12 +01:00
Daniel Martí
098241c981 checkstyle: don't allow multiple empty lines 2015-11-30 10:40:35 +01:00
Daniel Martí
04e730c6bb checkstyle: add AnnotationLocation 2015-11-30 10:38:49 +01:00
Daniel Martí
1e8bbbd1f9 checkstyle: Add curly checks 2015-10-09 11:40:50 +02:00
Daniel Martí
8396eba8d9 checkstyle: Always wrap commas 2015-10-09 11:27:24 +02:00
Daniel Martí
6b573db3f4 checkstyle: Add more checks we already obey 2015-10-09 11:06:59 +02:00
Daniel Martí
65f292708c checkstyle: Add AvoidStaticImport
Plus bonus build fix (whoops).
2015-10-09 11:04:39 +02:00
Daniel Martí
2249ad59da checkstyle: Add StaticVariableName 2015-10-09 11:02:19 +02:00