- SonarQube Version - 9.7.0 , Scanner - 4.7.0 Linux
- how is SonarQube deployed: zip
- Code scan of Angular HTML and TS files.
- Setup is done and it’s working fine. However, it is showing issue “Surround this li item tag by a ul or ol” container issue for few HTML files though the code is right.
In an Angular HTML, ul is added and based on container condition li is added as a template present in some other part. - Issue is I don’t want to add NOSONAR comment and want to fix this. Is there anything that can be done to make Sonar understand that it’s not a issue.
Code sample:
<ul #fileButtonWrapper><!-- {...props.fileButtonWrapper.direct} -->
<li>
<a #fileButton><!-- {...props.fileButton.direct} -->
<input [id]="id" type="file"
(change)="setSelectedFileName(props, $event.currentTarget)"
attr.rowno="{{index}}"
#BrowseButton delegateEvent [blurEvent]="blur" [focusEvent]="focus"/><!-- {...props.BrowseButton.direct} {...props.apzevents} -->
Browse... <!--{"Browse..."}-->
</a>
<ng-container [ngTemplateOutlet]="UploadButtons"></ng-container> <!--{UploadButton(props)}-->
</li>
<ng-container [ngTemplateOutlet]="SelectedFile"></ng-container> <!-- {SelectedFile(props)} -->
</ul>
//<li> code present somewhere else in same file.
<ng-template #SelectedFile>
<ng-container *ngIf="props.UploadButtonRequired == 'Y'">
<!-- //NOSONAR --> <li>
<span class="filevalue" id="selectedfiles">
<svg aria-hidden="true" role="presentation" class="icon px24">
<use attr.xlink:href="#"></use>
</svg>
</span>
</li>
</ng-container>
</ng-template>