Skip to content

new Treewalker property to skip all nested Modules if there is parsing exception #12542

@romani

Description

@romani

It is our biggest limitation to not work on non compilable files
https://checkstyle.org/writingchecks.html#Limitations

Code has to be compilable by javac to get valid violations. If it is not, you can get hard to understand parse errors.

All of this is blocker for users:
https://github.com/checkstyle/checkstyle/issues?q=is%3Aopen+is%3Aissue+label%3Aantlr
but in most cases they mostlikely to ignore all Checkstyle activity on such files and let them use fancy new jdk syntax for business reasons.

We rely on plugin to cover this problem from us
But we still have problems with new syntax of Java

We need new property like skipFileOnJavaParseException or some thing similar.
If user wants new features of Java and ok to skip checkstyle in such files, it should be easy to do
We should not limit our users and let them decide : choose one checkstyle of new jdk features
By default it is disabled so exception crash all as before
But we can hint users after they create issue on use, about it, and they will be unblocked

We will introduce a new property called skipFileOnJavaParseException:

<module name="TreeWalker">
  <property name="skipFileOnJavaParseException" value="false"/>

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions