Skip to content

Some file module Sonar fixes #2718

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

Merged
merged 8 commits into from
Jan 25, 2019
Merged

Conversation

artembilan
Copy link
Member

No description provided.

@garyrussell
Copy link
Contributor

There are travis failures.

Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! - just a few minor comments.



public AbstractRegexPatternFileListFilter(String pattern) {
this.pattern = Pattern.compile(pattern);
this(Pattern.compile(pattern));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NPE if pattern==null

* @since 5.1.3
*/
public void setAge(Duration age) {
setAge(age.get(ChronoUnit.SECONDS));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just age.getSeconds() ? Simpler, and functionally the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is not public 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toSeconds() is private, but...

    public long getSeconds() {
        return seconds;
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh!

public String getName() {
return this.name;
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StreamHolder ctor must be protected to avoid synthetic ctor.

@artembilan
Copy link
Member Author

I think that's enough for the current round.
We have a lot of hard logic in those classes. It's almost impossible to simplify complexity over there.

Another point is to work out a rule for ourselves to check Sonar report when we touch some classes and fix smells together with the original reported issue.
That's really too much mind effort to come with the proper refactoring, although I should admit this is really useful task to do anyway! We learn something for good habit, plus in many cases we really fix leaks 😄

I will push fixes according your review when you done.

Thanks

@garyrussell garyrussell merged commit a609bd9 into spring-projects:master Jan 25, 2019
@garyrussell
Copy link
Contributor

Another point is to work out a rule for ourselves to check Sonar report when we touch some classes and fix smells together with the original reported issue.

I don't think I want to go to the trouble of a Sonar build for every PR (or even going to check Sonar to see if changed files have existing smells); right now, I am fine with our practice of fixing any new smells we introduce (or are reported because we touched a file) the next day when we get an alert.

As long as we obey the "no new smells" rule and "fewer smells in this release than the last one" rule, we will eventually reduce them to zero.

We have removed ~1000 smells (45%) in just a short few months (and mainly done that as background tasks).

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 this pull request may close these issues.

2 participants