pemistahl / version-catalog-linter-gradle-plugin

A Gradle plugin for checking and formatting version catalog TOML files
Apache License 2.0
10 stars 0 forks source link

[BUG]: Exception thrown when parsing comment lines #5

Closed TvdBrink closed 8 months ago

TvdBrink commented 8 months ago

When having comments (e.g. todos) in the version catalog the plugin an java.util.NoSuchElementException (no error message) exception, find the stacktrace below.

Example file

[versions]
# Axis ... 
axis = "1.3"

Stacktrace

Execution failed for task ':checkVersionCatalog'.
> java.util.NoSuchElementException (no error message)

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':checkVersionCatalog'.Caused by: java.util.NoSuchElementException
    at io.github.pemistahl.versioncatalog.linter.plugin.VersionCatalogChecker.checkWhitespace(VersionCatalogChecker.kt:178)
    at io.github.pemistahl.versioncatalog.linter.plugin.VersionCatalogChecker.checkLibraries$version_catalog_linter_gradle_plugin(VersionCatalogChecker.kt:83)
    at io.github.pemistahl.versioncatalog.linter.plugin.VersionCatalogChecker.checkVersionCatalog(VersionCatalogChecker.kt:37)

BUILD FAILED in 1s
5 actionable tasks: 1 executed, 4 up-to-date
Configuration cache entry stored.
Verelias commented 8 months ago

Noticed this issue as well, would be nice to have an updated version that can handle code comments.

pemistahl commented 8 months ago

I'm sorry, I don't know why I did not take single-line comments into account. I'm working on a fix already, hope to release it this week.

pemistahl commented 8 months ago

This bug is fixed now. In the next major release, I will include comments in checking and formatting. Currently, they are filtered out in the output.

TvdBrink commented 8 months ago

Thank you for the prompt and precise resolution!