From 412512a33e5d56f71e57f4d6d02fcee0646bcbcd Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Fri, 17 Jan 2014 17:14:09 +0000 Subject: [PATCH] Update attributes to be rubocop compliant - Update rubocop config to handle entire repo in one file - Update Strainerfile to run rubocop only once - Update attributes to comply with rubocop Change-Id: I299c2775a5a124b0af74f2e3d844cbd91f93380f Addresses: blueprint rubocop-for-ops-database --- .rubocop.yml | 23 +++++++++++++++++++---- Strainerfile | 3 +-- attributes/default.rb | 21 +++++++++++---------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7a296ac..4213dd9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,22 @@ -# UTF-8 headers not generally in these files -Encoding: - Enabled: false +AllCops: + Includes: + - metadata.rb + - Gemfile + - attributes/** + Excludes: + - libraries/** + - providers/** + - recipes/** + - resources/** + - spec/** + +Encoding: + Exclude: + - metadata.rb + - Gemfile -# ignore long lines LineLength: Enabled: false + +WordArray: + MinSize: 3 diff --git a/Strainerfile b/Strainerfile index 4271c2a..44e3e14 100644 --- a/Strainerfile +++ b/Strainerfile @@ -1,6 +1,5 @@ # Strainerfile -rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/Gemfile $SANDBOX/$COOKBOOK/metadata.rb --config $SANDBOX/$COOKBOOK/.rubocop.yml -# rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK +rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK knife test: bundle exec knife cookbook test $COOKBOOK foodcritic: bundle exec foodcritic -f any -t ~FC003 -t ~FC023 $SANDBOX/$COOKBOOK chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec diff --git a/attributes/default.rb b/attributes/default.rb index 8a1cd5a..d1af87d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8# # # Cookbook Name:: openstack-ops-database # Recipe:: default @@ -17,17 +18,17 @@ # limitations under the License. # -default["openstack"]["db"]["bind_interface"] = "lo" +default['openstack']['db']['bind_interface'] = 'lo' # Platform defaults case platform -when "fedora", "redhat", "centos" # :pragma-foodcritic: ~FC024 - won"t fix this - default["openstack"]["db"]["platform"]["mysql_python_packages"] = [ "MySQL-python" ] - default["openstack"]["db"]["platform"]["postgresql_python_packages"] = [ "python-psycopg2" ] -when "suse" - default["openstack"]["db"]["platform"]["mysql_python_packages"] = [ "python-mysql" ] - default["openstack"]["db"]["platform"]["postgresql_python_packages"] = [ "python-psycopg2" ] -when "ubuntu" - default["openstack"]["db"]["platform"]["mysql_python_packages"] = [ "python-mysqldb" ] - default["openstack"]["db"]["platform"]["postgresql_python_packages"] = [ "python-psycopg2" ] +when 'fedora', 'redhat', 'centos' # :pragma-foodcritic: ~FC024 - won't fix this + default['openstack']['db']['platform']['mysql_python_packages'] = ['MySQL-python'] + default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2'] +when 'suse' + default['openstack']['db']['platform']['mysql_python_packages'] = ['python-mysql'] + default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2'] +when 'ubuntu' + default['openstack']['db']['platform']['mysql_python_packages'] = ['python-mysqldb'] + default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2'] end