From 13f549b2ba46e25da156854efa660f21945e3403 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Fri, 3 Mar 2017 03:25:11 +0100 Subject: [PATCH] Bump rubocop And update config for new/updated cops. --- .rubocop.yml | 24 +++++++++++++++++++++++- Gemfile | 2 +- Gemfile.lock | 6 +++--- lib/node_info.rb | 2 ++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2ee483e70..fae72b1a6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,6 +25,15 @@ Metrics/ModuleLength: Metrics/AbcSize: Max: 20 +# Some blocks are longer. +Metrics/BlockLength: + ExcludedMethods: + - "namespace" + - "create_table" + Exclude: + - "config/**/*.rb" + - "spec/**/*.rb" + # No space makes the method definition shorter and differentiates # from a regular assignment. Style/SpaceAroundEqualsInParameterDefault: @@ -51,7 +60,7 @@ Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys # has_key? and has_value? are far more readable than key? and value? -Style/DeprecatedHashMethods: +Style/PreferredHashMethods: Enabled: false # String#% is by far the least verbose and only object oriented variant. @@ -147,7 +156,20 @@ Style/OpMethod: Lint/Debugger: Enabled: false +# We used comparison everywhere. +Style/NumericPredicate: + EnforcedStyle: comparison # Reset some HoundCI changes back to Rubocop defaults Style/DotPosition: EnforcedStyle: leading + +### backward compatibility + +# only with ruby >= 2.3 +Style/FrozenStringLiteralComment: + Enabled: false + +# only with ruby >= 2.4 +Performance/RegexpMatch: + Enabled: false diff --git a/Gemfile b/Gemfile index e5c1230d4..198509e14 100644 --- a/Gemfile +++ b/Gemfile @@ -244,7 +244,7 @@ group :development do gem "rb-inotify", "0.9.8", require: false # Linters - gem "rubocop", "0.40.0" + gem "rubocop", "0.47.1" gem "haml_lint", "0.18.2" gem "pronto", "0.8.2" gem "pronto-eslint", "0.8.0" diff --git a/Gemfile.lock b/Gemfile.lock index fecf0ad32..8c7807435 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -628,8 +628,8 @@ GEM rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) rspec-support (3.5.0) - rubocop (0.40.0) - parser (>= 2.3.1.0, < 3.0) + rubocop (0.47.1) + parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) @@ -898,7 +898,7 @@ DEPENDENCIES redcarpet (= 3.4.0) responders (= 2.3.0) rspec-rails (= 3.5.2) - rubocop (= 0.40.0) + rubocop (= 0.47.1) ruby-oembed (= 0.10.1) rubyzip (= 1.2.1) sass-rails (= 5.0.6) diff --git a/lib/node_info.rb b/lib/node_info.rb index 0b4657d3a..eb012f98e 100644 --- a/lib/node_info.rb +++ b/lib/node_info.rb @@ -6,6 +6,7 @@ module NodeInfo SCHEMAS = {} private_constant :VERSIONS, :SCHEMAS + # rubocop:disable Metrics/BlockLength Document = Struct.new(:version, :software, :protocols, :services, :open_registrations, :usage, :metadata) do Software = Struct.new(:name, :version) do def initialize(name=nil, version=nil) @@ -132,6 +133,7 @@ module NodeInfo end end end + # rubocop:enable Metrics/BlockLength def self.schema(version) SCHEMAS[version] ||= JSON.parse(