GitHub user adityasharad opened a pull request:
https://github.com/apache/storm/pull/2100
STORM-2503: Fix lgtm.com alerts on equality and comparison operations.
This PR addresses STORM-2503, by fixing a number of alerts found by
lgtm.com at https://lgtm.com/projects/g/apache/storm/alerts/ that indicate
genuine bugs in comparison operations in the Storm code.
These rules are:
- Equals on incomparable types (due to typos, fixed here)
- Hashed value without hashCode definition
- Inconsistent equals and hashCode (together with the previous item, this
indicates some missing hashCode implementations, which have been added here)
- Comparison of identical values (indicating a comparator logic typo in
`DefaultResourceAwareStrategy`, which is fixed here along with a fix to the
overall comparator logic, to consider components with fewer connections as
being smaller)
- Useless comparison test (indicating a variable name typo, which is fixed
here)
- Suspicious reference equality test of boxed types (indicating a spurious
use of `==`, replaced here by `equals`, on boxed types)
lgtm.com also provides PR integration, in case it would be useful to catch
such alerts directly from incoming PRs.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/adityasharad/storm fix/lgtm-alerts
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/storm/pull/2100.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2100
----
commit 5493949553c23728017a3c5139a55ebebb8156da
Author: Aditya Sharad <[email protected]>
Date: 2017-05-02T21:16:58Z
STORM-2503: Fix equality in Nimbus config.
Fixes an "Equals on incomparable types" alert at
https://lgtm.com/projects/g/apache/storm/alerts/.
commit ec6f3b0b91fec8959dcaf71f859421dec52153d6
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T18:57:44Z
STORM-2503: Fix equality in `TransactionalWords` example.
Fixes an "Equals on incomparable types" alert at
https://lgtm.com/projects/g/apache/storm/alerts.
commit 7e518b1596a7242c18c6f7d40cc9394a8efdb4bc
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T19:05:08Z
STORM-2503: Add `hashCode` method to `SubSystem`.
This type is stored in a `HashSet` in `CGroupCenter`.
Fixes "Hashed value without hashCode definition" and
"Inconsistent equals and hashCode" alerts at
https://lgtm.com/projects/g/apache/storm/alerts/.
commit 9682095ddad8f3b8b8a1a90fc5c2947e0b94b8b8
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T19:19:27Z
STORM-2503: Add hashCode method to SchedulerAssignmentImpl.
Fixes an "Inconsistent equals and hashCode" alert on lgtm.com.
commit 85eeffdf36191d7061fe46e51ae3981afabff4a4
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T19:28:38Z
STORM-2503: Fix comparisons in DefaultResourceAwareStrategy.
Fix typo causing "Comparison of identical values" alert
on lgtm.com.
Fix comparator logic so that components with fewer connections
are considered smaller.
commit 4f7e3277f79410b556e39197a8ede18303db3eae
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T19:35:35Z
STORM-2503: Fix typo in `StoreBasedTridentWindowManager`.
Fixes a "Useless comparison test" alert at
https://lgtm.com/projects/g/apache/storm/alerts.
commit a88e821b8d5d199f347a5c9d5091ed2a262743b2
Author: Aditya Sharad <[email protected]>
Date: 2017-05-04T19:39:09Z
STORM-2503: Fix equality test in `ReadClusterState`.
Fixes a "Suspicious reference equality test of boxed types"
alert at https://lgtm.com/projects/g/apache/storm/alerts/.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---