Don't implicitly pick up lint-baseline.xml
lintable modules currently pick up files named "lint-baseline.xml" to use as the lint baseline implicitly. This is confusing because you could end up using the baseline files in more modules than intended. Lint also has a feature where it requests you remove unnecessary findings from the baseline file, so something could be necessary for one module, but unnecessary for another that accidentally picked up the baseline. All modules that used to pick up the baseline implicitly have been fixed to specify it explicitly already. Fixes: 272769514 Test: Presubmits Change-Id: Id17202e2d119b87ab82c18cb35410b93ed8d5071
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
func TestJavaLint(t *testing.T) {
|
||||
func TestJavaLintDoesntUseBaselineImplicitly(t *testing.T) {
|
||||
ctx, _ := testJavaWithFS(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
@@ -40,30 +40,8 @@ func TestJavaLint(t *testing.T) {
|
||||
foo := ctx.ModuleForTests("foo", "android_common")
|
||||
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml") {
|
||||
t.Error("did not pass --baseline flag")
|
||||
}
|
||||
}
|
||||
|
||||
func TestJavaLintWithoutBaseline(t *testing.T) {
|
||||
ctx, _ := testJavaWithFS(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: [
|
||||
"a.java",
|
||||
"b.java",
|
||||
"c.java",
|
||||
],
|
||||
min_sdk_version: "29",
|
||||
sdk_version: "system_current",
|
||||
}
|
||||
`, map[string][]byte{})
|
||||
|
||||
foo := ctx.ModuleForTests("foo", "android_common")
|
||||
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
|
||||
if strings.Contains(*sboxProto.Commands[0].Command, "--baseline") {
|
||||
t.Error("passed --baseline flag for non existent file")
|
||||
if strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml") {
|
||||
t.Error("Passed --baseline flag when baseline_filename was not set")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user