Each table is on separate pages. Is it considered duplication (written in Angular)?
The DevOps team ran SonarQube and detected the th
tags as code duplication. How can I explain to them that it’s not duplication, but rather the “use” of that component (table)? Wrapping the table with a component would result in “over-abstraction,” leading to more complex and less maintainable code. Is there any official coding principle I can refer to?
from my point of view, each page consider it’s own ui and i assamble the components/ui-elements and display what i need. it’s give me more flexable to change the column in one page and in another page to use another column.
<!-- Table for Users -->
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users">
<td>{{ user.userId }}</td>
<td>{{ user.userName }}</td>
<td>{{ user.lastLogin }}</td>
</tr>
</tbody>
</table>
<br>
<!-- Table for Products -->
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let product of products">
<td>{{ product.productId }}</td>
<td>{{ product.productName }}</td>
<td>{{ product.dateAdded }}</td>
</tr>
</tbody>
</table>
Shlomi Levi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.