44 Commits

Author SHA1 Message Date
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
Daniel Martí
561d7833d1 checkstyle: Add indentation 2015-10-08 21:41:38 +02:00
Daniel Martí
3eb758f1b2 checkstyle: Add WhitespaceAround 2015-10-08 20:01:37 +02:00
Daniel Martí
95b53706f9 checkstyle: Add NoWhitespace{Before,After} 2015-10-08 19:49:43 +02:00
Daniel Martí
793788eadf checkstyle: enable and apply WhitespaceAfter 2015-10-08 19:44:31 +02:00
Daniel Martí
5736c70dc8 checkstyle: enable and apply FinalClass 2015-10-08 19:29:04 +02:00
Daniel Martí
2b0e6dade1 checkstyle: enable ModifierOrder and apply it 2015-10-08 18:59:41 +02:00
Daniel Martí
7c6888b5d4 checkstyle: remove rules that will never be used 2015-10-08 18:58:40 +02:00
Daniel Martí
1f973a7c88 checkstyle: Enable and apply AvoidNestedBlocks 2015-10-08 17:26:27 +02:00
Daniel Martí
999fa6eb21 Add checkstyle with a small config
It doesn't include all of the Android style checks as found in Android Studio,
but it's a start.

Bump Gradle to 2.7 because the checkstyle plugin in earlier versions is just
not good enough.
2015-10-08 17:26:27 +02:00