Duplicated blocks in vue data headers = false positive

Hi, we are using SonarQube at our company, and we have a recurrent problem concerning duplicated blocks in data headers.

            {
              text: vm.$t(".."),
              value: "...",
              sortable: false,
            },
            {
              text: vm.$t("..."),
              value: "...",
              sortable: false,
            },
            {
              text: vm.$t("..."),
              value: "...",
              sortable: false,
            },

I know that the analyzer doesn’t check for the strings, and that’s why there’s a lot of theses blocks that are flagged as dupplication, but in reality that’s not duplication, that’s expected.
How to fix this by not using a solution that will complexify the code for nothing like using a method to construct the header ?

of course we can’t ignore the file it’s .vue file

Hi,

Why not? You could certainly set a duplications exclusion, via the UI (my preference) or with sonar.cpd.exclusions.

And really, that’s probably the best option, since there’s no real way to mark a duplication “False Positive”.

 
HTH,
Ann