Module: RenuoBinCheck::DefaultScripts

Defined in:
lib/renuo_bin_check/default_scripts/default_rails.rb

Overview

rubocop:disable Metrics/ModuleLength

Class Method Summary collapse

Class Method Details

.brakeman(bin_check) ⇒ Object



122
123
124
125
126
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 122

def brakeman(bin_check)
  bin_check.check do |config|
    config.command 'bundle exec brakeman -q -z --summary > /dev/null'
  end
end

.coffeelint(bin_check) ⇒ Object



115
116
117
118
119
120
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 115

def coffeelint(bin_check)
  bin_check.check do |config|
    config.command 'coffeelint -f .coffeelint.json app/assets/javascripts/**/*.coffee'
    config.files ['app/assets/javascripts/**/*.coffee']
  end
end

.console_log(bin_check) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 47

def console_log(bin_check)
  bin_check.check do |config|
    config.command "grep -i -r 'console.log' app spec"
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*']
  end
end

.mini_profiler(bin_check) ⇒ Object

rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength



30
31
32
33
34
35
36
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 30

def mini_profiler(bin_check)
  bin_check.check do |config|
    config.command "grep 'rack-mini-profiler' Gemfile.lock >> /dev/null"
    config.reversed_exit true
    config.files ['Gemfile.lock']
  end
end

.p_with_brackets(bin_check) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 79

def p_with_brackets(bin_check)
  bin_check.check do |config|
    config.command "grep -i -r '  p(' app spec"
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*']
  end
end

.pp_and_p(bin_check) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 71

def pp_and_p(bin_check)
  bin_check.check do |config|
    config.command "grep -i -r '(  pp? [^=])|(= pp? )' app spec"
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*']
  end
end

.put_with_brackets(bin_check) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 63

def put_with_brackets(bin_check)
  bin_check.check do |config|
    config.command "grep -i -r '  puts(' app spec"
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*']
  end
end

.put_without_brackets(bin_check) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 55

def put_without_brackets(bin_check)
  bin_check.check do |config|
    config.command "grep -i -r '  puts ' app spec"
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*']
  end
end

.railsObject

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength :reek:TooManyStatements



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 7

def rails
  bin_check = RenuoBinCheck::Initializer.new

  mini_profiler(bin_check)
  todo(bin_check)
  console_log(bin_check)
  put_without_brackets(bin_check)
  put_with_brackets(bin_check)
  pp_and_p(bin_check)
  p_with_brackets(bin_check)
  rubocop_autocorrect(bin_check)
  slim_lint(bin_check)
  scss_lint(bin_check)
  tslint(bin_check)
  brakeman(bin_check)
  reek(bin_check)
  rspec(bin_check)

  bin_check.run
end

.reek(bin_check) ⇒ Object



128
129
130
131
132
133
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 128

def reek(bin_check)
  bin_check.check do |config|
    config.command 'bundle exec reek'
    config.files ['app/**/*.rb']
  end
end

.rspec(bin_check) ⇒ Object



135
136
137
138
139
140
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 135

def rspec(bin_check)
  bin_check.check do |config|
    config.command 'bundle exec rspec'
    config.files ['app/**/*.rb', 'spec/**/*.rb']
  end
end

.rubocop_autocorrect(bin_check) ⇒ Object



87
88
89
90
91
92
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 87

def rubocop_autocorrect(bin_check)
  bin_check.check do |config|
    config.command 'bundle exec rubocop -a -D -c .rubocop.yml'
    config.files ['app/**/*.rb', 'spec/**/*.rb']
  end
end

.scss_lint(bin_check) ⇒ Object



101
102
103
104
105
106
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 101

def scss_lint(bin_check)
  bin_check.check do |config|
    config.command 'scss-lint app/assets/stylesheets/**/*.scss'
    config.files ['app/assets/stylesheets/**/*.scss']
  end
end

.slim_lint(bin_check) ⇒ Object



94
95
96
97
98
99
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 94

def slim_lint(bin_check)
  bin_check.check do |config|
    config.command 'bundle exec slim-lint app/views/ -c .slim-lint.yml'
    config.files ['app/views/**/*.slim']
  end
end

.todo(bin_check) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 38

def todo(bin_check)
  bin_check.check do |config|
    config.command "grep --exclude-dir='app/assets/typings/**' -i -r 'TODO' app spec config db Rakefile README.md"\
    ' Gemfile'
    config.reversed_exit true
    config.files ['app/**/*', 'spec/**/*', 'config/**/*', 'db/**/*', 'Rakefile', 'README.md', 'Gemfile']
  end
end

.tslint(bin_check) ⇒ Object



108
109
110
111
112
113
# File 'lib/renuo_bin_check/default_scripts/default_rails.rb', line 108

def tslint(bin_check)
  bin_check.check do |config|
    config.command 'tslint -c tslint.json app/assets/javascripts/**/*.ts'
    config.files ['app/assets/javascripts/**/*.ts']
  end
end