> Task :checks:lint FAILED
src/main/java/com/example/lint/checks/SampleCodeDetector.kt:61: Error: Lint issue IDs should not contain spaces, such as MyIssueId [LintImplIdFormat]
id = "My Issue Id",
~~~~~~~~~~~
Explanation for issues of type "LintImplIdFormat":
This check looks at lint issue id registrations and makes sure the id
follows the expected conventions: capitalized, camel case, no spaces, and
not too long.
Note: You shouldn't change id's for lint checks that are already widely
used, since the id can already appear in @SuppressLint annotations,
tools:ignore= attributes, lint baselines, Gradle lintOptions blocks,
lint.xml files, and so on. In these cases, just explicitly suppress this
warning instead using something like
@JvmField
val ISSUE = Issue.create(
// ID string is too long, but we can't change this now since this
// id is already used in user suppress configurations
//noinspection LintImplIdFormat
id = "IncompatibleMediaBrowserServiceCompatVersion",
...
src/main/java/com/example/lint/checks/SampleCodeDetector.kt:50: Warning: Single sentence error messages should not end with a period [LintImplTextFormat]
"This code mentions lint: Congratulations.")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "LintImplTextFormat":
Lint supports various markdown like formatting directives in all of its
strings (issue explanations, reported error messages, etc).
This lint check looks for strings that look like they may benefit from
additional formatting. For example, if a snippet looks like code it should
be surrounded with backticks.
Note: Be careful changing existing strings; this may stop baseline file
matching from working, so consider suppressing existing violations of this
check if this is an error many users may be filtering in baselines. (This
is only an issue for strings used in report calls; for issue registration
strings like summaries and explanations there's no risk changing the text
contents.)
src/main/java/com/example/lint/checks/SampleCodeDetector.kt:72: Error: No need to call .trimIndent() in issue registration strings; they are already trimmed by indent by lint when displaying to users [LintImplTrimIndent]
""".trimIndent(),
~~~~~~~~~~~~
Explanation for issues of type "LintImplTrimIndent":
Lint implicitly calls .trimIndent() (lazily, at the last minute) in a
number of places:
* Issue explanations
* Error messages
* Lint test file descriptions
* etc
That means you don't need to put .trimIndent() in your source code to
handle this.
There are advantages to not putting .trimIndent() in the code. For test
files, if you call for example kotlin(""\"source code"\""\") then
IntelliJ/Android Studio will syntax highlight the source code as Kotlin.
The second you add in a .trimIndent() on the string, the syntax
highlighting goes away. For test files you can instead call ".indented()"
on the test file builder to get it to indent the string.
2 errors, 1 warnings
Wrote HTML report to file:///Users/tnorbye/dev/github/tnorbye/android-custom-lint-rules/android-studio-4/checks/lint-report.html
Wrote XML report to file:///Users/tnorbye/dev/github/tnorbye/android-custom-lint-rules/android-studio-4/checks/build/test-results/lint-results.xml
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checks:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
lintOptions {
abortOnError false
}
...
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 2s
1 actionable task: 1 executed