fujaba/NetworkParser

View on GitHub

Showing 4,645 of 4,645 total issues

These nested if statements could be combined
Open

            if (parent instanceof AbstractList<?>) {
                AbstractList<?> collection = (AbstractList<?>) parent;
                collection.remove(i);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                    if (matchAttributeValues(oldAttribute, newAttribute)) {
                        metaMatchedAttributes.add(oldAttribute);
                        newMatchedAttributes.add(newAttribute);
                    }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                    if (matchMethodValues(oldMethod, newMethod)) {
                        metaMatchedMethods.add(oldMethod);
                        newMatchedMethods.add(newMethod);
                    }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                    if (oldParameter.getType().equals(newParameter.getType()) == false) {
                        continue;
                    }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

Avoid using a branching statement as the last in a loop.
Open

                break;

AvoidBranchingStatementAsLastInLoop

Since: PMD 5.0

Priority: Medium High

Categories: Style

Remediation Points: 50000

Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

Example:

// unusual use of branching statement in a loop
for (int i = 0; i < 10; i++) {
 if (i*i <= 25) {
 continue;
 }
 break;
}

// this makes more sense...
for (int i = 0; i < 10; i++) {
 if (i*i > 25) {
 break;
 }
}

Do not hard code the IP address
Open

        NodeProxy proxy = space.getOrCreateProxy("141.51.116.1", 5000);

AvoidUsingHardCodedIP

Since: PMD 4.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Application with hard-coded IP addresses can become impossible to deploy in some cases. Externalizing IP adresses is preferable.

Example:

public class Foo {
 private String ip = '127.0.0.1'; // not recommended
}

These nested if statements could be combined
Open

            if (this.item.remove(item))
            {
               item.setBuyer(null);
               firePropertyChange(PROPERTY_ITEM, item, null);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                if (this.done.remove(item)) {
                    item.withoutStudents(this);
                }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

            if (ReflectionLoader.INVALIDATIONLISTENER.isAssignableFrom(listener.getClass())) {
                invalidationListeners.add(listener);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

            if (sender.sendMessage(acceptTaskSend)) {
                this.getReceiver().withOnline(true);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

This for loop could be simplified to a while loop
Open

                for (; i.hasNext();) {
                    item = i.next();
                    if (first == false) {
                        sb.append(", ");
                    } else {

ForLoopShouldBeWhileLoop

Since: PMD 1.02

Priority: Medium

Categories: Style

Remediation Points: 50000

Some for loops can be simplified to while loops, this makes them more concise.

Example:

public class Foo {
 void bar() {
 for (;true;) true; // No Init or Update part, may as well be: while (true)
 }
}

Avoid using a branching statement as the last in a loop.
Open

            return feature;

AvoidBranchingStatementAsLastInLoop

Since: PMD 5.0

Priority: Medium High

Categories: Style

Remediation Points: 50000

Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

Example:

// unusual use of branching statement in a loop
for (int i = 0; i < 10; i++) {
 if (i*i <= 25) {
 continue;
 }
 break;
}

// this makes more sense...
for (int i = 0; i < 10; i++) {
 if (i*i > 25) {
 break;
 }
}

These nested if statements could be combined
Open

            if (entity != null) {
                return entity.getClass().getSimpleName();
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

            if (value instanceof ObjectCondition) {
                ((Not) entity).with((ObjectCondition) value);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                if (condition.update(value) == false) {
                    return false;
                }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

Avoid using a branching statement as the last in a loop.
Open

                break;

AvoidBranchingStatementAsLastInLoop

Since: PMD 5.0

Priority: Medium High

Categories: Style

Remediation Points: 50000

Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

Example:

// unusual use of branching statement in a loop
for (int i = 0; i < 10; i++) {
 if (i*i <= 25) {
 continue;
 }
 break;
}

// this makes more sense...
for (int i = 0; i < 10; i++) {
 if (i*i > 25) {
 break;
 }
}

These nested if statements could be combined
Open

                        if (previousTokenKindEquals('\\') == false || prevprevTokenKind == '\\') {
                            break;
                        }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

These nested if statements could be combined
Open

                if (this.home.remove(item)) {
                    item.withPlayer(null);
                }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}

Do not hard code the IP address
Open

        space.getOrCreateProxy("141.51.116.1", 5010);

AvoidUsingHardCodedIP

Since: PMD 4.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Application with hard-coded IP addresses can become impossible to deploy in some cases. Externalizing IP adresses is preferable.

Example:

public class Foo {
 private String ip = '127.0.0.1'; // not recommended
}

These nested if statements could be combined
Open

            if (this.students.remove(item))
            {
               firePropertyChange(PROPERTY_STUDENTS, item, null);
            }

CollapsibleIfStatements

Since: PMD 3.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

Example:

void bar() {
 if (x) { // original implementation
 if (y) {
 // do stuff
 }
 }
}

void bar() {
 if (x && y) { // optimized implementation
 // do stuff
 }
}
Severity
Category
Status
Source
Language