From a309a46a7cd669ed60f243b02fcd1d83c886d900 Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 11:27:10 -0300 Subject: [PATCH 1/6] Fix missing plugin.html_link --- lib/xcode_summary/plugin.rb | 11 +++++++---- spec/xcode_summary_spec.rb | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/xcode_summary/plugin.rb b/lib/xcode_summary/plugin.rb index ed4a542..a5e43be 100644 --- a/lib/xcode_summary/plugin.rb +++ b/lib/xcode_summary/plugin.rb @@ -208,15 +208,18 @@ 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) diff --git a/spec/xcode_summary_spec.rb b/spec/xcode_summary_spec.rb index 366fc7c..ea23b29 100644 --- a/spec/xcode_summary_spec.rb +++ b/spec/xcode_summary_spec.rb @@ -204,9 +204,9 @@ module Danger describe 'where request source' do it 'should be bitbucket' do - path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb#L3') + path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3') # rubocop:disable LineLength - expect(path).to eq "lib/xcode_summary/plugin.rb" + expect(path).to eq "lib/xcode_summary/plugin.rb:3" # rubocop:enable LineLength end end From 3574bd9cb75ccbfa45c6851827489c91125792fb Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 11:34:36 -0300 Subject: [PATCH 2/6] Remove DependencyCI badge --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 05f427b..5f02101 100644 --- a/README.md +++ b/README.md @@ -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`. From d043e855a835f1ca2e4757233767f2dd2174ad3e Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 11:34:43 -0300 Subject: [PATCH 3/6] Update gems --- Gemfile.lock | 93 +++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ac544e6..4cbd4d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ PATH 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) @@ -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) @@ -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 @@ -132,4 +135,4 @@ DEPENDENCIES yard BUNDLED WITH - 1.16.1 + 1.17.2 From 7a8826a2bcf8ee918c48960441bee759818b0f43 Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 11:55:06 -0300 Subject: [PATCH 4/6] Fix rubocop errors --- lib/danger_plugin.rb | 2 ++ lib/danger_xcode_summary.rb | 2 ++ lib/xcode_summary/gem_version.rb | 4 ++- lib/xcode_summary/plugin.rb | 43 ++++++++++++++++---------------- spec/spec_helper.rb | 4 ++- spec/xcode_summary_spec.rb | 12 ++++----- 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/danger_plugin.rb b/lib/danger_plugin.rb index 74734bf..4c66d60 100644 --- a/lib/danger_plugin.rb +++ b/lib/danger_plugin.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + require 'xcode_summary/plugin' diff --git a/lib/danger_xcode_summary.rb b/lib/danger_xcode_summary.rb index 9661d6e..97524de 100644 --- a/lib/danger_xcode_summary.rb +++ b/lib/danger_xcode_summary.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + require 'xcode_summary/gem_version' diff --git a/lib/xcode_summary/gem_version.rb b/lib/xcode_summary/gem_version.rb index 9865753..78df7f4 100644 --- a/lib/xcode_summary/gem_version.rb +++ b/lib/xcode_summary/gem_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module XcodeSummary - VERSION = '0.5.0'.freeze + VERSION = '0.5.0' end diff --git a/lib/xcode_summary/plugin.rb b/lib/xcode_summary/plugin.rb index a5e43be..8a87a65 100644 --- a/lib/xcode_summary/plugin.rb +++ b/lib/xcode_summary/plugin.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'json' module Danger @@ -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) @@ -225,13 +227,12 @@ def format_path(path) 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 @@ -245,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])}
" - if h[:line] && !h[:line].empty? + warning = "**#{path_link}**: #{escape_reason(input[:reason])}
" + 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]}
" \ - "> Symbol: #{h[:symbol]}
" \ - "> Referenced from: #{h[:reference]}" + def format_undefined_symbols(input) + "#{input[:message]}
" \ + "> Symbol: #{input[:symbol]}
" \ + "> Referenced from: #{input[:reference]}" end - def format_duplicate_symbols(h) - "#{h[:message]}
" \ - "> #{h[:file_paths].map { |path| path.split('/').last }.join('
')}" + def format_duplicate_symbols(input) + "#{input[:message]}
" \ + "> #{input[:file_paths].map { |path| path.split('/').last }.join('
')}" end def format_test_failure(suite_name, failure) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f28f70a..1e03f51 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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) diff --git a/spec/xcode_summary_spec.rb b/spec/xcode_summary_spec.rb index ea23b29..0bf4652 100644 --- a/spec/xcode_summary_spec.rb +++ b/spec/xcode_summary_spec.rb @@ -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 @@ -73,7 +75,7 @@ module Danger @xcode_summary.report('spec/fixtures/summary.json') expect(@dangerfile.status_report[:warnings]).to eq [ # rubocop:disable LineLength - "**MyWeight/Bla.m#L32**: Value stored to 'theme' is never read
```\n theme = *ptr++;\n```", + "**MyWeight/Bla.m#L32**: Value stored to 'theme' is never read
```\n theme = *ptr++;\n```" # rubocop:enable LineLength ] end @@ -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 \
' \ - "MyWeight/MyWeightTests/Tests.swift#L86", + "MyWeight/MyWeightTests/Tests.swift#L86" # rubocop:enable LineLength ] end @@ -205,9 +207,7 @@ module Danger describe 'where request source' do it 'should be bitbucket' do path = @xcode_summary.send(:format_path, 'lib/xcode_summary/plugin.rb:3') - # rubocop:disable LineLength - expect(path).to eq "lib/xcode_summary/plugin.rb:3" - # rubocop:enable LineLength + expect(path).to eq 'lib/xcode_summary/plugin.rb:3' end end end From bbc8656f096c5fb006b8572912b9c918afa11345 Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 12:00:14 -0300 Subject: [PATCH 5/6] Update travis ruby versions --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b933ed..49414e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 \ No newline at end of file From 828fb2d4f285420475230e032266c06324be3c92 Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Fri, 26 Jul 2019 12:07:12 -0300 Subject: [PATCH 6/6] Bump version to 0.5.1 --- Gemfile.lock | 2 +- lib/xcode_summary/gem_version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4cbd4d3..94604c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - danger-xcode_summary (0.5.0) + danger-xcode_summary (0.5.1) danger-plugin-api (~> 1.0) GEM diff --git a/lib/xcode_summary/gem_version.rb b/lib/xcode_summary/gem_version.rb index 78df7f4..98e956f 100644 --- a/lib/xcode_summary/gem_version.rb +++ b/lib/xcode_summary/gem_version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module XcodeSummary - VERSION = '0.5.0' + VERSION = '0.5.1' end