From 6b8a4c46218004cd3adccdbe07924847c4e68994 Mon Sep 17 00:00:00 2001 From: Samuel Beaulieu Date: Fri, 10 Dec 2021 12:32:23 -0600 Subject: [PATCH] fix simplecov with jruby, add a .rubocop.yml config file --- .jrubyrc | 2 ++ .rubocop.yml | 53 +++++++++++++++++++++++++++++++++++ spec/spec_helper.rb | 8 +++--- vmpooler-provider-gce.gemspec | 2 +- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 .jrubyrc create mode 100644 .rubocop.yml diff --git a/.jrubyrc b/.jrubyrc new file mode 100644 index 0000000..d875079 --- /dev/null +++ b/.jrubyrc @@ -0,0 +1,2 @@ +# for simplecov to work in jruby, without this we are getting errors when debugging spec tests +debug.fullTrace=true \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..64bfd6f --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,53 @@ +inherit_from: .rubocop_todo.yml + +AllCops: + Include: + - 'lib/**/*.rb' + Exclude: + - 'scripts/**/*' + - 'spec/**/*' + - 'vendor/**/*' + - Gemfile + - Rakefile + +# These short variable names make sense as exceptions to the rule, but generally I think short variable names do hurt readability +Naming/MethodParameterName: + AllowedNames: + - vm + - dc + - s + - x + - f + +#new cops: +Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1) + Enabled: true +Lint/EmptyBlock: # (new in 1.1) + Enabled: true +Lint/ToEnumArguments: # (new in 1.1) + Enabled: true +Lint/UnmodifiedReduceAccumulator: # (new in 1.1) + Enabled: true +Style/ArgumentsForwarding: # (new in 1.1) + Enabled: false +Style/DocumentDynamicEvalDefinition: # (new in 1.1) + Enabled: true +Style/SwapValues: # (new in 1.1) + Enabled: false + +#disabled + +Metrics/AbcSize: + Max: 77 +Metrics/ClassLength: + Max: 430 +Metrics/CyclomaticComplexity: + Max: 14 +Metrics/MethodLength: + Max: 48 +Metrics/PerceivedComplexity: + Max: 14 +Metrics/ParameterLists: + Max: 6 +Layout/LineLength: + Max: 220 \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aafca7d..603f438 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -# require 'simplecov' -# SimpleCov.start do -# add_filter '/spec/' -# end +require 'simplecov' +SimpleCov.start do + add_filter '/spec/' +end require 'helpers' require 'rspec' require 'vmpooler' diff --git a/vmpooler-provider-gce.gemspec b/vmpooler-provider-gce.gemspec index 649f568..15bbca0 100644 --- a/vmpooler-provider-gce.gemspec +++ b/vmpooler-provider-gce.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rack-test', '>= 0.6' s.add_development_dependency 'rspec', '>= 3.2' s.add_development_dependency 'rubocop', '~> 1.1.0' - #s.add_development_dependency 'simplecov', '>= 0.11.2' + s.add_development_dependency 'simplecov', '>= 0.11.2' s.add_development_dependency 'thor', '~> 1.0', '>= 1.0.1' s.add_development_dependency 'yarjuf', '>= 2.0' end