Class: Dblint::Checks::Base
- Inherits:
-
Object
- Object
- Dblint::Checks::Base
show all
- Defined in:
- lib/dblint/checks/base.rb
Instance Method Summary
collapse
Instance Method Details
#check_name ⇒ Object
6
7
8
|
# File 'lib/dblint/checks/base.rb', line 6
def check_name
self.class.name.demodulize
end
|
#config ⇒ Object
27
28
29
30
31
32
|
# File 'lib/dblint/checks/base.rb', line 27
def config
@config ||= begin
config_file = Rails.root.join('.dblint.yml')
YAML.load(File.read(config_file)) if File.exist?(config_file)
end
end
|
#find_main_app_caller(callstack) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/dblint/checks/base.rb', line 10
def find_main_app_caller(callstack)
main_app_caller = callstack.find { |f| f.start_with?(Rails.root.to_s) && !f.include?('/vendor/bundle') }
main_app_caller.slice!(Rails.root.to_s + '/')
main_app_dir = main_app_caller[/^\w+/]
return if %w(spec test).include?(main_app_dir)
main_app_caller
end
|
#ignored?(main_app_caller) ⇒ Boolean
20
21
22
23
24
25
|
# File 'lib/dblint/checks/base.rb', line 20
def ignored?(main_app_caller)
return false unless config && config['IgnoreList']
ignores = config['IgnoreList'][check_name]
ignores.present? && ignores.include?(main_app_caller)
end
|