Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conver test for SuppressionXpathSingleFilterTest to use inlined config in Input files #11439

Closed
romani opened this issue Mar 19, 2022 · 3 comments · Fixed by #11461
Closed

Conver test for SuppressionXpathSingleFilterTest to use inlined config in Input files #11439

romani opened this issue Mar 19, 2022 · 3 comments · Fixed by #11461

Comments

@romani
Copy link
Member

romani commented Mar 19, 2022

Detected at https://github.com/checkstyle/checkstyle/pull/11437/files

All filters should migrate to use config inlined in Input files.
Suppression that was left in that commit should be removed.

@Vyom-Yadav
Copy link
Member

I am on it.

@Vyom-Yadav
Copy link
Member

@romani I need some advice, suppose we have the following inline config

/*
SuppressionXpathSingleFilter
files = InputSuppressionXpathSingleFilter
checks = .*
message = (default)(null)
id = (default)(null)
query = //VARIABLE_DEF[./IDENT[@text='pi'] and ../../IDENT[@text='countTokens']] | //VARIABLE_DEF[./IDENT[@text='someVariable'] and ../../IDENT[@text='sum']]

*/

Now the query line is exceeding the mark of 100, there are two options to fix this-

  1. Just add suppression for line length
  2. Create some custom logic in parser to handle XPath queries, for eg, it should be able to parse this-
/*
SuppressionXpathSingleFilter
files = InputSuppressionXpathSingleFilter
checks = .*
message = (default)(null)
id = (default)(null)
query = (XpathQuery)(//VARIABLE_DEF[./IDENT[@text='pi'] and ../../IDENT[@text='countTokens']] | 
//VARIABLE_DEF[./IDENT[@text='someVariable'] and ../../IDENT[@text='sum']])

*/

It can handle multiline XPath queries, we surround the Xpath query by parentheses.

Both are doable, the first one being obviously the easier one. We can keep things simple by just suppressing or follow the style guidelines and develop custom logic.

@romani
Copy link
Member Author

romani commented Mar 24, 2022

We already support line wrap, see example at long 'token' values.

Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Mar 24, 2022
…erTest to use inlined config in Input files
Vyom-Yadav added a commit to Vyom-Yadav/checkstyle that referenced this issue Mar 24, 2022
…erTest to use inlined config in Input files
romani pushed a commit that referenced this issue Mar 25, 2022
@romani romani added this to the 10.1 milestone Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants