Skip to content

Enabled LocalFinalVariableName in Checkstyle #5172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/checks/naming/index.html -->
<module name="ConstantName"/>
<!-- TODO <module name="LocalFinalVariableName"/> -->
<module name="LocalFinalVariableName"/>
<!-- TODO <module name="LocalVariableName"/> -->
<!-- TODO <module name="MemberName"/> -->
<!-- TODO <module name="MethodName"/> -->
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/thealgorithms/maths/DudeneyNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public static boolean isDudeney(final int n) {
throw new IllegalArgumentException("Input must me positive.");
}
// Calculating Cube Root
final int cube_root = (int) Math.round(Math.pow(n, 1.0 / 3.0));
final int cubeRoot = (int) Math.round(Math.pow(n, 1.0 / 3.0));
// If the number is not a perfect cube the method returns false.
if (cube_root * cube_root * cube_root != n) {
if (cubeRoot * cubeRoot * cubeRoot != n) {
return false;
}

// If the cube root of the number is not equal to the sum of its digits, we return false.
return cube_root == SumOfDigits.sumOfDigits(n);
return cubeRoot == SumOfDigits.sumOfDigits(n);
}
}
6 changes: 3 additions & 3 deletions src/main/java/com/thealgorithms/sorts/SimpleSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ public class SimpleSort implements SortAlgorithm {

@Override
public <T extends Comparable<T>> T[] sort(T[] array) {
final int LENGTH = array.length;
final int length = array.length;

for (int i = 0; i < LENGTH; i++) {
for (int j = i + 1; j < LENGTH; j++) {
for (int i = 0; i < length; i++) {
for (int j = i + 1; j < length; j++) {
if (SortUtils.less(array[j], array[i])) {
T element = array[j];
array[j] = array[i];
Expand Down