sonar-delphi icon indicating copy to clipboard operation
sonar-delphi copied to clipboard

Add ignore keyword list to CommentedOutCode

Open wdken opened this issue 1 year ago • 2 comments

Prerequisites

  • [X] This improvement has not already been suggested.
  • [X] This improvement should not be implemented as a separate rule.

Rule to improve

CommentedOutCode

Improvement description

CommentedOutCode detects code in comments like:

foo.CheckCondition({var}param);

I'd like this {var} not to match with this rule.

Rationale

We often use {var} comment to indicate the 'param' may be chanegd. In this case, CheckCondition function is defined blow:

procedure CFoo.CheckCondition(var ACode: Integer);
begin
  // do something
end;

On the other hand, this {var} may be a code to be detected. So, I wish I could add an Ignore-Keyword-List to CommentedOutCode rule.

{out} is also frequently used for the same reason.

wdken avatar Oct 30 '24 02:10 wdken

A possible (simpler) alternative condition for exclusions from the rule would be a minimum comment length.

zaneduffield avatar Oct 30 '24 02:10 zaneduffield

That's nice! I agree with the minimum comment length.

wdken avatar Oct 30 '24 02:10 wdken