i dont wanna do unit tests anymoreeeeeeeeeeeeeeeeeeeeeeee #101
build.yml
on: push
Compile Java
1m 14s
Test Java
1m 27s
Check Format Java
39s
Lint
14s
Annotations
3 errors and 10 warnings
Do not explicitly trigger a garbage collection.:
src/test/java/frc/robot/AutoTest.java#L66
Calls to `System.gc()`, `Runtime.getRuntime().gc()`, and `System.runFinalization()` are not advised.
Code should have the same behavior whether the garbage collection is disabled using the option
`-Xdisableexplicitgc` or not.
Moreover, "modern" JVMs do a very good job handling garbage collections. If memory usage issues unrelated to memory
leaks develop within an application, it should be dealt with JVM options rather than within the code itself.
DoNotCallGarbageCollectionExplicitly (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#donotcallgarbagecollectionexplicitly
|
Check Format Java
Process completed with exit code 1.
|
Test Java
Process completed with exit code 1.
|
Avoid unused private fields such as 'isReal'.:
src/main/java/frc/robot/Robot.java#L31
Detects when a private field is declared and/or assigned a value, but not used.
Since PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the
enclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking
or e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis.
Previously these frameworks where explicitly allowed by listing their annotations in the property
"ignoredAnnotations", but that turned out to be prone of false positive for any not explicitly considered framework.
UnusedPrivateField (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unusedprivatefield
|
Avoid unused constructor parameters such as 'id'.:
src/main/java/frc/robot/Robot.java#L33
Reports parameters of methods and constructors that are not referenced them in the method body.
Parameters whose name starts with `ignored` or `unused` are filtered out.
Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
UnusedFormalParameter (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unusedformalparameter
|
Switch statements or expressions should be exhaustive, add a default case (or missing enum branches):
src/main/java/frc/robot/Robot.java#L70
Switch statements should be exhaustive, to make their control flow
easier to follow. This can be achieved by adding a `default` case, or,
if the switch is on an enum type, by ensuring there is one switch branch
for each enum constant.
This rule doesn't consider Switch Statements, that use Pattern Matching, since for these the
compiler already ensures that all cases are covered. The same is true for Switch Expressions,
which are also not considered by this rule.
NonExhaustiveSwitch (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#nonexhaustiveswitch
|
Use one line for each declaration, it enhances code readability.:
src/main/java/frc/robot/commands/drive/DriveCommand.java#L15
Java allows the use of several variables declaration of the same type on one line.
However, it can lead to quite messy code. This rule looks for several declarations on the same line.
OneDeclarationPerLine (Priority: 4, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#onedeclarationperline
|
Use one line for each declaration, it enhances code readability.:
src/main/java/frc/robot/commands/drive/DriveCommand.java#L16
Java allows the use of several variables declaration of the same type on one line.
However, it can lead to quite messy code. This rule looks for several declarations on the same line.
OneDeclarationPerLine (Priority: 4, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#onedeclarationperline
|
Perhaps 'angularSpeed' could be replaced by a local variable.:
src/main/java/frc/robot/commands/drive/DriveCommand.java#L17
Reports fields which may be converted to a local variable. This is so because
in every method where the field is used, it is assigned before it is first read.
Hence, the value that the field had before the method call may not be observed,
so it might as well not be stored in the enclosing object.
Limitations:
* We can only check private fields for now.
* The rule is not aware of threading, so it may cause false positives in concurrent code.
Such FPs are best handled by suppression (see also the `ignoredAnnotations` property).
SingularField (Priority: 3, Ruleset: Design)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_design.html#singularfield
|
Avoid using redundant field initializer for 'lastTimeStampSeconds':
src/main/java/frc/robot/commands/drive/DriveCommandBase.java#L22
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
Field 'killswitch' may be declared final:
src/main/java/frc/robot/extras/UnitTestableRobot.java#L101
Reports non-final fields whose value never changes once object initialization ends,
and hence may be marked final.
Note that this rule does not enforce that the field value be deeply immutable itself.
An object can still have mutable state, even if all its member fields are declared final.
This is referred to as shallow immutability. For more information on mutability,
see *Effective Java, 3rd Edition, Item 17: Minimize mutability*.
Limitations: We can only check private fields for now.
ImmutableField (Priority: 3, Ruleset: Design)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_design.html#immutablefield
|
Avoid using redundant field initializer for 'calledDsConnected':
src/main/java/frc/robot/extras/UnitTestableRobot.java#L107
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
Avoid using redundant field initializer for 'loopCount':
src/main/java/frc/robot/extras/UnitTestableRobot.java#L108
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
PMD Report
|
13.6 KB |
|