Skip to content

Commit

Permalink
Merge pull request #47 from diogot/update-gems
Browse files Browse the repository at this point in the history
Update gems
  • Loading branch information
diogot authored Jul 26, 2019
2 parents 661bd03 + 828fb2d commit 020d670
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 83 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ cache:
- bundle

rvm:
- 2.1.3
- 2.3.1
- 2.6.0
- 2.5.3
- 2.4.5
- 2.3.8

script:
- bundle exec rake spec
95 changes: 49 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PATH
remote: .
specs:
danger-xcode_summary (0.5.0)
danger-xcode_summary (0.5.1)
danger-plugin-api (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.0)
claide (1.0.2)
Expand All @@ -19,29 +19,30 @@ GEM
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (5.5.10)
danger (6.0.9)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (~> 0.9)
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
faraday-http-cache (~> 2.0)
git (~> 1.5)
kramdown (~> 2.0)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
danger-plugin-api (1.0.0)
danger (> 2.0)
diff-lcs (1.3)
faraday (0.14.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday-http-cache (2.0.0)
faraday (~> 0.8)
ffi (1.9.23)
ffi (1.11.1)
formatador (0.2.5)
git (1.3.0)
guard (2.14.2)
git (1.5.0)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
Expand All @@ -55,65 +56,67 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
kramdown (1.16.2)
jaro_winkler (1.5.3)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
listen (3.0.7)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9.7)
lumberjack (1.0.12)
method_source (0.9.0)
multipart-post (2.0.0)
lumberjack (1.0.13)
method_source (0.9.2)
multipart-post (2.1.1)
nap (1.1.0)
nenv (0.3.0)
no_proxy_fix (0.1.2)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
octokit (4.8.0)
octokit (4.14.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
parallel (1.12.1)
parser (2.5.0.2)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
powerpack (0.1.1)
pry (0.11.3)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
public_suffix (3.1.1)
rainbow (3.0.0)
rake (10.5.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
rb-inotify (0.10.0)
ffi (~> 1.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.52.1)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
rubocop (0.73.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
shellany (0.0.1)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.20.0)
unicode-display_width (1.3.0)
yard (0.9.12)
thor (0.20.3)
unicode-display_width (1.6.0)
yard (0.9.20)

PLATFORMS
ruby
Expand All @@ -132,4 +135,4 @@ DEPENDENCIES
yard

BUNDLED WITH
1.16.1
1.17.2
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE.txt)
[![Gem Version](https://badge.fury.io/rb/danger-xcode_summary.svg)](https://badge.fury.io/rb/danger-xcode_summary)
[![Build Status](https://travis-ci.org/diogot/danger-xcode_summary.svg?branch=master)](https://travis-ci.org/diogot/danger-xcode_summary)
[![Dependency Status](https://dependencyci.com/github/diogot/danger-xcode_summary/badge)](https://dependencyci.com/github/diogot/danger-xcode_summary)

A [Danger](http://danger.systems) plugin that shows all build errors, warnings and unit tests results generated from `xcodebuild`.

Expand Down
2 changes: 2 additions & 0 deletions lib/danger_plugin.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'xcode_summary/plugin'
2 changes: 2 additions & 0 deletions lib/danger_xcode_summary.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

require 'xcode_summary/gem_version'
4 changes: 3 additions & 1 deletion lib/xcode_summary/gem_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module XcodeSummary
VERSION = '0.5.0'.freeze
VERSION = '0.5.1'
end
54 changes: 29 additions & 25 deletions lib/xcode_summary/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'json'

module Danger
Expand Down Expand Up @@ -196,9 +198,9 @@ def errors(xcode_summary)
errors.delete_if(&ignored_results)
end

def parse_location(h)
file_path, line, _column = h[:file_path].split(':')
Location.new(h[:file_name], file_path, line.to_i)
def parse_location(input)
file_path, line, _column = input[:file_path].split(':')
Location.new(input[:file_name], file_path, line.to_i)
end

def parse_test_location(failure)
Expand All @@ -208,27 +210,29 @@ def parse_test_location(failure)
end

def format_path(path)
clean_path, line = parse_filename(path)
path = clean_path + '#L' + line if clean_path && line

# Pick a Dangerfile plugin for a chosen request_source
# based on https://github.com/danger/danger/blob/master/lib/danger/plugin_support/plugin.rb#L31
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

plugin.html_link(path)
if plugin
clean_path, line = parse_filename(path)
path = clean_path + '#L' + line if clean_path && line
plugin.html_link(path)
else
path
end
end

def parse_filename(path)
regex = /^(.*?):(\d*):?\d*$/
match = path.match(regex)
if match
match.captures
end
match&.captures
end

def relative_path(path)
return nil if project_root.nil?

path.gsub(project_root, '')
end

Expand All @@ -242,38 +246,38 @@ def escape_reason(reason)
reason.gsub('>', '\>').gsub('<', '\<')
end

def format_compile_warning(h)
path = relative_path(h[:file_path])
def format_compile_warning(input)
path = relative_path(input[:file_path])
return nil if should_ignore_warning?(path)

path_link = format_path(path)

warning = "**#{path_link}**: #{escape_reason(h[:reason])} <br />"
if h[:line] && !h[:line].empty?
warning = "**#{path_link}**: #{escape_reason(input[:reason])} <br />"
if input[:line] && !input[:line].empty?
"#{warning}" \
"```\n" \
"#{h[:line]}\n" \
"#{input[:line]}\n" \
'```'
else
warning
end
end

def format_format_file_missing_error(h)
path = relative_path(h[:file_path])
def format_format_file_missing_error(input)
path = relative_path(input[:file_path])
path_link = format_path(path)
"**#{escape_reason(h[:reason])}**: #{path_link}"
"**#{escape_reason(input[:reason])}**: #{path_link}"
end

def format_undefined_symbols(h)
"#{h[:message]} <br />" \
"> Symbol: #{h[:symbol]} <br />" \
"> Referenced from: #{h[:reference]}"
def format_undefined_symbols(input)
"#{input[:message]} <br />" \
"> Symbol: #{input[:symbol]} <br />" \
"> Referenced from: #{input[:reference]}"
end

def format_duplicate_symbols(h)
"#{h[:message]} <br />" \
"> #{h[:file_paths].map { |path| path.split('/').last }.join('<br /> ')}"
def format_duplicate_symbols(input)
"#{input[:message]} <br />" \
"> #{input[:file_paths].map { |path| path.split('/').last }.join('<br /> ')}"
end

def format_test_failure(suite_name, failure)
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
ROOT = Pathname.new(File.expand_path('..', __dir__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)

Expand Down
14 changes: 7 additions & 7 deletions spec/xcode_summary_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require File.expand_path('../spec_helper', __FILE__)
# frozen_string_literal: true

require File.expand_path('spec_helper', __dir__)

module Danger
describe Danger::DangerXcodeSummary do
Expand Down Expand Up @@ -73,7 +75,7 @@ module Danger
@xcode_summary.report('spec/fixtures/summary.json')
expect(@dangerfile.status_report[:warnings]).to eq [
# rubocop:disable LineLength
"**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Bla.m#L32'>MyWeight/Bla.m#L32</a>**: Value stored to 'theme' is never read <br />```\n theme = *ptr++;\n```",
"**<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/Bla.m#L32'>MyWeight/Bla.m#L32</a>**: Value stored to 'theme' is never read <br />```\n theme = *ptr++;\n```"
# rubocop:enable LineLength
]
end
Expand All @@ -89,7 +91,7 @@ module Danger
expect(@dangerfile.status_report[:errors]).to eq [
# rubocop:disable LineLength
'**MyWeight.MyWeightSpec**: works_with_success, expected to eventually not be nil, got \<nil\> <br /> ' \
"<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/MyWeightTests/Tests.swift#L86'>MyWeight/MyWeightTests/Tests.swift#L86</a>",
"<a href='https://github.com/diogot/danger-xcode_summary/blob/129jef029jf029fj2039fj203f92/MyWeight/MyWeightTests/Tests.swift#L86'>MyWeight/MyWeightTests/Tests.swift#L86</a>"
# rubocop:enable LineLength
]
end
Expand Down Expand Up @@ -204,10 +206,8 @@ module Danger

describe 'where request source' do
it 'should be bitbucket' do
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb#L3')
# rubocop:disable LineLength
expect(path).to eq "<a href='https://github.com/diogot/danger-xcode_summary/lib/xcode_summary/plugin.rb?at=4d4c0f31857e3185b51b6865a0700525bc0cb2bb#L3'>lib/xcode_summary/plugin.rb</a>"
# rubocop:enable LineLength
path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3')
expect(path).to eq 'lib/xcode_summary/plugin.rb:3'
end
end
end
Expand Down

0 comments on commit 020d670

Please sign in to comment.