Class: Danger::DangerXcodeSummary
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerXcodeSummary
- Defined in:
- lib/xcode_summary/plugin.rb
Overview
Shows all build errors, warnings and unit tests results generated from ‘xcodebuild`. You need to use the `xcresult` produced by Xcode 11. It’s located in the Derived Data folder.
Defined Under Namespace
Instance Attribute Summary collapse
-
#ignored_files ⇒ [String]
A globbed string or array of strings which should match the files that you want to ignore warnings on.
-
#ignored_results(&block) ⇒ Block
A block that filters specific results.
-
#ignores_warnings ⇒ Boolean
Defines if warnings should be included or not Defaults to ‘false`.
-
#inline_mode ⇒ Boolean
Defines if using inline comment or not.
-
#project_root ⇒ Object
rubocop:disable Lint/DuplicateMethods.
-
#strict ⇒ Boolean
Defines errors strict.
Instance Method Summary collapse
-
#plugin ⇒ void
Pick a Dangerfile plugin for a chosen request_source and cache it based on github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31.
-
#report(file_path) ⇒ void
Reads a ‘.xcresult` and reports it.
-
#warning_error_count(file_path) ⇒ String
Reads a ‘.xcresult` and reports its warning and error count.
Instance Attribute Details
#ignored_files ⇒ [String]
A globbed string or array of strings which should match the files that you want to ignore warnings on. Defaults to nil. An example would be ‘’/Pods/‘` to ignore warnings in Pods that your project uses.
37 38 39 |
# File 'lib/xcode_summary/plugin.rb', line 37 def ignored_files @ignored_files end |
#ignored_results(&block) ⇒ Block
A block that filters specific results. An example would be ‘lambda { |result| result.message.start_with?(’ld’) }‘ to ignore results for ld_warnings.
44 45 46 |
# File 'lib/xcode_summary/plugin.rb', line 44 def ignored_results @ignored_results end |
#ignores_warnings ⇒ Boolean
Defines if warnings should be included or not Defaults to ‘false`.
56 57 58 |
# File 'lib/xcode_summary/plugin.rb', line 56 def ignores_warnings @ignores_warnings end |
#inline_mode ⇒ Boolean
Defines if using inline comment or not. Defaults to ‘false`.
50 51 52 |
# File 'lib/xcode_summary/plugin.rb', line 50 def inline_mode @inline_mode end |
#project_root ⇒ Object
rubocop:disable Lint/DuplicateMethods
29 30 31 |
# File 'lib/xcode_summary/plugin.rb', line 29 def project_root @project_root end |
#strict ⇒ Boolean
Defines errors strict. If value is ‘false`, then errors will be reporting as warnings. Defaults to `true`
62 63 64 |
# File 'lib/xcode_summary/plugin.rb', line 62 def strict @strict end |
Instance Method Details
#plugin ⇒ void
This method returns an undefined value.
Pick a Dangerfile plugin for a chosen request_source and cache it based on github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
95 96 97 98 |
# File 'lib/xcode_summary/plugin.rb', line 95 def plugin plugins = Plugin.all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin } @plugin ||= plugins.select { |p| p.method_defined? :html_link }.map { |p| p.new(@dangerfile) }.compact.first end |
#report(file_path) ⇒ void
This method returns an undefined value.
Reads a ‘.xcresult` and reports it.
105 106 107 108 109 110 111 112 |
# File 'lib/xcode_summary/plugin.rb', line 105 def report(file_path) if File.exist?(file_path) xcode_summary = XCResult::Parser.new(path: file_path) format_summary(xcode_summary) else fail 'summary file not found' end end |
#warning_error_count(file_path) ⇒ String
Reads a ‘.xcresult` and reports its warning and error count.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/xcode_summary/plugin.rb', line 118 def warning_error_count(file_path) if File.exist?(file_path) xcode_summary = XCResult::Parser.new(path: file_path) warning_count = 0 error_count = 0 xcode_summary.actions_invocation_record.actions.each do |action| warning_count += warnings(action).count error_count += errors(action).count end result = { warnings: warning_count, errors: error_count } result.to_json else fail 'summary file not found' end end |