Class: CI::Syntax::Tool::Result::LanguageResult

Inherits:
CI::Syntax::Tool::Result show all
Defined in:
lib/ci-syntax-tool/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lang_name) ⇒ LanguageResult

Returns a new instance of LanguageResult.



68
69
70
71
# File 'lib/ci-syntax-tool/result.rb', line 68

def initialize(lang_name)
  @language_name = lang_name
  @file_results = {}
end

Instance Attribute Details

#file_resultsObject (readonly)

Returns the value of attribute file_results.



65
66
67
# File 'lib/ci-syntax-tool/result.rb', line 65

def file_results
  @file_results
end

#language_nameObject (readonly)

Returns the value of attribute language_name.



66
67
68
# File 'lib/ci-syntax-tool/result.rb', line 66

def language_name
  @language_name
end

Instance Method Details

#add_file_result(path) ⇒ Object



73
74
75
# File 'lib/ci-syntax-tool/result.rb', line 73

def add_file_result(path)
  file_results[path] = FileResult.new(path)
end

#error_countObject



77
78
79
80
81
# File 'lib/ci-syntax-tool/result.rb', line 77

def error_count
  file_results.inject(0) do |total, (path,result)|
    total += result.error_count
  end
end

#error_file_resultsObject



93
94
95
# File 'lib/ci-syntax-tool/result.rb', line 93

def error_file_results
  file_results.values.select { |fr| fr.error_count > 0 }
end

#warning_countObject



83
84
85
86
87
# File 'lib/ci-syntax-tool/result.rb', line 83

def warning_count
  file_results.inject(0) do |total, (path,result)|
    total += result.warning_count
  end
end

#warning_file_resultsObject



89
90
91
# File 'lib/ci-syntax-tool/result.rb', line 89

def warning_file_results
  file_results.values.select { |fr| fr.warning_count > 0 }
end