Class: Danger::DangerXcodeWarnings
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerXcodeWarnings
- Defined in:
- lib/xcode_warnings/plugin.rb
Overview
Parse the xcodebuild log file and convert warnings.
Instance Attribute Summary collapse
-
#show_build_timing_summary ⇒ void
Whether show build timing summary or not.
-
#show_build_warnings ⇒ Object
rubocop:disable Lint/DuplicateMethods.
-
#show_linker_warnings ⇒ void
Whether show linker warnings or not.
-
#use_xcpretty ⇒ void
Whether use xcpretty for formatting logs.
Instance Method Summary collapse
-
#analyze(log_text, inline: true, sticky: true) ⇒ void
Parses the log text from xcodebuild and show warnings.
-
#analyze_file(file_path, inline: false, sticky: true) ⇒ void
Parses the log file from xcodebuild and show warnings.
Instance Attribute Details
#show_build_timing_summary ⇒ void
This method returns an undefined value.
Whether show build timing summary or not. The default value is ‘false`.
24 25 26 |
# File 'lib/xcode_warnings/plugin.rb', line 24 def show_build_timing_summary @show_build_timing_summary end |
#show_build_warnings ⇒ Object
rubocop:disable Lint/DuplicateMethods
16 17 18 |
# File 'lib/xcode_warnings/plugin.rb', line 16 def show_build_warnings @show_build_warnings end |
#show_linker_warnings ⇒ void
This method returns an undefined value.
Whether show linker warnings or not. The default value is ‘false`.
20 21 22 |
# File 'lib/xcode_warnings/plugin.rb', line 20 def show_linker_warnings @show_linker_warnings end |
#use_xcpretty ⇒ void
This method returns an undefined value.
Whether use xcpretty for formatting logs. The default value is ‘false`.
28 29 30 |
# File 'lib/xcode_warnings/plugin.rb', line 28 def use_xcpretty @use_xcpretty end |
Instance Method Details
#analyze(log_text, inline: true, sticky: true) ⇒ void
This method returns an undefined value.
Parses the log text from xcodebuild and show warnings.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/xcode_warnings/plugin.rb', line 56 def analyze(log_text, inline: true, sticky: true) if use_xcpretty parser = LogParserXCPretty.new else parser = LogParser.new parser.show_build_timing_summary = show_build_timing_summary end parser.show_build_warnings = show_build_warnings parser.show_linker_warnings = show_linker_warnings parsed = parser.parse_warnings(log_text) parsed.each do |warning| if inline warn(warning[:message], sticky: sticky, file: warning[:file], line: warning[:line]) else warn MessageFormatter.new.format(warning) end end "Detected #{parsed.count} build-time warnings." unless parsed.empty? parser.parse_build_timing_summary(log_text) end |
#analyze_file(file_path, inline: false, sticky: true) ⇒ void
This method returns an undefined value.
Parses the log file from xcodebuild and show warnings.
85 86 87 88 89 90 91 92 |
# File 'lib/xcode_warnings/plugin.rb', line 85 def analyze_file(file_path, inline: false, sticky: true) File.open(file_path) do |f| puts "Opened #{file_path}" analyze(f.read, inline: inline, sticky: sticky) end rescue Errno::ENOENT, Errno::EACCES => e puts "Couldn't open the file: #{e}" end |