Commit Graph

59 Commits

Author SHA1 Message Date
Torsten Grote 2048d6f478 Add code style to repo and fix it 2023-06-09 17:24:58 +00:00
Hans-Christoph Steiner 12a677a225 purge unused ZipSigner code
This includes some references to the "BC" provider that now do not need to
be ported:
https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html
2023-05-25 11:58:01 +00:00
Hans-Christoph Steiner 2828bf1f9f
-Pstrict.release build flag to disable dev tools
Keep the release build as small as possible, so it is faster.  This also
makes it less important to track all the dev tool projects for security
issues, since they are disabled on release builds.
2022-12-20 20:59:59 +01:00
Torsten Grote c463b3c9ed Upgrade to Gradle 7 and Java 11 2022-05-18 12:52:55 +02:00
Hans-Christoph Steiner 8a573a7b59
vendor commons-codec to implement getFileHexDigest and more
Android includes a crippled version of commons-codec 1.3, which it will
silently use instead of any version included in an app.  So we are forced
to vendor it.

This comes from the tag "commons-codec-1.16-rc1":
https://github.com/apache/commons-codec/tree/commons-codec-1.16-rc1/src/main/java/org/apache/commons/codec

For more on this:
* https://github.com/ExCiteS/apache-commons-codec-shaded
* https://gitlab.com/fdroid/fdroidclient/-/merge_requests/1089#note_822501322
2022-01-26 19:24:29 +01:00
Hans-Christoph Steiner 3c22024d94 remove pedandic checkstyle error 2021-02-23 17:53:33 +01:00
Hans-Christoph Steiner 850b1cf414
fix checkstyle after androidx update !899 2020-07-15 15:02:34 +02:00
Hans-Christoph Steiner 1571e28f68 support swapping with removable storage on android-21+
This uses the new Storage Access Framework, which was required for
accessing files on the SD Card starting in android-19.  But the API
was really limited until android-21, and not really complete until
android-23 or even android-26.  So the levels of usability will vary a
lot based on how new the version of Android is.
2018-12-21 00:03:39 +01:00
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 bb37a013a8 checkstyle: do not include URLs in line length checks 2018-02-06 00:17:43 +01: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
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
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
Daniel Martí caa91186cc checkstyle: Add LocalFinalVariableName 2015-10-09 10:59:44 +02:00
Daniel Martí 6ee3dba3ea checkstyle: Add LocalVariableName 2015-10-09 10:56:50 +02:00
Daniel Martí b5f62c03cb checkstyle: Add MemberName 2015-10-09 10:55:27 +02:00
Daniel Martí 48b7096523 checkstyle: Enable some naming checks we obey 2015-10-09 10:50:13 +02:00
Daniel Martí bd68caa152 checkstyle: Add FallThrough
With bonus bugfix.
2015-10-08 23:33:29 +02:00
Daniel Martí 638daf83cf checkstyle: Add OneStatementPerLine
Also OneTopLevelClass, but we're not there yet
2015-10-08 22:29:32 +02:00
Daniel Martí d97319efb7 checkstyle: Add DefaultComesLast 2015-10-08 22:25:38 +02:00
Daniel Martí 7bbcbf25a6 checkstyle: Add EmptyLineSeparator 2015-10-08 22:23:10 +02:00
Daniel Martí f5352eaf28 checkstyle: Add ArrayTrailingComma 2015-10-08 22:15:51 +02:00
Daniel Martí 3f8875ab9c checkstyle: Add EqualsAvoidNull 2015-10-08 22:09:51 +02:00
Daniel Martí 174e37e4e0 checkstyle: Add ExplicitInitialization 2015-10-08 22:01:09 +02:00
Daniel Martí 38cc95b035 checkstyle: Add StringLiteralEquality 2015-10-08 21:53:02 +02:00
Daniel Martí 0a13cf5c63 checkstyle: Add UnnecessaryParentheses 2015-10-08 21:50:46 +02:00