File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
buildSrc/src/main/kotlin/software/aws/toolkits/gradle/resources Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin.VERIFICATION_GROUP
14
14
import java.time.Instant
15
15
16
16
open class ValidateMessages : DefaultTask () {
17
+ private companion object {
18
+ const val COPYRIGHT_HEADER_LINES = 2
19
+ }
17
20
@InputFiles
18
21
val paths: ConfigurableFileCollection = project.objects.fileCollection()
19
22
@@ -35,18 +38,20 @@ open class ValidateMessages : DefaultTask() {
35
38
fileLines
36
39
// filter out blank lines and comments
37
40
.filter { it.isNotBlank() && it.trim().firstOrNull() != ' #' }
38
- .mapNotNull {
41
+ .mapIndexed { lineNumber, it ->
39
42
if (it.contains(" =" )) {
40
43
it
41
44
} else {
42
- logger.warn(""" "$filePath contains invalid message missing a '=': "$it """" )
45
+ logger.error(""" "$filePath :${lineNumber + COPYRIGHT_HEADER_LINES } contains invalid message missing a '=': "$it """" )
46
+ hasError = true
43
47
null
44
48
}
45
49
}
50
+ .filterNotNull()
46
51
.map { it.split(" =" ).first() }
47
- .reduce { item1, item2 ->
52
+ .reduceIndexed { lineNumber, item1, item2 ->
48
53
if (item1 > item2) {
49
- logger.error(""" $filePath is not sorted:"$item1 " > "$item2 """" )
54
+ logger.error(""" $filePath : ${lineNumber + COPYRIGHT_HEADER_LINES } is not sorted:"$item1 " > "$item2 """" )
50
55
hasError = true
51
56
}
52
57
You can’t perform that action at this time.
0 commit comments