Skip to content

Commit 8ae924b

Browse files
committed
Merge remote-tracking branch 'origin/1.1.0' into 1.1.0
2 parents 81cb99a + f269e70 commit 8ae924b

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ hs_err_pid*
2828
# Gradle
2929
.gradle
3030
build
31+
32+
# Checkstyle
33+
checkstyle.xml
34+
checkstyle-report.xml

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,25 @@ Custom Checkstyle checks for Android projects.
88

99
## Checks
1010

11-
| Check | Description | Level |
12-
| --- | --- | --- |
13-
| `AndroidViewFieldNameCheck` | Check Android view field name (example: for `TextView` variable's name must be starts with `tv`) | `Error` |
14-
| `ContextFirstParameterCheck` | Check Context as first parameter in a class constructor or in an arguments list | `Error` |
15-
| `MethodObjectReturnAnnotationCheck` | Check annotation for a method with return values (by default it is `@NonNull` and `@Nullable`) | `Error` |
16-
| `MethodParametersAnnotationCheck` | Check annotation for an argument in a class constructor or a method (by default it is `@NonNull` and `@Nullable`) | `Error` |
11+
| Check | Description |
12+
| --- | --- |
13+
| `AndroidViewFieldNameCheck` | Check Android view field name (example: for `TextView` variable's name must be starts with `tv`) |
14+
| `ContextFirstParameterCheck` | Check Context as first parameter in a class constructor or in an arguments list |
15+
| `MethodObjectReturnAnnotationCheck` | Check annotation for a method with return values (by default it is `@NonNull` and `@Nullable`) |
16+
| `MethodParametersAnnotationCheck` | Check annotation for an argument in a class constructor or a method (by default it is `@NonNull` and `@Nullable`) |
1717

1818
## Installation
1919

2020
### Gradle
2121

22+
Add `https://jitpack.io` as Maven repository to `build.gradle` (needs for downloading dependencies from GitHub):
23+
24+
```groovy
25+
repositories {
26+
maven { url "https://jitpack.io" }
27+
}
28+
```
29+
2230
If you are using [Checkstyle plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html) for Gradle, add
2331
checks project as dependency in the `dependencies` section in the `build.gradle`:
2432

@@ -32,16 +40,16 @@ Add to `TreeWalker` module:
3240

3341
```xml
3442
<module name="com.smlnskgmail.jaman.checkstyle.checks.AndroidViewFieldNameCheck">
35-
<property name="id" value="AndroidViewFieldNameCheck"/>
43+
<property name="id" value="AndroidViewFieldNameCheck" />
3644
</module>
3745
<module name="com.smlnskgmail.jaman.checkstyle.checks.ContextFirstParameterCheck">
38-
<property name="id" value="ContextFirstParameterCheck"/>
46+
<property name="id" value="ContextFirstParameterCheck" />
3947
</module>
4048
<module name="com.smlnskgmail.jaman.checkstyle.checks.MethodObjectReturnAnnotationCheck">
41-
<property name="id" value="MethodObjectReturnAnnotationCheck"/>
49+
<property name="id" value="MethodObjectReturnAnnotationCheck" />
4250
</module>
4351
<module name="com.smlnskgmail.jaman.checkstyle.checks.MethodParametersAnnotationCheck">
44-
<property name="id" value="MethodParametersAnnotationCheck"/>
52+
<property name="id" value="MethodParametersAnnotationCheck" />
4553
</module>
4654
```
4755

build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ checkstyle {
1414

1515
def checkstyleConfigPath = "$rootDir/checkstyle.xml"
1616
def checkstyleConfig = new File(checkstyleConfigPath)
17-
new URL(
18-
"https://raw.githubusercontent.com/fartem/repository-rules/master/rules/java/checkstyle/checkstyle.xml"
19-
).withInputStream {
20-
i -> checkstyleConfig.withOutputStream {
21-
it << i
17+
if (!checkstyleConfig.exists()) {
18+
new URL(
19+
"https://raw.githubusercontent.com/fartem/repository-rules/master/rules/java/checkstyle/checkstyle.xml"
20+
).withInputStream {
21+
i -> checkstyleConfig.withOutputStream {
22+
it << i
23+
}
2224
}
2325
}
2426

0 commit comments

Comments
 (0)