8000 ImportOrder: replace Pattern[] with String[] type for properties staticGroups and groups · Issue #13758 · checkstyle/checkstyle · GitHub
[go: up one dir, main page]

Skip to content
ImportOrder: replace Pattern[] with String[] type for properties staticGroups and groups #13758
@romani

Description

@romani

from #13754 (comment)

We think our documentation at https://checkstyle.org/property_types.html#Pattern.5B.5D is either wrong or misleading.

Found looking at https://checkstyle.org/checks/metrics/classfanoutcomplexity.html#Properties

The string representation is parsed as a set of forward slash ('/') separated patterns.

When glancing at this, i thought it meant each pattern is separated by a /.

But looking at the code at

, it takes input as a string array, which is separated by the comma and not the /.

Even createPattern method that it calls does nothing with /, so I don't understand where the / is coming from.

https://github.com/search?q=repo%3Acheckstyle%2Fcheckstyle+%22Pattern.5B.5D%22+path%3A%2F%5Esrc%5C%2Fxdocs%5C%2Fchecks%5C%2F%2F&type=code
We have 6 checks with this type.

It looks like documentation is coming from

, which is a serious problem now as we have a documented type being parsed differently in different checks, meaning we can't even unify documentation without first changing production code.


We need review all Patern[] usage and probably move ImportOrderCheck to have special type.
how we can support list of Pattern, when "," can be used in regexp.


agreement on how to fix we archived at #14764 (comment)


Migration Notes:

ImportOrder is update to replace Pattern[] with String[] type for properties staticGroups and groups.
user who use xml config are not affected, but plugins who might have type validation during Check configuration (before Check execution) might be affected. Validation type in metadata is different from 10.17.0 for this Check.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0