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

Fix tests + Make quotes coherent in Gemfile #136

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

aerostitch
Copy link

@aerostitch aerostitch commented Jan 24, 2017

The current tests are failing with most of the versions of ruby and puppet.

In the Gemfiles we have a mix of simple and double quotes.
It would be cleaner to have only 1 type so we stay coherent in the syntax used.
It's just cosmetics.

@aerostitch
Copy link
Author

aerostitch commented Jan 24, 2017

The tests are failing because of the las_comment method that has been removed after being deprecated for a while. References:
ruby/rake#116
rspec/rspec-core#2205
Will try to add the patch for it also here.

@aerostitch
Copy link
Author

#70 pinned rspec to < 3.2.0 for all ruby versions when it was failing only for ruby <= 1.8.7, so changing that.

@aerostitch aerostitch changed the title [Cosmetic] Make quotes coherent in Gemfile Fix tests + Make quotes coherent in Gemfile Jan 24, 2017
@aerostitch
Copy link
Author

aerostitch commented Jan 24, 2017

The following error can be fixed by unpinning the rubocop gem:

NoMethodError: undefined method `last_comment' for #<Rake::Application:0x00561575366718>
/home/joseph/.rvm/gems/ruby-2.3.1/gems/rubocop-0.33.0/lib/rubocop/rake_task.rb:23:in `initialize'
/home/joseph/.rvm/gems/ruby-2.3.1/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:560:in `new'
/home/joseph/.rvm/gems/ruby-2.3.1/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:560:in `<top (required)>'
/tmp/puppet-module-skeleton/module/Rakefile:4:in `require'
/tmp/puppet-module-skeleton/module/Rakefile:4:in `<top (required)>'
/home/joseph/.rvm/gems/ruby-2.3.1/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

So added a fix for when ruby >= 2 + upgrade to latest version that supports ruby 1.9.

@aerostitch
Copy link
Author

The next issue to fix is:

Don't know how to build task 'coverage' (see --tasks)
/home/travis/build/garethr/puppet-module-skeleton/user-module/Rakefile:30:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

That is caused by the fact that we clear the coverage task without checking if it exists. (it seems it has been dropped in the latest versions so it doesn't exist anymore).

@aerostitch
Copy link
Author

Now Rubocop is failing on ruby 1.9 with the error:

Running RuboCop...
/home/travis/build/garethr/puppet-module-skeleton/user-module/.rubocop.yml: Lint/SpaceBeforeFirstArg has the wrong namespace - should be Style
Error: The `Style/TrailingComma` cop no longer exists. Please use `Style/TrailingCommaInLiteral` and/or `Style/TrailingCommaInArguments` instead.
(obsolete configuration found in /home/travis/build/garethr/puppet-module-skeleton/user-module/.rubocop.yml, please update it)
RuboCop failed!

In ruby >=2 with:

Running RuboCop...
/home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml: Lint/Eval has the wrong namespace - should be Security
/home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml: Lint/SpaceBeforeFirstArg has the wrong namespace - should be Style
Error: The `Style/TrailingComma` cop no longer exists. Please use `Style/TrailingCommaInLiteral` and/or `Style/TrailingCommaInArguments` instead.
(obsolete configuration found in /home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml, please update it)
The `Style/SingleSpaceBeforeFirstArg` cop has been renamed to `Style/SpaceBeforeFirstArg.`
(obsolete configuration found in /home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml, please update it)
The `Style/SpaceAfterControlKeyword` cop has been removed. Please use `Style/SpaceAroundKeyword` instead.
(obsolete configuration found in /home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml, please update it)
The `Style/MethodCallParentheses` cop has been renamed to `Style/MethodCallWithoutArgsParentheses`.
(obsolete configuration found in /home/travis/build/garethr/puppet-module-skeleton/module/.rubocop.yml, please update it)
RuboCop failed!

@aerostitch
Copy link
Author

aerostitch commented Jan 25, 2017

Well, now rubocop fails with:

Inspecting 8 files
..CC....

Offenses:

Gemfile:5:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem puppet should appear before rake. 
  gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:8:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem puppetlabs_spec_helper should appear before rspec-puppet. 
  gem 'puppetlabs_spec_helper'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:9:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem metadata-json-lint should appear before puppetlabs_spec_helper. 
  gem 'metadata-json-lint'
  ^^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:14:5: C: Bundler/DuplicatedGem: Gem rubocop requirements already given on line 12 of the Gemfile. 
    gem 'rubocop'
    ^^^^^^^^^^^^^
Gemfile:23:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem puppet-lint-classes_and_types_beginning_with_digits-check should appear before puppet-lint-version_comparison-check. 
  gem 'puppet-lint-classes_and_types_beginning_with_digits-check'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:25:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem puppet-lint-resource_reference_syntax should appear before puppet-lint-unquoted_string-check. 
  gem 'puppet-lint-resource_reference_syntax'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:33:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem puppet-blacksmith should appear before travis-lint. 
  gem 'puppet-blacksmith'
  ^^^^^^^^^^^^^^^^^^^^^^^
Gemfile:34:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem guard-rake should appear before puppet-blacksmith. 
  gem 'guard-rake'          if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep
  ^^^^^^^^^^^^^^^^
Gemfile:34:19: C: Style/ExtraSpacing: Unnecessary spacing detected. 
  gem 'guard-rake'          if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep
                  ^^^^^^^^^
Gemfile:40:3: C: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem beaker-puppet_install_helper should appear before beaker-rspec. 
  gem 'beaker-puppet_install_helper'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/classes/example_spec.rb:3:1: C: Metrics/BlockLength: Block has too many lines. [29/25] 
describe 'module' do ...
^^^^^^^^^^^^^^^^^^^^

8 files inspected, 11 offenses detected
RuboCop failed!

Will send the fix.

@aerostitch
Copy link
Author

aerostitch commented Jan 25, 2017

Weird, works on puppet 4.2 with ruby 2.3 but with

/home/travis/build/garethr/puppet-module-skeleton/user-module/spec/spec_helper.rb:7:in `require': /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/simplecov-console-0.4.0/lib/simplecov-console.rb:8: unknown type of %string (SyntaxError)
  ATTRIBUTES = %i(table_options)
                  ^
/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/simplecov-console-0.4.0/lib/simplecov-console.rb:8: syntax error, unexpected $end
  ATTRIBUTES = %i(table_options)
                  ^
	from /home/travis/build/garethr/puppet-module-skeleton/user-module/spec/spec_helper.rb:7:in `<top (required)>'
	from /home/travis/build/garethr/puppet-module-skeleton/user-module/spec/classes/example_spec.rb:1:in `require'
	from /home/travis/build/garethr/puppet-module-skeleton/user-module/spec/classes/example_spec.rb:1:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
	from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/exe/rspec:4:in `<main>'
/home/travis/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -I/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/lib:/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-support-3.5.0/lib /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\{aliases,classes,defines,unit,functions,hosts,integration,types\}/\*\*/\*_spec.rb --color failed
Running RuboCop...
wrong number of arguments (5 for 1..3)
/home/travis/.rvm/gems/ruby-2.1.5/gems/puppet-3.7.5/lib/puppet/vendor/safe_yaml/lib/safe_yaml.rb:162:in `safe_load'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:171:in `yaml_safe_load'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:154:in `load_yaml_configuration'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:34:in `load_file'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:107:in `configuration_from_file'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/config_store.rb:44:in `for'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/cli.rb:93:in `apply_default_formatter'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/cli.rb:25:in `run'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/rake_task.rb:48:in `run_cli'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/rake_task.rb:36:in `run_main_task'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/rake_task.rb:28:in `block (2 levels) in initialize'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/file_utils_ext.rb:58:in `verbose'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rubocop-0.47.1/lib/rubocop/rake_task.rb:26:in `block in initialize'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:250:in `call'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/home/travis/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/home/travis/.rvm/gems/ruby-2.1.5/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/home/travis/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
RuboCop failed!

@aerostitch aerostitch force-pushed the gemfile_quotes branch 3 times, most recently from b84bdc7 to fb314c8 Compare January 25, 2017 03:29
@aerostitch
Copy link
Author

We should be good to go now.

deric added a commit to deric/puppet-hindsight that referenced this pull request Apr 5, 2017
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

Successfully merging this pull request may close these issues.

1 participant