From b14baa38217cf55db9d13bc441b264dc91908f96 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:09:35 +0100 Subject: [PATCH 1/9] Add rubocop gem --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index a3e3fef90..837441ba8 100644 --- a/Gemfile +++ b/Gemfile @@ -9,3 +9,4 @@ ruby "2.0.0" gem "scraperwiki", git: "https://github.com/openaustralia/scraperwiki-ruby.git", branch: "morph_defaults" gem "nokogiri" gem "scraped_page_archive" +gem 'rubocop' \ No newline at end of file From 4e9fa36516cabee0c90d7680d7d3e8ae36fc07ec Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:09:50 +0100 Subject: [PATCH 2/9] Tidy Gemfile for Rubocop --- Gemfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 837441ba8..1fddd75ee 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,14 @@ +# frozen_string_literal: true + # It's easy to add more libraries or choose different versions. Any libraries # specified here will be installed and made available to your morph.io scraper. # Find out more: https://morph.io/documentation/ruby -source "https://rubygems.org" +source 'https://rubygems.org' -ruby "2.0.0" +ruby '2.0.0' -gem "scraperwiki", git: "https://github.com/openaustralia/scraperwiki-ruby.git", branch: "morph_defaults" -gem "nokogiri" -gem "scraped_page_archive" -gem 'rubocop' \ No newline at end of file +gem 'nokogiri' +gem 'rubocop' +gem 'scraped_page_archive' +gem 'scraperwiki', git: 'https://github.com/openaustralia/scraperwiki-ruby.git', branch: 'morph_defaults' From a01efe4f0c02e438c6c75da8e8783c0b87c21458 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:14:05 +0100 Subject: [PATCH 3/9] Bump Ruby version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1fddd75ee..51939bbb6 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ source 'https://rubygems.org' -ruby '2.0.0' +ruby '2.3.3' gem 'nokogiri' gem 'rubocop' From aac2faf02f1d855470de51e4d26711398c81e993 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:14:28 +0100 Subject: [PATCH 4/9] Bundle install --- Gemfile.lock | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e6a12be74..6aa976b1b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,7 @@ GEM specs: addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) + ast (2.3.0) crack (0.4.3) safe_yaml (~> 1.0.0) git (1.3.0) @@ -20,7 +21,20 @@ GEM mini_portile (0.6.2) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) public_suffix (2.0.4) + rainbow (2.2.2) + rake + rake (12.0.0) + rubocop (0.48.1) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) safe_yaml (1.0.4) scraped_page_archive (0.5.0) git (~> 1.3.0) @@ -28,6 +42,7 @@ GEM sqlite3 (1.3.10) sqlite_magic (0.0.3) sqlite3 + unicode-display_width (1.2.1) vcr (3.0.3) vcr-archive (0.3.0) vcr (~> 3.0.2) @@ -42,11 +57,12 @@ PLATFORMS DEPENDENCIES nokogiri + rubocop scraped_page_archive scraperwiki! RUBY VERSION - ruby 2.0.0p648 + ruby 2.3.3p222 BUNDLED WITH - 1.13.6 + 1.14.6 From 3e3d957b097b96e5e215ad3570663d86da0286d4 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:03:49 +0100 Subject: [PATCH 5/9] Configure rubocop --- ...rypolitician-data-master--rubocop-base-yml | 59 +++++++++++++++++++ .rubocop.yml | 9 +++ .rubocop_todo.yml | 0 3 files changed, 68 insertions(+) create mode 100644 .rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml b/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml new file mode 100644 index 000000000..77c84a4e3 --- /dev/null +++ b/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml @@ -0,0 +1,59 @@ +# A base Rubocop configuration that other repos can inherit from +# http://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url + +Lint/AssignmentInCondition: + Enabled: false + +Lint/Debugger: + Enabled: false + +Metrics/LineLength: + Max: 120 + +Performance/Casecmp: + Enabled: false + + +Style/AlignHash: + EnforcedHashRocketStyle: table + EnforcedColonStyle: table + +Style/AndOr: + Enabled: false + +Style/ClassAndModuleCamelCase: + Enabled: false + +Style/CollectionMethods: + Enabled: true + +Style/Documentation: + Enabled: false + +Style/FormatString: + EnforcedStyle: percent + +Style/HashSyntax: + EnforcedStyle: ruby19_no_mixed_keys + +Style/RescueModifier: + Enabled: false + +Style/SignalException: + Enabled: false + +Style/SymbolArray: + Enabled: true + +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: consistent_comma + +# Minitest::Spec uses long blocks to contains the specs, so disable this check +# for the tests. +Metrics/BlockLength: + Max: 10 + Exclude: + - 'spec/**/*' + - 't/**/*' + - 'test/**/*' + - '*.gemspec' diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..e520a3d46 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,9 @@ +AllCops: + Exclude: + - 'Vagrantfile' + - 'vendor/**/*' + TargetRubyVersion: 2.3 + +inherit_from: + - https://raw.githubusercontent.com/everypolitician/everypolitician-data/master/.rubocop_base.yml + - .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..e69de29bb From d627eff88cea8beeba70801b922c22225b4e8104 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:05:46 +0100 Subject: [PATCH 6/9] Add rubocop Rake task --- Rakefile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 000000000..397c71fb6 --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require 'rubocop/rake_task' + +task default: %w[rubocop] From 80f2bf15009eb4c4a9d17dc598ba63e461cb13ee Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:05:58 +0100 Subject: [PATCH 7/9] Configure travis to run Rake task --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..27bc5e639 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: ruby +rvm: + - 2.3.3 +sudo: false +cache: bundler +script: + - bundle exec rake From 614ff75132e5bfd8594cc3fd00d12bf2b45feffe Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 16:48:34 +0100 Subject: [PATCH 8/9] fixup! Configure rubocop --- ...rypolitician-data-master--rubocop-base-yml | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 .rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml diff --git a/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml b/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml deleted file mode 100644 index 77c84a4e3..000000000 --- a/.rubocop-https---raw-githubusercontent-com-everypolitician-everypolitician-data-master--rubocop-base-yml +++ /dev/null @@ -1,59 +0,0 @@ -# A base Rubocop configuration that other repos can inherit from -# http://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url - -Lint/AssignmentInCondition: - Enabled: false - -Lint/Debugger: - Enabled: false - -Metrics/LineLength: - Max: 120 - -Performance/Casecmp: - Enabled: false - - -Style/AlignHash: - EnforcedHashRocketStyle: table - EnforcedColonStyle: table - -Style/AndOr: - Enabled: false - -Style/ClassAndModuleCamelCase: - Enabled: false - -Style/CollectionMethods: - Enabled: true - -Style/Documentation: - Enabled: false - -Style/FormatString: - EnforcedStyle: percent - -Style/HashSyntax: - EnforcedStyle: ruby19_no_mixed_keys - -Style/RescueModifier: - Enabled: false - -Style/SignalException: - Enabled: false - -Style/SymbolArray: - Enabled: true - -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: consistent_comma - -# Minitest::Spec uses long blocks to contains the specs, so disable this check -# for the tests. -Metrics/BlockLength: - Max: 10 - Exclude: - - 'spec/**/*' - - 't/**/*' - - 'test/**/*' - - '*.gemspec' From eea9c4d92eec8a7b78d7a22d06a7bf31fae41b51 Mon Sep 17 00:00:00 2001 From: Oliver Denman Date: Mon, 24 Apr 2017 17:18:04 +0100 Subject: [PATCH 9/9] fixup! Add rubocop Rake task --- Rakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Rakefile b/Rakefile index 397c71fb6..1d50ee26d 100644 --- a/Rakefile +++ b/Rakefile @@ -2,4 +2,6 @@ require 'rubocop/rake_task' +RuboCop::RakeTask.new + task default: %w[rubocop]