Class: ShellAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/check_super_calls/shell_adapter.rb

Overview

Adapter which handles shell access.

Instance Method Summary collapse

Instance Method Details

#process_files(ignore_list, base_path) ⇒ Object



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

def process_files(ignore_list, base_path)
  [
    Swift.new,
    ObjC.new
  ].each do |language|
    result = find_files(ignore_list, base_path, language.file_regex)

    result.each do |file|
      file_content = File.open(file, 'r:UTF-8').read

      language.patterns.each do |pattern|
        next if file_content !~ pattern.definition

        if file_content !~ pattern.check
          puts file + ': ' + pattern.name + ' not called'
        end
      end
    end
  end
end