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

Version bump should use single-quoted strings #99

Open
estahn opened this issue Jan 9, 2014 · 3 comments
Open

Version bump should use single-quoted strings #99

estahn opened this issue Jan 9, 2014 · 3 comments

Comments

@estahn
Copy link

estahn commented Jan 9, 2014

Using spork for bumping the version number will produce following error with rubocop:

metadata.rb:7:9: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
version "0.1.1"
        ^^^^^^^
@kwilczynski
Copy link

@estahn this does not seem like an issue, because knife-spork would preserve type of quotes you have there, see:

kwilczynski@apple ~$ pry
[1] pry(main)> require 'stringio'
false
[2] pry(main)> sio = StringIO.new
#<StringIO:0x007fd379198fd0>
[3] pry(main)> def new_version ; [rand(1..9), rand(1..9), rand(1..9)].join('.') ; end
:new_version
[4] pry(main)> new_version
"2.3.8"
[5] pry(main)> sio.write(%{version "0.1.0"})
15
[6] pry(main)> sio.rewind
0
[7] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version \"9.4.1\""
[8] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version \"5.9.6\""
[9] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version \"5.2.6\""
[10] pry(main)> sio.write(%{version '0.1.0'})
15
[191] pry(main)> sio.rewind
0
[12] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version '3.3.4'"
[13] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version '2.7.1'"
[14] pry(main)> sio.string.gsub(/(version\s+['"])[0-9\.]+(['"])/, "\\1#{new_version}\\2")
"version '3.8.5'"
[15] pry(main)>

This happens by the virtue of this code:

https://github.com/jonlives/knife-spork/blob/master/lib/chef/knife/spork-bump.rb#L78

In other words, whatever you have there, should be the same upon the bump, so to speak.

@kwilczynski
Copy link

@jonlives this is an old issue (opened long time ago), perhaps not a problem for @estahn any more.

@kwilczynski
Copy link

Yeah, was fixed in 57b2f96.

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

No branches or pull requests

2 participants