Skip to content

Commit

Permalink
extra fixes SpaceAssignmentRule: handle scenario where group method c…
Browse files Browse the repository at this point in the history
…an belong to non gradle classes
  • Loading branch information
rpalcolea committed Jan 25, 2025
1 parent 468026d commit f296a88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class SpaceAssignmentRule extends ModelAwareGradleLintRule {
return dslStack().empty ||
dslStack().containsAll(['subprojects']) ||
dslStack().containsAll(['allprojects']) ||
dslStack().contains('configureEach') ||
dslStack().contains('tasks')
dslStack().contains('configureEach')
}

private void addViolation(MethodCallExpression call) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class SpaceAssignmentRuleSpec extends BaseIntegrationTestKitSpec {
if (matcher.find()) {
def x = matcher.group(1).replace(".", "/")
}
tasks.register('hello') {
doLast {
if (matcher.find()) {
def x = matcher.group(1).replace(".", "/")
}
}
}
"""

when:
Expand Down

0 comments on commit f296a88

Please sign in to comment.