New Issue: [Feature Request]: duplicated code lint warning for chplcheck

24750, "jabraham17", "[Feature Request]: duplicated code lint warning for chplcheck", "2024-04-02T19:09:02Z"

I'd like to propose a new chplcheck lint rule, DuplicatedCode. DuplicatedCode would fire when there are multiple blocks of code that are the same and could be factored out into a function. This could be entirely textually based, it more utilize resolution features to find sections of code that are functionally the same.

For example, the following code has two blocks of code that operate on an array, with a serial and parallel loop

config param doParallel = true;
var A: [1..10] int;
if doParallel {
  forall a in A {
    // some complicated body of code
  }
} else {
  for a in A {
    // the same block of code
  }
}

This could show a warning that the user should consider refactoring there code to factor the loop bodies out into its own function. For bonus points, this could provide an auto-fix refactor functionality to do that transformation for users.