We are using SonarQube Enterprise Edition Version 8.9.6 (build 50800)
Using Knockout without a container element is causing SonarQube to flag KnockoutJS html logic with the code smell - Sections of code should not be commented out (Web:AvoidCommentedOutCodeCheck)
The KnockoutJS documentation has this listed under the Using “if” and “ifnot” without a container element Knockout : The "if" and "ifnot" bindings which uses HTML comments as markers that Knockout uses as virtual elements.
This is an issue of a false positive as the commented out code is required for Knockout logic to work correctly without a container element.
Here is an example of a valid exerpt of code that has been flagged multiple times when using the conditional logic of KnockoutJS
<td>
//This causes SonarQube to flag an error: Remove this commented out code (Web:AvoidCommentedOutCodeCheck)
<!-- ko if: EditCode() == "A" || EditCode() == "" -->
<a data-bind="click: $root.Remove" href="#">
//This causes SonarQube to flag an error: Remove this commented out code (Web:AvoidCommentedOutCodeCheck)
<!-- ko if: EditCode() == "A" -->
<em class="fa fa1 fa-times-circle" title="Delete"></em>
<!-- /ko -->
//This causes SonarQube to flag an error: Remove this commented out code (Web:AvoidCommentedOutCodeCheck)
<!-- ko if: EditCode().EditCode() == "" -->
<em class="fa fa1 fa-ban" title="Remove"></em>
<!-- /ko -->
</a>
<!-- /ko -->
//This causes SonarQube to flag an error: Remove this commented out code (Web:AvoidCommentedOutCodeCheck)
<!-- ko ifnot: EditCode() == "A" || EditCode() == "" -->
<a data-bind="click: $root.ReActivate" href="#" title="Reactivate/Reset"></a>
<!-- /ko -->
</td>