Skip to content

Commit

Permalink
Switched to RuboCop for code style checking
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Nov 6, 2013
1 parent 554127d commit 34a447c
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 18 deletions.
178 changes: 178 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
HashSyntax:
EnforcedStyle: hash_rockets

StringLiterals:
Enabled: false
EnforcedStyle: double_quotes

SignalException:
EnforcedStyle: only_raise

# This configuration was generated by `rubocop --auto-gen-config`.
# The point is for the user to remove these configuration records
# one by one as the offences are removed from the code base.

Alias:
Enabled: false

AndOr:
Enabled: false

AsciiComments:
Enabled: false

AssignmentInCondition:
Enabled: false

BlockAlignment:
Enabled: false

Blocks:
Enabled: false

BracesAroundHashParameters:
Enabled: false

CaseEquality:
Enabled: false

ClassLength:
Enabled: false

CollectionMethods:
Enabled: false

ColonMethodCall:
Enabled: false

CommentAnnotation:
Enabled: false

ConstantName:
Enabled: false

DefWithoutParentheses:
Enabled: false

Documentation:
Enabled: false

EmptyLines:
Enabled: false

EmptyLiteral:
Enabled: false

EndAlignment:
Enabled: false

Eval:
Enabled: false

FavorUnlessOverNegatedIf:
Enabled: false

IfUnlessModifier:
Enabled: false

IndentationWidth:
Enabled: false

Lambda:
Enabled: false

LeadingCommentSpace:
Enabled: false

LineLength:
Enabled: false

MethodCallParentheses:
Enabled: false

MethodLength:
Enabled: false

MultilineIfThen:
Enabled: false

NilComparison:
Enabled: false

Not:
Enabled: false

PerlBackrefs:
Enabled: false

Proc:
Enabled: false

RedundantBegin:
Enabled: false

RedundantReturn:
Enabled: false

RedundantSelf:
Enabled: false

RegexpLiteral:
Enabled: false

RescueException:
Enabled: false

Semicolon:
Enabled: false

ShadowingOuterLocalVariable:
Enabled: false

SingleLineMethods:
Enabled: false

SpaceAfterComma:
Enabled: false

SpaceAfterMethodName:
Enabled: false

SpaceAroundBlockBraces:
Enabled: false

SpaceAroundOperators:
Enabled: false

SpaceInsideBrackets:
Enabled: false

SpaceInsideHashLiteralBraces:
Enabled: false

SpaceInsideParens:
Enabled: false

SpecialGlobalVars:
Enabled: false

TrailingWhitespace:
Enabled: false

TrivialAccessors:
Enabled: false

UnreachableCode:
Enabled: false

UselessAssignment:
Enabled: false

UselessComparison:
Enabled: false

Void:
Enabled: false

WordArray:
Enabled: false
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ group :development do
gem "mocha-on-bacon"
gem "rake"
gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
gem 'tailor'
gem 'rubocop'
end

group :debugging do
Expand All @@ -28,4 +28,3 @@ group :documentation do
gem 'github-markup'
gem 'pygments.rb'
end

18 changes: 11 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GEM
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
ast (1.1.0)
awesome_print (1.2.0)
bacon (1.2.0)
coderay (1.0.9)
Expand All @@ -46,7 +47,6 @@ GEM
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
log_switch (0.4.0)
metaclass (0.0.1)
method_source (0.8.2)
mime-types (1.25)
Expand All @@ -57,14 +57,19 @@ GEM
multi_json (1.8.2)
nap (0.5.1)
notify (0.5.2)
parser (2.0.0)
ast (~> 1.1)
slop (~> 3.4, >= 3.4.5)
posix-spawn (0.3.6)
powerpack (0.0.9)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pygments.rb (0.5.2)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rainbow (1.1.4)
rake (10.1.0)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
Expand All @@ -74,18 +79,17 @@ GEM
redcarpet (3.0.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rubocop (0.14.1)
parser (~> 2.0)
powerpack (~> 0.0.6)
rainbow (>= 1.1.4)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (3.4.6)
tailor (1.3.1)
log_switch (>= 0.3.0)
term-ansicolor (>= 1.0.5)
text-table (>= 1.2.2)
term-ansicolor (1.2.2)
tins (~> 0.8)
text-table (1.2.3)
thor (0.18.1)
tins (0.12.0)
yajl-ruby (1.1.0)
Expand All @@ -110,5 +114,5 @@ DEPENDENCIES
rake
rb-fsevent
redcarpet
tailor
rubocop
yard
38 changes: 30 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ namespace :spec do

task :all do
ENV['GENERATE_COVERAGE'] = 'true'

title "Running Unit Tests"
sh "bundle exec bacon #{specs('**')}"
puts "Checking code style..."
Rake::Task["tailor"].invoke

title "Checking code style..."
Rake::Task["rubocop"].invoke
end

desc "Checks that the gem is capable of loading all the specs of the master repo."
Expand Down Expand Up @@ -195,14 +198,33 @@ end
desc "Run all specs"
task :spec => 'spec:all'

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3')
require 'tailor/rake_task'
Tailor::RakeTask.new
else
desc "Check style"
task :tailor do
#-----------------------------------------------------------------------------#

desc 'Checks code style'
task :rubocop do
if RUBY_VERSION >= '1.9.3'
require 'rubocop'
patterns = ['lib/**/*.rb']
fail_on_error = false
verbose = false
cli = Rubocop::CLI.new
puts 'Running RuboCop...' if verbose
result = cli.run(patterns)
abort('RuboCop failed!') if fail_on_error unless result == 0
else
puts "[!] Ruby > 1.9 is required to run style checks"
end
end

#-----------------------------------------------------------------------------#

task :default => :spec

def title(title)
cyan_title = "\033[0;36m#{title}\033[0m"
puts
puts "-" * 80
puts cyan_title
puts "-" * 80
puts
end
1 change: 0 additions & 1 deletion spec/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,3 @@ module Pod

end
end

0 comments on commit 34a447c

Please sign in to comment.