Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Danger verbose fix #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
danger-xcodebuild (0.0.6)
danger-xcodebuild (0.0.7)
danger-plugin-api (~> 1.0)

GEM
Expand Down
2 changes: 1 addition & 1 deletion lib/xcodebuild/gem_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Xcodebuild
VERSION = "0.0.6".freeze
VERSION = "0.0.7".freeze
end
18 changes: 13 additions & 5 deletions lib/xcodebuild/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def json_file=(value)
# @return [warning_count]
#
def parse_warnings
return unless @xcodebuild_json

@warning_count = @xcodebuild_json["warnings"].count
@warning_count = @warning_count + @xcodebuild_json["ld_warnings"].count
@warning_count = @warning_count + @xcodebuild_json["compile_warnings"].count
Expand All @@ -66,6 +68,8 @@ def parse_warnings
# @return [error_count]
#
def parse_errors
return unless @xcodebuild_json

errors = @xcodebuild_json["errors"].map {|x| "`#{x}`"}
errors += @xcodebuild_json["compile_errors"].map {|x| "`[#{x["file_path"].split("/").last}] #{x["reason"]}`"}
errors += @xcodebuild_json["file_missing_errors"].map {|x| "`[#{x["file_path"].split("/").last}] #{x["reason"]}`"}
Expand All @@ -89,6 +93,8 @@ def parse_errors
# @return [test_failures]
#
def parse_tests
return unless @xcodebuild_json

test_failures = Array.new
@xcodebuild_json["tests_failures"].each do |key, value|
test_failures += value.map {|x| "`[#{x["file_path"].split("/").last}] [#{x["test_case"]}] #{x["reason"]}`"}
Expand All @@ -112,18 +118,20 @@ def parse_tests
# @return [is_perfect_build]
#
def perfect_build
return unless @xcodebuild_json

is_perfect_build = @warning_count == 0 && @error_count == 0 && @test_failures_count == 0
if post_messages
message = Array.new
message.push (@build_title) unless @build_title.nil?
message.push ("Perfect build 👍🏻")
message(message.reject(&:empty?).join(" ")) if is_perfect_build
message = Array.new
message.push (@build_title) unless @build_title.nil?
message.push ("Perfect build 👍🏻")
message(message.reject(&:empty?).join(" ")) if is_perfect_build
end
return is_perfect_build
end

def self.instance_name
to_s.gsub("Danger", "").danger_underscore.split("/").last
to_s.gsub("Danger", "").danger_underscore.split("/").last
end
end
end