Skip to content

Commit

Permalink
Merge pull request #4 from thinkific/update-rubocop-version
Browse files Browse the repository at this point in the history
update-rubocop-version
  • Loading branch information
kbluescode authored Sep 6, 2019
2 parents d1326cc + 78520a9 commit dee6345
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 143 deletions.
148 changes: 47 additions & 101 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
AllCops:
TargetRubyVersion: 2.3

################## Layout #################################

Layout/AccessModifierIndentation:
Expand Down Expand Up @@ -98,26 +95,26 @@ Layout/InitialIndentation:
Checks the indentation of the first non-blank non-comment line in a file.
Enabled: false

Layout/FirstParameterIndentation:
Description: 'Checks the indentation of the first parameter in a method call.'
Layout/IndentFirstArgument:
Description: 'Checks the indentation of the first argument in a method call.'
Enabled: false

Layout/IndentationConsistency:
Description: 'Keep indentation straight.'
Enabled: false
EnforcedStyle: rails

Layout/IndentationWidth:
Description: 'Use 2 spaces for indentation.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
Enabled: true

Layout/IndentArray:
Layout/IndentFirstArrayElement:
Description: >-
Checks the indentation of the first element in an array
literal.
Enabled: false

Layout/IndentHash:
Layout/IndentFirstHashElement:
Description: 'Checks the indentation of the first key in a hash literal.'
Enabled: false

Expand Down Expand Up @@ -261,6 +258,27 @@ Layout/TrailingWhitespace:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
Enabled: true

Layout/BlockAlignment:
Description: 'Align block ends correctly.'
Enabled: true

Layout/ConditionPosition:
Description: >-
Checks for condition placed in a confusing position relative to
the keyword.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
Enabled: true

Layout/DefEndAlignment:
Description: 'Align ends corresponding to defs correctly.'
Enabled: true
AutoCorrect: true

Layout/EndAlignment:
Description: 'Align ends correctly.'
Enabled: true
AutoCorrect: true

#################### Lint ################################

Lint/AmbiguousOperator:
Expand All @@ -283,31 +301,15 @@ Lint/AssignmentInCondition:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
Enabled: true

Lint/BlockAlignment:
Description: 'Align block ends correctly.'
Enabled: true

Lint/CircularArgumentReference:
Description: "Don't refer to the keyword argument in the default value."
Enabled: true

Lint/ConditionPosition:
Description: >-
Checks for condition placed in a confusing position relative to
the keyword.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
Enabled: true

Lint/Debugger:
Description: 'Check for debugger calls.'
AutoCorrect: false
Enabled: true

Lint/DefEndAlignment:
Description: 'Align ends corresponding to defs correctly.'
Enabled: true
AutoCorrect: true

Lint/DeprecatedClassMethods:
Description: 'Check for deprecated class method calls.'
Enabled: true
Expand All @@ -332,11 +334,6 @@ Lint/EmptyInterpolation:
Description: 'Checks for empty string interpolation.'
Enabled: true

Lint/EndAlignment:
Description: 'Align ends correctly.'
Enabled: true
AutoCorrect: true

Lint/EndInMethod:
Description: 'END blocks should not be placed inside method definitions.'
Enabled: true
Expand Down Expand Up @@ -412,7 +409,7 @@ Lint/UnderscorePrefixedVariableName:
Description: 'Do not use prefix `_` for a variable that is used.'
Enabled: true

Lint/UnneededDisable:
Lint/UnneededCopDisableDirective:
Description: >-
Checks for rubocop:disable comments that can be removed.
Note: this cop is not disabled when disabling all cops.
Expand Down Expand Up @@ -458,6 +455,11 @@ Lint/Void:
Description: 'Possible use of operator/literal/variable in void context.'
Enabled: true

Lint/FlipFlop:
Description: 'Checks for flip flops'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
Enabled: true

###################### Metrics ####################################

Metrics/AbcSize:
Expand All @@ -468,13 +470,6 @@ Metrics/AbcSize:
Enabled: false
Max: 20

Metrics/BlockLength:
Description: 'Avoid blocks that are too large'
Enabled: true
Max: 25
Exclude:
- spec/**/*

Metrics/BlockNesting:
Description: 'Avoid excessive block nesting'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
Expand Down Expand Up @@ -571,62 +566,6 @@ Naming/VariableName:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
Enabled: true

##################### Performance #############################

Performance/Count:
Description: >-
Use `count` instead of `select...size`, `reject...size`,
`select...count`, `reject...count`, `select...length`,
and `reject...length`.
Enabled: true

Performance/Detect:
Description: >-
Use `detect` instead of `select.first`, `find_all.first`,
`select.last`, and `find_all.last`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
Enabled: true

Performance/FlatMap:
Description: >-
Use `Enumerable#flat_map`
instead of `Enumerable#map...Array#flatten(1)`
or `Enumberable#collect..Array#flatten(1)`
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
Enabled: true
EnabledForFlattenWithoutParams: false
# If enabled, this cop will warn about usages of
# `flatten` being called without any parameters.
# This can be dangerous since `flat_map` will only flatten 1 level, and
# `flatten` without any parameters can flatten multiple levels.

Performance/ReverseEach:
Description: 'Use `reverse_each` instead of `reverse.each`.'
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
Enabled: true

Performance/Sample:
Description: >-
Use `sample` instead of `shuffle.first`,
`shuffle.last`, and `shuffle[Fixnum]`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
Enabled: true

Performance/Size:
Description: >-
Use `size` instead of `count` for counting
the number of elements in `Array` and `Hash`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
Enabled: true

Performance/StringReplacement:
Description: >-
Use `tr` instead of `gsub` when you are replacing the same
number of characters. Use `delete` instead of `gsub` when
you are deleting characters.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
Enabled: true

##################### Rails ##################################

Rails/ActionFilter:
Expand Down Expand Up @@ -814,11 +753,6 @@ Style/EvenOdd:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
Enabled: true

Style/FlipFlop:
Description: 'Checks for flip flops'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
Enabled: true

Style/For:
Description: 'Checks use of for or each in multiline loops.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
Expand Down Expand Up @@ -1116,8 +1050,13 @@ Style/TrailingCommaInArguments:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
Enabled: true

Style/TrailingCommaInLiteral:
Description: 'Checks for trailing comma in literals.'
Style/TrailingCommaInArrayLiteral:
Description: 'Checks for trailing comma in array literals.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled: true

Style/TrailingCommaInHashLiteral:
Description: 'Checks for trailing comma in hash literals.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled: true

Expand Down Expand Up @@ -1175,4 +1114,11 @@ Style/WhileUntilModifier:
Style/WordArray:
Description: 'Use %w or %W for arrays of words.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
Enabled: true
Enabled: true

Style/Sample:
Description: >-
Use `sample` instead of `shuffle.first`,
`shuffle.last`, and `shuffle[Fixnum]`.
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
Enabled: true
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ MAINTAINER Kevin Blues <kevin@thinkific.com>

ARG DEPS="\
bash \
build-base \
dumb-init \
git \
"
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
cloud_secret_env (0.1.0)
cloud_secret_env (0.1.1)
aws-sdk (~> 2)

GEM
Expand All @@ -20,12 +20,12 @@ GEM
aws-eventstream (~> 1.0, >= 1.0.2)
coderay (1.1.2)
diff-lcs (1.3)
jaro_winkler (1.5.3)
jmespath (1.4.0)
method_source (0.9.2)
parallel (1.13.0)
parser (2.6.0.0)
parallel (1.17.0)
parser (2.6.4.0)
ast (~> 2.4.0)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand All @@ -44,15 +44,15 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.52.1)
rubocop (0.71.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.0)
unicode-display_width (1.4.1)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
unicode-display_width (1.6.0)

PLATFORMS
ruby
Expand All @@ -63,7 +63,7 @@ DEPENDENCIES
pry (~> 0.10)
rake (~> 10.0)
rspec (~> 3.0)
rubocop (~> 0.42)
rubocop (= 0.71)

BUNDLED WITH
1.17.3
4 changes: 2 additions & 2 deletions cloud_secret_env.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cloud_secret_env/version'

Expand All @@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry', '~> 0.10'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.42'
spec.add_development_dependency 'rubocop', '0.71'
spec.add_runtime_dependency 'aws-sdk', '~> 2'
end
38 changes: 19 additions & 19 deletions lib/cloud_secret_env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ def run

private

def provider
case @config.provider
when AWS_PROVIDER
Providers::AWS.new(
access_key: @config.access_key,
secret_key: @config.secret_key,
region: @config.region,
profile_name: @config.profile_name,
secret_ids: @config.secret_ids
)
def provider
case @config.provider
when AWS_PROVIDER
Providers::AWS.new(
access_key: @config.access_key,
secret_key: @config.secret_key,
region: @config.region,
profile_name: @config.profile_name,
secret_ids: @config.secret_ids
)
end
end
end

def push_env!(secrets)
block = if @config.override
->(k, v) { ENV[k] = v }
else
->(k, v) { ENV[k] = v unless ENV[k] }
end
secrets.each(&block)
end
def push_env!(secrets)
block = if @config.override
->(k, v) { ENV[k] = v }
else
->(k, v) { ENV[k] = v unless ENV[k] }
end
secrets.each(&block)
end
end
end
1 change: 1 addition & 0 deletions lib/cloud_secret_env/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ConfigValidationError < StandardError; end
def provider=(provider)
provider = provider.to_sym
raise ProviderNotFound, "Provider '#{provider}' not found" unless ::CloudSecretEnv::PROVIDERS.include?(provider)

@provider = provider
end

Expand Down
Loading

0 comments on commit dee6345

Please sign in to comment.