Skip to content

Commit

Permalink
style(math/curve/exponential): disable PMD check on line 26, as paren…
Browse files Browse the repository at this point in the history
…theses make the equation easier to read.
  • Loading branch information
Baconing committed Sep 30, 2024
1 parent feed830 commit d23b088
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Double curve(Double x) {
if (x == 0) return 0d;

Check warning on line 23 in src/main/java/net/frc5183/librobot/math/curve/ExponentialCurve.java

View workflow job for this annotation

GitHub Actions / pmd

This statement should have braces

Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else' statements and loop statements, even if they are optional. This usually makes the code clearer, and helps prepare the future when you need to add another statement. That said, this rule lets you control which statements are required to have braces via properties. From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces, and IfElseStmtMustUseBraces. ControlStatementBraces (Priority: 3, Ruleset: Code Style) https://docs.pmd-code.org/pmd-doc-7.6.0/pmd_rules_java_codestyle.html#controlstatementbraces

// y = (x/|x|) * ((1 + exaggeration)^|x| - 1) / exaggeration
return (x / Math.abs(x)) * ((Math.pow(1 + exaggeration, Math.abs(x))) - 1) / exaggeration;
return (x / Math.abs(x)) * ((Math.pow(1 + exaggeration, Math.abs(x))) - 1) / exaggeration; // NOPMD - extra parentheses make the equation easier to read
}

/**
Expand Down

0 comments on commit d23b088

Please sign in to comment.