-
Notifications
You must be signed in to change notification settings - Fork 115
Add WartRemover checks #176
Comments
I think this is generally a good idea, although I don't agree with a few built-in warts or with the suggested ways to remove some warts. |
I found wartremover super useful. @EzequielPostan nice list, |
Thanks for the comment @greenhat , I will go back to work on this issue soon. @ceilican I will enable some warts in a new branch and check how many issues it detects. |
@ceilican
which reveals that some unsafe calls are made and probably should be reviewed. |
Let me correct myself, there are a lot more of unsafe calls. The ones above are just from |
Thanks, @EzequielPostan ! I left some comments there. My comments clarify what I meant when I wrote above that:
In my opinion, we should only avoid using |
Thanks for the review @ceilican :) I understand and share the objection when the error pointed by the Wart is:
I neither like the use of I am not sure how should I proceed with that PR, any suggestion is welcome. |
I think we should have a separate PR for each wart type. |
I propose that you modify the PR. For each wart occurrence found by the wart remover, do one of the following:
This is already almost what you did. What do you think of this proposal? |
I agree with the suggestions of creating different PRs for each |
@ceilican I agree. And it might be a good idea to create ticket(s) for "warts to enable" list. |
I created a PR to enable the wart |
I think so. Which other warts would you like to try next? |
I once found a tricky bug thanks to I think Then, other possible warts could be:
As you see, there are many warts to examine.
Enabling a Wart also imposes a sort of style standard. Hence, I wouldn't like to add warts without a certain level of consensus. Please let me know which ones you prefer me to work on (if any) and which to ignore (if any). Thank you all for your time to read/review this. |
Here are my comments:
Yes, I totally agree with removing
Partially agree. We definitely should avoid global
I think it is a good one.
I think it is a good one too.
I partially agree. As with
IntelliJ already warns to declare types of public members. Therefore, at least for parts of the code that I have touched, this won't make a difference. But I think it is a good one.
I completely disagree with this one. Default arguments are a very nice feature.
I'm against this one. I never had a problem with "toString", and being forced to override "toString" to use it would make the code unnecessarily more verbose.
Isn't "case class inheritance" already prohibited in recent versions of Scala anyway?
Not sure. I think it wouldn't make a difference anyway.
I'm against this one. Implicit conversions are a powerful feature that must be used with responsibility, not forbidden.
This is a good one.
This seems ok to me.
Seems ok too.
Seems ok.
Good.
Theis one would require very extensive refactoring, because Scorex relies a lot on mutable collections.
I agree.
Yes, it is. And #78 is a hard issue. #78 alone would already require several PRs, one per actor.
I think the ones for which I said either "good" or "agree" are quite uncontroversial. I think everyone would agree with them. I would start with those. |
Good, thanks @ceilican for the comments.
I will then apply (in more than one PR):
|
These are the pending Warts from the above list:
|
Just to clean up this issue.
|
I think so.
I suggest opening issues for |
Would it be a good idea to add checks using wartremover?
https://github.com/wartremover/wartremover
I have seen some good checks like
head
,last
,get
, etc.var
s and mutable stateProduct
type inferencesAny
and many others.
We could define a full list of desired checks from here: http://www.wartremover.org/doc/warts.html
The text was updated successfully, but these errors were encountered: