Skip to content

Commit

Permalink
NullAway #33
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Apr 14, 2018
1 parent 8455fc5 commit 8f11394
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ It supports:
* [_GoLint_](https://github.com/golang/lint)
* [_GoVet_](https://golang.org/cmd/vet/) Same format as GoLint.
* [_GoogleErrorProne_](https://github.com/google/error-prone)
* [_NullAway_](https://github.com/uber/NullAway)
* [_JSHint_](http://jshint.com/)
* _Lint_ A common XML format, used by different linters.
* [_JCReport_](https://github.com/jCoderZ/fawkez/wiki/JcReport)
Expand Down
29 changes: 29 additions & 0 deletions src/test/java/se/bjurr/violations/lib/GoogleErrorProneTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import static se.bjurr.violations.lib.reports.Parser.GOOGLEERRORPRONE;

import java.util.List;

import org.junit.Test;

import se.bjurr.violations.lib.model.Violation;

public class GoogleErrorProneTest {
Expand Down Expand Up @@ -80,4 +82,31 @@ public void testThatViolationsCanBeParsedMaven() {
assertThat(violation0.getStartLine()) //
.isEqualTo(20);
}

@Test
public void testThatViolationsCanBeParsedGradleNullAway() {
final String rootFolder = getRootFolder();

final List<Violation> actual =
violationsApi() //
.withPattern(".*/googleErrorProne/nullAway\\.log$") //
.inFolder(rootFolder) //
.findAll(GOOGLEERRORPRONE) //
.violations();

assertThat(actual) //
.hasSize(2);

final Violation violation0 = actual.get(0);
assertThat(violation0.getMessage()) //
.endsWith("nullaway )");
assertThat(violation0.getFile()) //
.isEqualTo("home/travis/build/leinardi/FloatingActionButtonSpeedDial/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java");
assertThat(violation0.getSeverity()) //
.isEqualTo(ERROR);
assertThat(violation0.getRule().get()) //
.isEqualTo("NullAway");
assertThat(violation0.getStartLine()) //
.isEqualTo(162);
}
}
11 changes: 11 additions & 0 deletions src/test/resources/googleErrorProne/nullAway.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:sample:compileReleaseNdk NO-SOURCE
:sample:processReleaseJavaRes NO-SOURCE
/home/travis/build/leinardi/FloatingActionButtonSpeedDial/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java:162: error: [NullAway] initializer method does not guarantee @NonNull field mLabel is initialized along all control-flow paths (remember to check for exceptions or early returns).
public Builder(@IdRes int id, @DrawableRes int fabImageResource) {
^
(see http://t.uber.com/nullaway )
/home/travis/build/leinardi/FloatingActionButtonSpeedDial/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java:175: error: [NullAway] initializer method does not guarantee @NonNull field mLabel is initialized along all control-flow paths (remember to check for exceptions or early returns).
public Builder(@IdRes int id, @Nullable Drawable drawable) {
^
(see http://t.uber.com/nullaway )
2 errors

0 comments on commit 8f11394

Please sign in to comment.