-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathreek.rb
More file actions
33 lines (26 loc) · 687 Bytes
/
reek.rb
File metadata and controls
33 lines (26 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# encoding: utf-8
require 'pre-commit/checks/shell'
# Plugins for pre-commit
module PreCommit
# Checking plugins for pre-commit
module Checks
# Runs reek to detect ruby code smells
class Reek < Shell
def call(staged_files)
staged_files = staged_files.grep(/\.rb/)
return if staged_files.empty?
args = (config_file_flag + staged_files).join(' ')
execute("reek #{args}")
end
def config_file_flag
config_file ? ['-c', config_file] : []
end
def alternate_config_file
'config/.reek'
end
def self.description
"Runs reek to detect ruby code smells"
end
end
end
end