Skip to content

Commit

Permalink
Add Rubocop (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kke authored and jakolehm committed Oct 18, 2018
1 parent 6e9a7ba commit 0afd61c
Show file tree
Hide file tree
Showing 26 changed files with 527 additions and 256 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
/pkg/
/spec/reports/
/tmp/
Gemfile.lock
.ruby-version

# rspec failure tracking
.rspec_status
.rspec-local

176 changes: 176 additions & 0 deletions .rubocop.relaxed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Relaxed.Ruby.Style
## Version 2.2

Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias

Style/AsciiComments:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleasciicomments

Style/BeginBlock:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylebeginblock

Style/BlockDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters

Style/CommentAnnotation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation

Style/Documentation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledocumentation

Layout/DotPosition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#layoutdotposition

Style/DoubleNegation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledoublenegation

Style/EndBlock:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleendblock

Style/FormatString:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleformatstring

Style/IfUnlessModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier

Style/Lambda:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylelambda

Style/ModuleFunction:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemodulefunction

Style/MultilineBlockChain:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain

Style/NegatedIf:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedif

Style/NegatedWhile:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile

Style/ParallelAssignment:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment

Style/PercentLiteralDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters

Style/PerlBackrefs:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs

Style/Semicolon:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesemicolon

Style/SignalException:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesignalexception

Style/SingleLineBlockParams:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams

Style/SingleLineMethods:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods

Layout/SpaceBeforeBlockBraces:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#layoutspacebeforeblockbraces

Layout/SpaceInsideParens:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#layoutspaceinsideparens

Style/SpecialGlobalVars:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars

Style/StringLiterals:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylestringliterals

# Style/TrailingCommaInArguments:
# Enabled: false
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
#
# Style/TrailingCommaInArrayLiteral:
# Enabled: false
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarrayliteral
#
# Style/TrailingCommaInHashLiteral:
# Enabled: false
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainhashliteral

Style/WhileUntilModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier

Style/WordArray:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewordarray

Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral

Lint/AssignmentInCondition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition

Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ParameterLists:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Naming/VariableName: # disabled because camelCased params are used in kube api/yamls
Enabled: false

Naming/UncommunicativeMethodParamName: # disabled because camelCased params are used in kube api/yamls
Enabled: false

Naming/FileName:
Enabled: true
Exclude:
- lib/k8s-client.rb # ignored because gem name is k8s-client, so 'require k8s-client' and gem 'k8s-client' in Gemfile work
57 changes: 57 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
inherit_from: .rubocop.relaxed.yml

AllCops:
Exclude:
- spec/**/*
- Gemfile
- "*.gemspec"
- bundler/**/*
TargetRubyVersion: 2.4

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
'%i': '()'
'%I': '()'
'%r': '{}'
'%w': '()'
'%W': '()'

Style/FormatString:
EnforcedStyle: percent

Style/FrozenStringLiteralComment:
EnforcedStyle: always

Style/WordArray:
Enabled: true
MinSize: 3

Style/SymbolArray:
Enabled: true
MinSize: 3

Gemspec/OrderedDependencies:
Enabled: false

Style/PerlBackrefs:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

Style/SpecialGlobalVars:
Enabled: true

Style/Alias:
Enabled: true

Style/BeginBlock:
Enabled: true

Naming/UncommunicativeMethodParamName:
AllowedNames:
- cn

Metrics/BlockLength:
Enabled: false
12 changes: 11 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
RuboCop::RakeTask.new(:rubocop).tap do |task|
task.options = %w(--fail-level A -S --format c)
if RUBY_ENGINE == 'ruby' && RbConfig::CONFIG['host_os'] !~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
task.options << '--parallel'
end
end

task default: [:spec, :rubocop]
Loading

0 comments on commit 0afd61c

Please sign in to comment.