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

Layout/HashAlignment: Allow both key and table styles #77

Merged
merged 1 commit into from
May 20, 2022
Merged

Conversation

root-expert
Copy link
Member

@root-expert root-expert commented Mar 29, 2022

In the latest modulesync rubocop was auto-correcting:

{
   "foo"    => "bar",
   "forbar" => "bar"
}

to

{
   "foo" => "bar",
   "forbar" => "bar"
}

Generally in the puppet world we are used to align to the => and a lot of specs are written this way (and I think it's better to stay this way)

@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #77 (00ea471) into master (6db2eb1) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master      #77   +/-   ##
=======================================
  Coverage   27.86%   27.86%           
=======================================
  Files           2        2           
  Lines          61       61           
=======================================
  Hits           17       17           
  Misses         44       44           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6db2eb1...00ea471. Read the comment docs.

@bastelfreak bastelfreak requested a review from ekohl March 29, 2022 11:27
@bastelfreak
Copy link
Member

is that the old or the new style?

@root-expert
Copy link
Member Author

The new, rubocop is currently auto-correcting to:

{
   "foo" => "bar",
   "forbar" => "bar"
}

@ekohl
Copy link
Member

ekohl commented Mar 29, 2022

I do agree we need something for this because it's making huge changes in some modules for (IMHO) no benefit. I'd like a consistent style, whether it's the old or new. Just as long as it doesn't mix styles. Reading https://www.rubydoc.info/gems/rubocop/0.83.0/RuboCop/Cop/Layout/HashAlignment it said:

Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

Do we have a module where we can test if this works?

@root-expert root-expert changed the title Layout/HashAlignment: Use table alignment Layout/HashAlignment: Allow both key and table styles May 17, 2022
@root-expert
Copy link
Member Author

Sorry, I completely forgot about this PR. I added so both key and table styles are allowed. I think that's the most used styles. separator seems a little bit weird.

I will test this on puppet-example module

@root-expert
Copy link
Member Author

Tested here: voxpupuli/puppet-example#21

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Thanks!

@ekohl ekohl merged commit 93bfef3 into master May 20, 2022
@ekohl ekohl deleted the hash-table branch May 20, 2022 20:40
@ekohl ekohl added the bug Something isn't working label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants