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

Add linter Nakedret #5068

Merged
merged 6 commits into from
Sep 19, 2019
Merged

Add linter Nakedret #5068

merged 6 commits into from
Sep 19, 2019

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Sep 19, 2019

  • added linter Nakedret
    Followed this:
Naked returns are okay if the function is a handful of lines. Once it's a medium sized function, 
be explicit with your return values. Corollary: it's not worth it to name result parameters just 
because it enables you to use naked returns. Clarity of docs is always more important than 
saving a line or two in your function.

But didnt remove named result params as i know people are in favor of it

ref #4589

Signed-off-by: Marko Baricevic marbar3778@yahoo.com

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md

  • Re-reviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

- added linter Nakedret
Followed this:
```
Naked returns are okay if the function is a handful of lines. Once it's a medium sized function, be explicit with your return values. Corollary: it's not worth it to name result parameters just because it enables you to use naked returns. Clarity of docs is always more important than saving a line or two in your function.
```
But didnt remove named result params as i know people are in favor of it

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
@tac0turtle tac0turtle added R4R Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Sep 19, 2019
@tac0turtle tac0turtle self-assigned this Sep 19, 2019
@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #5068 into master will increase coverage by <.01%.
The diff coverage is 27.27%.

@@            Coverage Diff             @@
##           master    #5068      +/-   ##
==========================================
+ Coverage   55.03%   55.03%   +<.01%     
==========================================
  Files         291      291              
  Lines       17838    17841       +3     
==========================================
+ Hits         9817     9819       +2     
- Misses       7314     7315       +1     
  Partials      707      707

@alexanderbez
Copy link
Contributor

Love this and I've always advocated for this. Thanks @marbar3778

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK + fixed PrintOutput

@alexanderbez alexanderbez merged commit 01d8a23 into master Sep 19, 2019
@alexanderbez alexanderbez deleted the marko/nakedret branch September 19, 2019 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants