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

Code Improvements #118

Merged
merged 15 commits into from
Feb 22, 2019
Merged

Code Improvements #118

merged 15 commits into from
Feb 22, 2019

Conversation

darxriggs
Copy link
Contributor

These are commits to improve the current code.

@darxriggs darxriggs force-pushed the improvements branch 2 times, most recently from d56d616 to bbc3fb1 Compare January 3, 2019 14:25
@darxriggs
Copy link
Contributor Author

darxriggs commented Jan 30, 2019

@batmat is there anything I can help to get this merged?

@batmat batmat self-requested a review January 30, 2019 23:04
@batmat
Copy link
Member

batmat commented Feb 7, 2019

@darxriggs I just deployed a 2.45-20190207.140250-1 SNAPSHOT of this PR. Can you please file a PR against the core to show this still builds fine there with this change?

I.e. like https://github.com/jenkinsci/jenkins/pull/3053/files but with 2.45-20190207.140250-1 instead.

Thanks!

@darxriggs
Copy link
Contributor Author

I had to create another pull request (jenkinsci/jenkins/pull/3891) first because of required changes when upgrading jenkins-test-harness (HTMLUnit breaking changes).

@batmat
Copy link
Member

batmat commented Feb 7, 2019

@darxriggs sorry, I forgot about the fact you'd be blocked by ongoing fixes for bumping to 2.46 already in progress in jenkinsci/jenkins#3872.

I would be inclined to wait for jenkinsci/jenkins#3872 to land so we can test your PR here.

Sorry about that

@batmat
Copy link
Member

batmat commented Feb 8, 2019

@darxriggs finally, it went much faster than anticipated. Given jenkinsci/jenkins#3872 is now merged, you can move forward by checking #118 (comment) :).

thanks!

@darxriggs
Copy link
Contributor Author

@batmat the verification with Jenkins core passed.

Copy link
Member

@batmat batmat left a comment

Choose a reason for hiding this comment

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

A few changes look either debatable, or even wrong. Please explain or fix.

@@ -847,7 +847,7 @@ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundEx
auths.add(new GrantedAuthorityImpl(g));
}
}
return new org.acegisecurity.userdetails.User(username,"",true,true,true,true, auths.toArray(new GrantedAuthority[auths.size()]));
return new org.acegisecurity.userdetails.User(username,"",true,true,true,true, auths.toArray(new GrantedAuthority[0]));
Copy link
Member

Choose a reason for hiding this comment

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

Same. Why a 0 length array?


File dataSetRoot = new File(baseDir,"src/main/preset-data");
def dataSetRoot = new File(baseDir, "src/main/preset-data")
Copy link
Member

Choose a reason for hiding this comment

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

This definitely looks like a change in the wrong direction to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You refert to def instead of File?
That's reducing type duplication.
Groovy is a dynamic language.
Having types everywhere doesn't provide much more confidence as a lot of things are just checked as runtime unless @CompileStatic is used.
But I can revert this if really desired.
Just let me know.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure on the precise context, but even in Java, this is idiomatic now. For example:

var f = new File(...)

versus:

File f = getRoot();

Essentially, you should have an obvious type in the line before using def/var.

@batmat batmat self-requested a review February 11, 2019 16:30
@darxriggs
Copy link
Contributor Author

As I answered all review comments I'd like to ask you to have another look and either merge the changes or request specific modifications.

@batmat
Copy link
Member

batmat commented Feb 21, 2019

@darxriggs I just pushed a SNAPSHOT for the current tip 2.47-20190221.102815-1.

Can you please file a similar on the core with it? Once done and green, I'll merge and release here.

Thanks a lot for the cleanup!

@batmat
Copy link
Member

batmat commented Feb 21, 2019

(sorry if this looks convoluted, we just had a dumpster fire on the previous changes and bump to JTH 2.46, so I'm being extra careful we can then just release a bump the core with latest JTH without outstanding efforts. Thanks for your understanding)

darxriggs added a commit to darxriggs/jenkins that referenced this pull request Feb 21, 2019
This is only to verify that the improvements in jenkins-test-harness don't break anything in Jenkins core.
See jenkinsci/jenkins-test-harness#118.
@batmat batmat merged commit e72678d into jenkinsci:master Feb 22, 2019
@darxriggs darxriggs deleted the improvements branch February 22, 2019 10:14
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.

3 participants