Skip to content

Commit

Permalink
rubocop 0.37.2, rubocop-rspec 1.4.0, rubycritic 2.7.1, Fixes #44
Browse files Browse the repository at this point in the history
  • Loading branch information
nijikon committed Feb 18, 2016
1 parent 3c8b571 commit 521c381
Show file tree
Hide file tree
Showing 31 changed files with 188 additions and 206 deletions.
14 changes: 6 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

## 1.3.0 (unreleased)
- Move to ruby 2.3.0 by default
- Bump to ruby 2.2.4 and 2.1.8
- Bump sass dependency to 3.4.21
- Bump mongo dependency to 2.2.1
- Bump brakeman dependency to 3.1.4
- Bump simplecov dependency to 0.11.1
- Bump rubocop dependency to 0.35.1
- #17: Bump rubycritic dependency to 2.4.1
- Bump rspec dependency to 3.4.1
- Bump activemodel dependency to 4.2.5
- Bump brakeman dependency to 3.1.5
- Bump simplecov dependency to 0.11.2
- Bump rspec dependency to 3.4.2
- Bump activemodel dependency to 4.2.5.1
- Reorganize how we run rubocop-rspec
- #44: Bump rubocop dependency to 0.37.2
- #17: Bump rubycritic dependency to 2.7.1
- #30: Allow to pass config file to brakeman
- #18: Add bundler-audit which checks for vulnerable versions of gems
- #21: Replace readme validator with required files validators, which allows us to
Expand Down
76 changes: 30 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ PATH
GEM
remote: https://rubygems.org/
specs:
abstract_type (0.0.7)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
Expand All @@ -30,17 +29,13 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
adamantium (0.2.0)
ice_nine (~> 0.11.0)
memoizable (~> 0.4.0)
addressable (2.4.0)
ast (2.2.0)
astrolabe (1.3.1)
parser (~> 2.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
brakeman (3.1.4)
brakeman (3.1.5)
erubis (~> 2.6)
fastercsv (~> 1.5)
haml (>= 3.0, < 5.0)
Expand All @@ -52,19 +47,17 @@ GEM
sass (~> 3.0)
slim (>= 1.3.6, < 4.0)
terminal-table (~> 1.4)
bson (4.0.1)
bson (4.0.2)
builder (3.2.2)
bundler-audit (0.4.0)
bundler (~> 1.2)
thor (~> 0.18)
codeclimate-engine-rb (0.1.0)
codeclimate-engine-rb (0.3.1)
virtus (~> 1.0)
coderay (1.1.0)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concord (0.1.5)
adamantium (~> 0.2.0)
equalizer (~> 0.0.9)
colorize (0.7.7)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.2.5)
Expand All @@ -88,15 +81,15 @@ GEM
sysexits (~> 1.1)
highline (1.7.8)
i18n (0.7.0)
ice_nine (0.11.1)
ice_nine (0.11.2)
json (1.8.3)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
launchy (2.4.3)
addressable (~> 2.3)
method_source (0.8.2)
minitest (5.8.4)
mongo (2.2.2)
mongo (2.2.3)
bson (~> 4.0)
mongoid (5.1.0)
mongoid (5.1.1)
activemodel (~> 4.0)
mongo (~> 2.1)
origin (~> 2.2)
Expand All @@ -107,28 +100,26 @@ GEM
rspec (~> 3.3)
multi_json (1.11.2)
origin (2.2.0)
parser (2.2.3.0)
ast (>= 1.1, < 3.0)
parser (2.3.0.6)
ast (~> 2.2)
powerpack (0.1.1)
private_attr (1.1.0)
procto (0.0.2)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.0.0)
rainbow (2.1.0)
rake (10.5.0)
reek (3.8.1)
codeclimate-engine-rb (~> 0.1.0)
parser (~> 2.2, >= 2.2.2.5)
reek (3.10.1)
codeclimate-engine-rb (~> 0.3.1)
parser (~> 2.3)
private_attr (~> 1.1)
rainbow (~> 2.0)
unparser (~> 0.2.2)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.1)
rspec-core (3.4.2)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -137,36 +128,37 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubocop (0.35.1)
astrolabe (~> 1.3)
parser (>= 2.2.3.0, < 3.0)
rubocop (0.37.2)
parser (>= 2.3.0.4, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
tins (<= 1.6.0)
rubocop-rspec (1.3.1)
unicode-display_width (~> 0.3)
rubocop-rspec (1.4.0)
ruby-progressbar (1.7.5)
ruby2ruby (2.2.0)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.7.2)
ruby_parser (3.7.3)
sexp_processor (~> 4.1)
rubycritic (2.4.1)
rubycritic (2.7.1)
colorize
flay (= 2.6.1)
flog (= 4.3.2)
parser (>= 2.2.0, < 3.0)
reek (= 3.8.1)
launchy (= 2.4.3)
parser (~> 2.3)
reek (= 3.10.1)
virtus (~> 1.0)
safe_yaml (1.0.4)
sass (3.4.21)
sexp_processor (4.6.0)
sexp_processor (4.6.1)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.11.1)
simplecov (0.11.2)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
Expand All @@ -182,17 +174,9 @@ GEM
thread_safe (0.3.5)
tilt (2.0.2)
timecop (0.8.0)
tins (1.6.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unparser (0.2.4)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
concord (~> 0.1.5)
diff-lcs (~> 1.2.5)
equalizer (~> 0.0.9)
parser (~> 2.2.2)
procto (~> 0.0.2)
unicode-display_width (0.3.1)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
Expand Down
30 changes: 15 additions & 15 deletions config/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
AlignParameters:
Enabled: false
ClassLength:
CountComments: false
Max: 200
LineLength:
Max: 99
MethodLength:
CountComments: false
Max: 15
Metrics/AbcSize:
Max: 25
AllCops:
TargetRubyVersion: 2.3
Exclude:
- bin/**/*
- db/**/*
Expand All @@ -28,8 +17,19 @@ AllCops:
- lib/tasks/**/*.rb
- lib/capistrano/**/*.rb
- lib/capistrano/**/*.cap
AlignParameters:
Enabled: false
ClassLength:
CountComments: false
Max: 200
LineLength:
Max: 99
MethodLength:
CountComments: false
Max: 15
Metrics/AbcSize:
Max: 25
Style/MultilineOperationIndentation:
EnforcedStyle: indented
SupportedStyles:
- aligned
- indented

inherit_from: rubocop_todo.yml
14 changes: 14 additions & 0 deletions config/rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-02-18 19:14:30 +0100 using RuboCop version 0.37.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 74
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: when_needed, always
Style/FrozenStringLiteralComment:
Enabled: false
8 changes: 4 additions & 4 deletions lib/polish_geeks/dev_tools/commands/allowed_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AllowedExtensions < Base
yml
rb.example
yml.example
)
).freeze

# Executes this command
# @return [Array] command output array with list of
Expand All @@ -20,9 +20,9 @@ def execute
results = Dir[config_path]

@output = results
.flatten
.map { |line| line.gsub!(PolishGeeks::DevTools.app_root + '/config/', '') }
.uniq
.flatten
.map { |line| line.gsub!(PolishGeeks::DevTools.app_root + '/config/', '') }
.uniq
@output.delete_if do |line|
ALLOWED_EXTENSIONS.any? { |allow| line =~ /^.*\.#{allow}$/i }
end
Expand Down
6 changes: 3 additions & 3 deletions lib/polish_geeks/dev_tools/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Base
# Available command types. We have validators that check something
# and that should have a 'valid?' method and that check for errors, etc
# and generators that are executed to generate some stats, docs, etc
TYPES = %i( validator generator )
TYPES = %i( validator generator ).freeze

class << self
# ConfigManager instance can be provided, which allows us to find a
Expand All @@ -33,14 +33,14 @@ class << self

# @raise [NotImplementedError] this should be implemented in a subclass
def execute
fail Errors::NotImplementedError
raise Errors::NotImplementedError
end

# @raise [NotImplementedError] this should be implemented in a subclass
# if it is a validator type (or no implementation required when
# it is a validator)
def valid?
fail Errors::NotImplementedError
raise Errors::NotImplementedError
end

# @return [String] what message should be printed when error occures
Expand Down
2 changes: 1 addition & 1 deletion lib/polish_geeks/dev_tools/commands/brakeman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Brakeman < Base
templates: /Template.* (\d+)/,
errors: /Error.* (\d+)/,
warnings: /Warning.* (\d+)/
}
}.freeze

# Executes this command
# @return [String] command output
Expand Down
2 changes: 1 addition & 1 deletion lib/polish_geeks/dev_tools/commands/empty_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EmptyMethods < Base
public
app/assets/images
app/assets/fonts
)
).freeze

# Executes this command and set output and counter variables
def execute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module StringRefinements
# Regex to determine end of method
END_REGEX = /^\s*end(\.\w+(\s+|$)|\s*#.+|\s+|$)\s*/
# Regex to determine begin of method definition through define_method
DEFINE_METHOD = '^\s*(define_method|define_singleton_method)'
DEFINE_METHOD = '^\s*(define_method|define_singleton_method)'.freeze
# Regex to determine definition of method with do-end block
DEFINE_METHOD_WITH_DO_END =
/#{DEFINE_METHOD}(\s+|\().*do(\s*(\s*|.*\|\s*))(\s*|#.*)$/
Expand Down
20 changes: 13 additions & 7 deletions lib/polish_geeks/dev_tools/commands/examples_comparator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ def execute

Dir[config_path].each do |example_file|
dedicated_file = example_file.gsub('.example', '')

header = compare_header(example_file, dedicated_file)

if same_key_structure?(example_file, dedicated_file)
@output << successful_compare(header)
else
@output << failed_compare(header)
end
@output << compare_output(header, example_file, dedicated_file)
end
end

Expand Down Expand Up @@ -58,6 +52,18 @@ def compare_header(example_file, dedicated_file)
"#{File.basename(example_file)} and #{File.basename(dedicated_file)}"
end

# @param [String] header output message
# @param [File] example_file which we compare with dedicated one
# @param [File] dedicated_file which is compared with example one
# @return [String] success/failure message for single file
def compare_output(header, example_file, dedicated_file)
if same_key_structure?(example_file, dedicated_file)
successful_compare(header)
else
failed_compare(header)
end
end

# @param [String] compare_header output message
# @return [String] success message for single file
def successful_compare(compare_header)
Expand Down
12 changes: 6 additions & 6 deletions lib/polish_geeks/dev_tools/commands/expires_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class ExpiresIn < Base
CHECKED_DIRS = %w(
app
lib
)
).freeze

# Regexp that we want to use to catch invalid things that occur
# instead of expires_in
CHECKED_REGEXP = 'expire_in\|expir_in'
CHECKED_REGEXP = 'expire_in\|expir_in'.freeze

# Executes this command
def execute
Expand All @@ -23,10 +23,10 @@ def execute
end

@output = results
.flatten
.map { |line| line.split(':').first }
.map { |line| line.gsub!(PolishGeeks::DevTools.app_root, '') }
.uniq
.flatten
.map { |line| line.split(':').first }
.map { |line| line.gsub!(PolishGeeks::DevTools.app_root, '') }
.uniq

@output.delete_if do |line|
excludes.any? { |exclude| line =~ /#{exclude}/ }
Expand Down
Loading

0 comments on commit 521c381

Please sign in to comment.