Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: Add absolutePaths configuration property. #96

Merged
merged 1 commit into from
Dec 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ class CodeQualityToolsPlugin implements Plugin<Project> {
}
}

if (extension.lint.absolutePaths != null) {
subProject.android.lintOptions {
absolutePaths = extension.lint.absolutePaths
}
}

if (extension.lint.baselineFileName != null) {
subProject.android.lintOptions {
baseline subProject.file(extension.lint.baselineFileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ class CodeQualityToolsPluginExtension {
* @since 0.5.0
*/
String baselineFileName = null

/**
* Returns whether lint should use absolute paths or not
* @since 0.9.0
*/
Boolean absolutePaths
}

static class Ktlint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CodeQualityToolsPluginLintTest extends CommonCodeQualityToolsTest {
assert androidAppProject.android.lintOptions.abortOnError == extension.lint.abortOnError
assert androidAppProject.android.lintOptions.checkAllWarnings == extension.lint.checkAllWarnings
assert androidAppProject.android.lintOptions.textReport == extension.lint.textReport
assert androidAppProject.android.lintOptions.absolutePaths
assert androidAppProject.android.lintOptions.baselineFile == androidAppProject.file("baseline.xml")
assert androidAppProject.android.lintOptions.textOutput.toString() == extension.lint.textOutput

Expand All @@ -61,6 +62,7 @@ class CodeQualityToolsPluginLintTest extends CommonCodeQualityToolsTest {
assert androidLibraryProject.android.lintOptions.abortOnError == extension.lint.abortOnError
assert androidLibraryProject.android.lintOptions.checkAllWarnings == extension.lint.checkAllWarnings
assert androidLibraryProject.android.lintOptions.textReport == extension.lint.textReport
assert androidLibraryProject.android.lintOptions.absolutePaths
assert androidLibraryProject.android.lintOptions.baselineFile == androidLibraryProject.file("baseline.xml")
assert androidLibraryProject.android.lintOptions.textOutput.toString() == extension.lint.textOutput
}
Expand Down Expand Up @@ -94,6 +96,17 @@ class CodeQualityToolsPluginLintTest extends CommonCodeQualityToolsTest {
assert androidLibraryProject.android.lintOptions.checkAllWarnings == extension.lint.checkAllWarnings
}

@Test void absolutePaths() {
def extension = new CodeQualityToolsPluginExtensionForTests()
extension.lint.absolutePaths = false

assert addLint(androidAppProject, extension)
assert androidAppProject.android.lintOptions.absolutePaths == extension.lint.absolutePaths

assert addLint(androidLibraryProject, extension)
assert androidLibraryProject.android.lintOptions.absolutePaths == extension.lint.absolutePaths
}

@Test void failEarlyFalse() {
def extension = new CodeQualityToolsPluginExtensionForTests()
extension.failEarly = false
Expand Down