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

Refactoring CLIRegisterer #4945

Merged
merged 2 commits into from
Oct 1, 2020

Conversation

T45K
Copy link
Contributor

@T45K T45K commented Sep 22, 2020

In #4641, a method named logAndPrintError was extracted (refactored), but its similar class, CLIRegisterer was not modified.
I refactored the class to make consistent and reduce duplicated code.

This PR is for minor changes without a JIRA ticket.

Proposed changelog entries

N/A

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • The refactoring done should not change the behaviour of existing code, so the tests should not need to be changed.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

N/A

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@daniel-beck daniel-beck added internal skip-changelog Should not be shown in the changelog labels Sep 22, 2020
Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Interesting suggestion, thanks for your submission.

I'm unsure whether it is worth it yet. For one thing, the new method has more arguments than lines of code to make it work, effectively reducing readability through an additional level of indirection. Perhaps if it was extended to all error messages rather than two out of seven or so it could be worth it? Log related arguments could be optional, or a new method printError be created that does only this.

@T45K
Copy link
Contributor Author

T45K commented Sep 22, 2020

@daniel-beck Thank you for your comment.

Your recommendation sounds very good. I'll add printError method, which extracted from all error messages.

@T45K
Copy link
Contributor Author

T45K commented Sep 22, 2020

@daniel-beck

I've done the modification. Would you check it again?

@T45K T45K requested a review from daniel-beck September 23, 2020 17:19
@oleg-nenashev oleg-nenashev added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Sep 26, 2020
@oleg-nenashev
Copy link
Member

Looks good in the current state. We may merge it in 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Much nicer, thanks.

@oleg-nenashev oleg-nenashev merged commit 8c6327f into jenkinsci:master Oct 1, 2020
@oleg-nenashev
Copy link
Member

Thanks for your contribution @T45K ! Just in case you are interested to submit more patches, the Jenkins project participates in Hacktoberfest this year. https://www.jenkins.io/events/hacktoberfest/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants