-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Cop idea: Enforce preferred style for format string sequences #3438
Comments
Yeah, that'd be nice. |
Enforces using one of two named format string token styles: * Annotated: `format('%<greeting>s', greeting: 'Hello')` * Template: `format('%{greeting}', greeting: 'Hello')`
Anyone currently using existing code with %{variable} (especially when using rubocop tests with puppet code) just got bit with errors because of this commit. Setting default back to template fixes it. |
Yeah it was a new rule that came out somewhat recently. Not sure what you mean by "bit with errors." It is just recommending one of two styles |
But changing either of these to
So then to fix you have to update the .rubocop.yml
|
It should be |
@backus thanks I think that will fix the issues with puppet-lint failing (wish the stacktrace was clearer). |
Yeah the stacktrace from your |
Thanks I thought i was for integer and f for float... good to know it's d
for digit?
|
I think so yeah. |
I found one issue with this cop. It flags things like this:
|
Since this is a gem it is a best practice to not include a Gemfile.lock, however that also means that travis will download always the last versions of all gems. In the last Travis run, the version of Rubocop was updated, throwing an error in a rule that we may not neccessarily want to adopt, hence I am excluding it just for the file that triggers it. Relevant Rubocop issue: rubocop/rubocop#3438
Since this is a gem it is a best practice to not include a Gemfile.lock, however that also means that travis will download always the last versions of all gems. In the last Travis run, the version of Rubocop was updated, throwing an error in a rule that we may not neccessarily want to adopt, hence I am excluding it just for the file that triggers it. Relevant Rubocop issue: rubocop/rubocop#3438
[Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
* Bundle Update on 2017-12-14 * Resolve issues with rubocop breaking build [Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
[Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
* Bundle Update on 2017-12-14 * Resolve issues with rubocop breaking build [Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
[Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
* Bundle Update on 2017-12-14 * Resolve issues with rubocop breaking build [Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. rubocop/rubocop#3438 The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
[Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. <rubocop/rubocop#3438> The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
* Bundle Update on 2017-12-15 * Resolve issues with rubocop breaking build [Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found. The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0. <rubocop/rubocop#3438> The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now. * Update FactoryGirl to FactoryBot The people behind ThoughtBot have decided to change the name of this gem, which breaks build if we don't rename it in our code. This change updates the gem and the code to use the new name. * Fix error following rubocop change We didn't implement a rubocop fix properly. This change corrects that mistake. * Update flood_risk_engine to latest
You should use one of these styles consistently:
I prefer the third option because you get to name your variables and also get some type hinting and coercion.
The text was updated successfully, but these errors were encountered: