Skip to content

Commit 925030c

Browse files
committed
Changed gradleLint task to lintGradle to deconflict short name with dependency-lock
1 parent ac9c55b commit 925030c

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ For multimodule projects, we recommend applying the plugin in an allprojects blo
6969

7070
### Running the linter
7171

72-
When `nebula.lint` is applied, build scripts will be automatically linted by a task called `gradleLint` after the last task in the task graph executes. Results are held until after the last task is ran, then reported in the console.
72+
When `nebula.lint` is applied, build scripts will be automatically linted by a task called `lintGradle` after the last task in the task graph executes. Results are held until after the last task is ran, then reported in the console.
7373

7474
![gradle-lint output](docs/images/lint-output.png)
7575

src/integTest/java/com/netflix/nebula/lint/plugin/GradleLintPluginSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class GradleLintPluginSpec extends IntegrationSpec {
4444
addSubproject('sub')
4545

4646
then:
47-
runTasksSuccessfully('gradleLint')
47+
runTasksSuccessfully('lintGradle')
4848
}
4949

5050
def 'run rules on multi-module project where one of the subprojects does not apply gradle lint'() {
@@ -65,7 +65,7 @@ class GradleLintPluginSpec extends IntegrationSpec {
6565
""")
6666

6767
then:
68-
runTasksSuccessfully('gradleLint')
68+
runTasksSuccessfully('lintGradle')
6969
}
7070

7171
def 'auto correct all violations on a single module project'() {

src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintPlugin.groovy

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,20 @@ class GradleLintPlugin implements Plugin<Project> {
1212
LintRuleRegistry.classLoader = getClass().classLoader
1313
def lintExt = project.extensions.create('gradleLint', GradleLintExtension)
1414

15-
// TODO
16-
// 1. Make gradleLint and fixGradleLint on root run against all subprojects
17-
// 2. Only automatically add root project's gradle lint the end of the build
18-
1915
if (project.rootProject == project) {
2016
project.tasks.create('fixGradleLint', GradleLintCorrectionTask)
21-
project.tasks.create('gradleLint', GradleLintTask)
17+
project.tasks.create('lintGradle', GradleLintTask)
2218
project.rootProject.apply plugin: GradleLintPlugin
2319
} else {
24-
project.tasks.create('gradleLint') // this task does nothing
20+
project.tasks.create('lintGradle') // this task does nothing
2521
project.tasks.create('fixGradleLint').finalizedBy project.rootProject.tasks.getByName('fixGradleLint')
2622
}
2723

2824
configureReportTask(project, lintExt)
2925

3026
// ensure that lint runs
3127
project.tasks.whenTaskAdded { task ->
32-
def rootLint = project.rootProject.tasks.getByName('gradleLint')
28+
def rootLint = project.rootProject.tasks.getByName('lintGradle')
3329
if (task != rootLint && !exemptTasks.contains(task.name)) {
3430
// when running a lint-eligible task on a subproject, we want to lint the whole project
3531
task.finalizedBy rootLint

src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintReportTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GradleLintReportTask extends DefaultTask implements VerificationTask, Repo
3030

3131
GradleLintReportTask() {
3232
reports = instantiator.newInstance(CodeNarcReportsImpl, this)
33-
finalizedBy 'gradleLint'
33+
finalizedBy 'lintGradle'
3434
}
3535

3636
@TaskAction

0 commit comments

Comments
 (0)