0

I would like to know if a refactor went fine diffing the code, but most commits remove duplicated code but also adds documentation, so the diff stats are not that useful. Is there a way to make diff stats differentiate comments?

eloyesp
  • 3,135
  • 1
  • 32
  • 47
  • 3
    You'd need to use a tool for your particular programming language. Keep in mind that [loc](https://en.wikipedia.org/wiki/Source_lines_of_code) is a dubious metric. If you want to know if the refactoring worked, run tests. – Schwern Sep 14 '21 at 17:55
  • Why are you interested in the diff stats when judging the effectiveness of a refactoring? If you just want to check the textual diffs, you might get away with combining diff with grep: `git diff | grep -v '^[+- ]\s*//'` (depending on which tokens signify a comment in your programming language). Perhaps you can then simply count lines? – knittl Sep 19 '21 at 15:02

0 Answers0