XPath to AST mapper which will be implemented in the scope of #4369 will help us to find AST node which corresponds the XPath expression starting from the root. When the AST node is found, we need to compare the node with the AST node which causes the violation. If they are equal, the audit event need to be denied.
For example, if we have the following XPath expression to suppress a violation logged by MethodLengthCheck
//CLASS_DEF//METHOD_DEF[@Text='foo']
then the mapper will return the method definition AST node. MethodLengthCheck emits the violation for method foo. We need to log method definition AST node, because we should compare the node with the AST node given by mapper. If both nodes are equal, then audit event (violation) should be denied.
Thus, in order to suppress the violation by XPath expression we need to have the AST node which causes the violation. However, now the whole information about a violation (lineNo, columnNo, etc) is collected in LocalizedMessage. I propose to rename LocalizedMessage to Violation ann log AST everywhere. AST contains all required information (columnNo, lineNo, token type, ets).
XPath to AST mapper which will be implemented in the scope of #4369 will help us to find AST node which corresponds the XPath expression starting from the root. When the AST node is found, we need to compare the node with the AST node which causes the violation. If they are equal, the audit event need to be denied.
For example, if we have the following XPath expression to suppress a violation logged by MethodLengthCheck
//CLASS_DEF//METHOD_DEF[@Text='foo']then the mapper will return the method definition AST node. MethodLengthCheck emits the violation for method
foo. We need to log method definition AST node, because we should compare the node with the AST node given by mapper. If both nodes are equal, then audit event (violation) should be denied.Thus, in order to suppress the violation by XPath expression we need to have the AST node which causes the violation. However, now the whole information about a violation (lineNo, columnNo, etc) is collected in LocalizedMessage. I propose to rename LocalizedMessage to Violation ann log AST everywhere. AST contains all required information (columnNo, lineNo, token type, ets).