From f08ace3feb061c26145cfe2c34fb44dcbc769947 Mon Sep 17 00:00:00 2001 From: Mike Linksvayer Date: Wed, 18 Jan 2017 13:31:19 -0800 Subject: [PATCH] make rubocop ruby version match pages ruby version --- .rubocop.yml | 2 +- Gemfile | 1 + Rakefile | 1 + script/check-approval | 1 + script/generate-docs | 1 + spec/ci_ruby_version_spec.rb | 16 ++++++++++++++-- spec/license_bom_spec.rb | 1 + spec/license_fields_spec.rb | 1 + spec/license_meta_spec.rb | 1 + spec/license_rules_spec.rb | 1 + spec/license_shown_spec.rb | 1 + spec/license_spec.rb | 1 + spec/spec_helper.rb | 1 + 13 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 02d49ba..6c5cba1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.1 + TargetRubyVersion: 2.3 Exclude: - _site/**/* - vendor/**/* diff --git a/Gemfile b/Gemfile index 44de39e..6285dab 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'https://rubygems.org' require 'json' diff --git a/Rakefile b/Rakefile index 7e2647e..01734ae 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'html-proofer' require 'rspec/core/rake_task' diff --git a/script/check-approval b/script/check-approval index 57d2867..2e4c9d2 100755 --- a/script/check-approval +++ b/script/check-approval @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # Checks if a given license meets the approval criteria to be added to choosealicense.com # See https://github.com/github/choosealicense.com/blob/gh-pages/CONTRIBUTING.md#adding-a-license # Usage: script/check-approval [SPDX LICENSE ID] diff --git a/script/generate-docs b/script/generate-docs index e7df50d..b4edae4 100755 --- a/script/generate-docs +++ b/script/generate-docs @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # Usage: script/generate-docs # Reads in the fields, meta, and rules YAML files and produces markdown output # suitable for documenting in the project's README diff --git a/spec/ci_ruby_version_spec.rb b/spec/ci_ruby_version_spec.rb index 7a39ad5..b61c7c5 100644 --- a/spec/ci_ruby_version_spec.rb +++ b/spec/ci_ruby_version_spec.rb @@ -1,14 +1,14 @@ +# frozen_string_literal: true require 'json' require 'open-uri' require 'spec_helper' require 'yaml' -describe 'ci ruby version' do +describe 'ruby version' do pages_versions = JSON.parse(open('https://pages.github.com/versions.json').read) pages_ruby_version = pages_versions['ruby'] ci_config_file = '.travis.yml' - ci_config = YAML.load_file(ci_config_file) ci_ruby_version = ci_config['rvm'][0] @@ -18,4 +18,16 @@ describe 'ci ruby version' do expect(ci_ruby_version).to eql(pages_ruby_version), msg end end + + rubocop_config_file = '.rubocop.yml' + rubocop_config = YAML.load_file(rubocop_config_file) + rubocop_ruby_version = rubocop_config['AllCops']['TargetRubyVersion'] + pages_ruby_version_minor = pages_ruby_version.match('^(\d+)\.(\d+)')[0] + + context "in #{rubocop_config_file} and pages ruby minor version" do + it 'match' do + msg = "#{rubocop_ruby_version} != #{pages_ruby_version_minor}; please add a commit bumping in #{rubocop_config_file}" + expect(rubocop_ruby_version.to_s).to eql(pages_ruby_version_minor), msg + end + end end diff --git a/spec/license_bom_spec.rb b/spec/license_bom_spec.rb index 02ec086..a3e2798 100644 --- a/spec/license_bom_spec.rb +++ b/spec/license_bom_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'byte order marks' do diff --git a/spec/license_fields_spec.rb b/spec/license_fields_spec.rb index 52d04ec..bac33e9 100644 --- a/spec/license_fields_spec.rb +++ b/spec/license_fields_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'license fillable fields' do diff --git a/spec/license_meta_spec.rb b/spec/license_meta_spec.rb index 0933085..60ea68b 100644 --- a/spec/license_meta_spec.rb +++ b/spec/license_meta_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'license meta' do diff --git a/spec/license_rules_spec.rb b/spec/license_rules_spec.rb index 289d142..83137c2 100644 --- a/spec/license_rules_spec.rb +++ b/spec/license_rules_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'license rules' do diff --git a/spec/license_shown_spec.rb b/spec/license_shown_spec.rb index 7c0ec1d..d2b50e4 100644 --- a/spec/license_shown_spec.rb +++ b/spec/license_shown_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'shown licenses' do diff --git a/spec/license_spec.rb b/spec/license_spec.rb index 2917392..95e6f43 100644 --- a/spec/license_spec.rb +++ b/spec/license_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'licenses' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f71f332..c99daf6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'jekyll' require 'open-uri' require 'json'