jscpd
jscpd copied to clipboard
Sort output with respect to number of duplicate lines detected
Is your feature request related to a problem? Please describe.
Sorting the output with the items with the most amount of duplicate first would allow users to see where the biggest refactoring wins are at.
Describe the solution you'd like
Have a flag that enables sorting by number of duplicate lines detected, for each item found
As I understand you are going to sort summary results with a list of languages.
If you are using the HTML reporter you can order them with this bit of JavaScript, I know its not the ideal solution but it works well.
let elements = document.querySelectorAll('#txt-clones .py-4');
elements = Array.from(elements);
elements.sort((a, b) => b.textContent.length - a.textContent.length);
let parent = elements[0].parentNode;
elements.forEach(el => el.parentNode.removeChild(el));
elements.forEach(el => parent.appendChild(el));
If you are using the HTML reporter you can order them with this bit of JavaScript, I know its not the ideal solution but it works well.
let elements = document.querySelectorAll('#txt-clones .py-4'); elements = Array.from(elements); elements.sort((a, b) => b.textContent.length - a.textContent.length); let parent = elements[0].parentNode; elements.forEach(el => el.parentNode.removeChild(el)); elements.forEach(el => parent.appendChild(el));
it works, but is it porssible to add this as a feature ?