checkstyle / patch-filters

Suppression Filter for Checkstyle that is based on patch file
GNU Lesser General Public License v2.1
4 stars 6 forks source link

FUTURE: Combine checkNamesForContextStrategyByTokenOrParentSet and checkNamesForContextStrategyByTokenOrAncestorSet properties #337

Open baratali opened 4 years ago

baratali commented 4 years ago

checkNamesForContextStrategyByTokenOrParentSet and checkNamesForContextStrategyByTokenOrAncestorSet do similar thing - they say patch-filter to change AST node to an upper level node for a certain Check, while detecting changed lines in a file.

The second property, checkNamesForContextStrategyByTokenOrAncestorSet, should accept a mapping between a check and AST token type. But instead it uses a hardcoded mapping for certain checks in JavaPatchFilterElement class for now.

Investigate how we can combine these two properties into one and be able to set a mapping between a check and AST ancestor token type. I think it can work this way - if check is defined with no AST token type, then we just take its parent node; if check is defined with AST token type, then we try to find the first ancestor node with this token type.