Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AvoidSizeNotEqualsZero fires for non-Traversable types #414

Closed
migesok opened this issue Aug 7, 2020 · 3 comments · Fixed by #416
Closed

AvoidSizeNotEqualsZero fires for non-Traversable types #414

migesok opened this issue Aug 7, 2020 · 3 comments · Fixed by #416

Comments

@migesok
Copy link
Contributor

migesok commented Aug 7, 2020

AvoidSizeNotEqualsZero fires for timeIntervalTrigger.length > 0 where timeIntervalTrigger is a FiniteDuration:

[error] XXX.scala:15:38: [scapegoat] Avoid Traversable.size != 0
[error]   .size can be slow for some data structures, prefer .nonEmpty, which is O(1).
[error]   OffsetCommitSettings.this.timeIntervalTrigger.length.>(0)
[error]   require(timeIntervalTrigger.length > 0, "time interval trigger duration should be positive")

I inspected the code, compared AvoidSizeNotEqualsZero and AvoidSizeEqualsZero and it looks like not-equals impl is missing if isTraversable(q) check. I guess it might've been lost during some refactoring.

@migesok
Copy link
Contributor Author

migesok commented Aug 7, 2020

Scapegoat version: 1.4.5

@mwz
Copy link
Contributor

mwz commented Aug 7, 2020

it looks like not-equals impl is missing if isTraversable(q) check. I guess it might've been lost during some refactoring.

oh possibly; this looks like an easy fix, would you be able to raise a PR for this?

@migesok
Copy link
Contributor Author

migesok commented Aug 13, 2020

@mwz sure! Here you are: #416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants