code: private static int calculateBeginLine(RuleViolation pmdViolation) {
          int minLine = Math.min(pmdViolation.getBeginLine(), pmdViolation.getEndLine());
          return minLine > 0 ? minLine : calculateEndLine(pmdViolation);
      }
docs: Calculates the beginLine of a violation report.
  
  @param pmdViolation The violation for which the beginLine should be calculated.
  @return The beginLine is assumed to be the line with the smallest number. However, if the smallest number is
  out-of-range (non-positive), it takes the other number.