Method writeOutput
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void writeOutput(GitRepository repository)
throws MavanagaiataMojoException {
try {
mailMap = repository.getMailMap();
Method writeOutput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void writeOutput(GitRepository repository)
throws MavanagaiataMojoException {
try {
mailMap = repository.getMailMap();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid reassigning parameters such as 'name' Open
private String escapeName(String name) {
- Read upRead up
- Exclude checks
AvoidReassigningParameters
Since: PMD 1.0
Priority: Medium High
Categories: Style
Remediation Points: 50000
Reassigning values to incoming parameters is not recommended. Use temporary local variables instead.
Example:
public class Foo {
private void foo(String bar) {
bar = 'something else';
}
}
Avoid excessively long variable names like MARKDOWN_TRANSLATION_MAP Open
private static final Map<CharSequence, CharSequence> MARKDOWN_TRANSLATION_MAP = new HashMap<>();
- Read upRead up
- Exclude checks
LongVariable
Since: PMD 0.3
Priority: Medium
Categories: Style
Remediation Points: 50000
Fields, formal arguments, or local variable names that are too long can make the code difficult to follow.
Example:
public class Something {
int reallyLongIntName = -3; // VIOLATION - Field
public static void main( String argumentsList[] ) { // VIOLATION - Formal
int otherReallyLongName = -5; // VIOLATION - Local
for (int interestingIntIndex = 0; // VIOLATION - For
interestingIntIndex < 10;
interestingIntIndex ++ ) {
}
}
Avoid reassigning parameters such as 'name' Open
private String escapeName(String name) {
- Read upRead up
- Exclude checks
AvoidReassigningParameters
Since: PMD 1.0
Priority: Medium High
Categories: Style
Remediation Points: 50000
Reassigning values to incoming parameters is not recommended. Use temporary local variables instead.
Example:
public class Foo {
private void foo(String bar) {
bar = 'something else';
}
}
Avoid excessively long variable names like MARKDOWN_TRANSLATOR Open
private static final CharSequenceTranslator MARKDOWN_TRANSLATOR = new LookupTranslator(MARKDOWN_TRANSLATION_MAP);
- Read upRead up
- Exclude checks
LongVariable
Since: PMD 0.3
Priority: Medium
Categories: Style
Remediation Points: 50000
Fields, formal arguments, or local variable names that are too long can make the code difficult to follow.
Example:
public class Something {
int reallyLongIntName = -3; // VIOLATION - Field
public static void main( String argumentsList[] ) { // VIOLATION - Formal
int otherReallyLongName = -5; // VIOLATION - Local
for (int interestingIntIndex = 0; // VIOLATION - For
interestingIntIndex < 10;
interestingIntIndex ++ ) {
}
}