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.
Instance Method Summary collapse
-
#analyze(log_text, inline: false, 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.
23 24 25 |
# File 'lib/xcode_warnings/plugin.rb', line 23 def show_build_timing_summary @show_build_timing_summary end |
#show_build_warnings ⇒ Object
rubocop:disable Lint/DuplicateMethods
15 16 17 |
# File 'lib/xcode_warnings/plugin.rb', line 15 def show_build_warnings @show_build_warnings end |
#show_linker_warnings ⇒ void
This method returns an undefined value.
Whether show linker warnings or not.
19 20 21 |
# File 'lib/xcode_warnings/plugin.rb', line 19 def show_linker_warnings @show_linker_warnings end |
Instance Method Details
#analyze(log_text, inline: false, sticky: true) ⇒ void
This method returns an undefined value.
Parses the log text from xcodebuild and show warnings.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/xcode_warnings/plugin.rb', line 46 def analyze(log_text, inline: false, sticky: true) parser = LogParser.new parser.show_build_warnings = show_build_warnings parser.show_linker_warnings = show_linker_warnings parser.show_build_timing_summary = show_build_timing_summary 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.
71 72 73 74 75 76 77 78 |
# File 'lib/xcode_warnings/plugin.rb', line 71 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 |