checkstyle / checkstyle/checkstyle

NPathComplexity: find a way to calculate nested "?:"

Open
#3,974 2 comments 0 reactions 0 assignees View on GitHub
approved
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
22h 23m
Merged PRs (30d)
232

Description

taken from https://github.com/checkstyle/checkstyle/pull/3785#issuecomment-281185031

apache-jsecurity/xref/home/zenigata/workspace/contribution/checkstyle-tester/repositories/apache-jsecurity/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/party/Person.java.html#L194

```
public boolean onEquals(Entity e) {

if (e instanceof Person) {
Person p = (Person) e;
return (givenName == null ? p.getGivenName() == null : givenName.equals(p.getGivenName())) &&
(surname == null ? p.getSurname() == null : surname.equals(p.getSurname())) &&
(middleNames == null ? p.getMiddleNames() == null : middleNames.equals(p.getMiddleNames())) &&
(dateOfBirth == null ? p.getDateOfBirth() == null : dateOfBirth.equals(p.getDateOfBirth())) &&
(gender == null ? p.getGender() == null : gender.equals(p.getGender())) &&
(nameSalutation == null ? p.getNameSalutation() == null : nameSalutation.equals(p.getNameSalutation())) &&
(nameSuffix == null ? p.getNameSuffix() == null : nameSuffix.equals(p.getNameSuffix())) &&
(title == null ? p.getTitle() == null : title.equals(p.getTitle()));
}

return false;
}
```

Find a correct way to calculate Npath value for such structures.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.