xcov 0.5 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74b4b027c48a06ae5c565d14ca7056f4b16f7e85
4
- data.tar.gz: a433237612938cd44bdc600d9f6e44519e8dfa92
3
+ metadata.gz: 3e2fbf38638743436f19f20c895047c07af963e5
4
+ data.tar.gz: 611fa1e2c51729ae7a96f40c92bf259609cc1a90
5
5
  SHA512:
6
- metadata.gz: 9352b7e868175b3987ff7c963b19505ae415accda365d312dada36a573092ae36f13d315b46a02d1bcdc9202908d74e9f6976e50a4816318466f552f46b40410
7
- data.tar.gz: 4594aa1fd03814dd815d64bceaabbf324192d4687b593c2d9606071b09daa09dfa3ee18d013c654b26993a78f229f34736639a05db6d398b0f6d4cb639efa13f
6
+ metadata.gz: 57198ae9212ebdead54ddad4217af75e2f2e8a64211ec937cda182c685b2881e9fe96ee416c381983f7bac6c6a26f9f7e1958ea241fcb926a5226cc39f431ed1
7
+ data.tar.gz: d68831b7fcf3b8b08b48f93ff8ba4656da14f10e05abbd1146dc7b08abd03dd936a43f56894dc3a80f43962e7c9e07795d78adc5f819a503a2b524ebda3d667a
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Gem](https://img.shields.io/gem/v/xcov.svg?style=flat)](http://rubygems.org/gems/xcov)
6
6
  [![Gem Downloads](https://img.shields.io/gem/dt/xcov.svg?style=flat)](http://rubygems.org/gems/xcov)
7
7
 
8
- **xCov** is a friendly visualizer for Xcode's code coverage files.
8
+ **xcov** is a friendly visualizer for Xcode's code coverage files.
9
9
 
10
10
  ## Installation
11
11
  ```
@@ -14,7 +14,9 @@ sudo gem install xcov
14
14
 
15
15
  ## Features
16
16
  * Built on top of [Fastlane](https://fastlane.tools), you can easily plug it on to your CI environment.
17
- * Generates nice HTML reports.
17
+ * Blacklisting of those files which coverage you want to ignore.
18
+ * Minimum acceptable coverage percentage.
19
+ * Nice HTML reports.
18
20
 
19
21
  ![/assets_readme/report.png](/assets_readme/report.png)
20
22
 
@@ -23,7 +25,7 @@ sudo gem install xcov
23
25
  ![/assets_readme/slack_integration.png](/assets_readme/slack_integration.png)
24
26
 
25
27
  ## Requirements
26
- In order to make *xCov* run you must:
28
+ In order to make *xcov* run you must:
27
29
  * Use Xcode 7.
28
30
  * Have the latest version of Xcode command line tools.
29
31
  * Set your project scheme as **shared**.
@@ -32,7 +34,7 @@ In order to make *xCov* run you must:
32
34
  ![/assets_readme/gather_coverage.png](/assets_readme/gather_coverage.png)
33
35
 
34
36
  ## Usage
35
- *xCov* analyzes the `.xccoverage` files created after running your tests therefore, before executing xCov, you need to run your tests with either `Xcode`, `xcodebuild` or [scan](https://github.com/fastlane/scan). Once completed, obtain your coverage report by providing a few parameters:
37
+ *xcov* analyzes the `.xccoverage` files created after running your tests therefore, before executing xcov, you need to run your tests with either `Xcode`, `xcodebuild` or [scan](https://github.com/fastlane/scan). Once completed, obtain your coverage report by providing a few parameters:
36
38
  ```
37
39
  xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
38
40
  ```
@@ -43,14 +45,34 @@ xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
43
45
  * `--scheme` `-s`: Scheme of the project to analyze.
44
46
  * `--output_directory` `-o`: Path for the output folder where the report files will be saved.
45
47
  * `--derived_data_path` `-j`: Path of your project `Derived Data` folder (optional).
46
- * `--minimum_coverage_percentage` `-m`: Raise exception if overall coverage percentage is under this value (ie. 75)
47
- * `--include_test_targets`: Enables coverage reports for `.xctest` targets
48
+ * `--minimum_coverage_percentage` `-m`: Raise exception if overall coverage percentage is under this value (ie. 75).
49
+ * `--include_test_targets`: Enables coverage reports for `.xctest` targets.
50
+ * `--ignore_file_path` `-x`: Relative or absolute path to the file containing the list of ignored files.
48
51
  * `--slack_url` `-i`: Incoming WebHook for your Slack group to post results (optional).
49
52
  * `--slack_channel` `-e`: Slack channel where the results will be posted (optional).
50
53
  * `--skip_slack`: Add this flag to avoid publishing results on Slack (optional).
51
54
 
55
+ ### Ignoring files
56
+ You can easily ignore the coverage for a specified set of files by adding their filenames to the *ignore file* specified with the `--ignore_file_path` parameter (this file is `.xcovignore` by default).
57
+
58
+ Each one of the filenames you would like to ignore must be prefixed by the dash symbol `-`. In addition you can comment lines by prefixing them by `#`. Example:
59
+
60
+ ```yaml
61
+ # Api files
62
+ - LSTSessionApi.swift
63
+ - LSTComponentsApi.swift
64
+ - LSTNotificationsApi.swift
65
+
66
+ # Managers
67
+ - LSTRequestManager.m
68
+ - LSTCookiesManager.m
69
+
70
+ # Utils
71
+ - LSTStateMachine.swift
72
+ ```
73
+
52
74
  ### [Fastlane](https://github.com/fastlane/fastlane/blob/master/docs/Actions.md)
53
- *Fastlane 1.61.0* includes *xCov* as a custom action. You can easily create your coverage reports as follows:
75
+ *Fastlane 1.61.0* includes *xcov* as a custom action. You can easily create your coverage reports as follows:
54
76
  ```ruby
55
77
  xcov(
56
78
  workspace: "YourWorkspace.xcworkspace",
@@ -61,6 +83,9 @@ xcov(
61
83
 
62
84
  ## Changelog
63
85
 
86
+ ### v.0.6
87
+ * Ignored coverage for a specified list of files
88
+
64
89
  ### v.0.5
65
90
  * Fixed bug using the `derived_data_path` option
66
91
  * Fixed bug sorting multiple `.xccoverage` files by datetime
@@ -1,5 +1,5 @@
1
1
  /**
2
- Xcov - Xcode code coverage without hassle
2
+ xcov - Xcode code coverage without hassle
3
3
  A tool developed by Carlos Vidal @carlostify
4
4
  */
5
5
 
@@ -140,6 +140,15 @@ html, body, .full-height {
140
140
  cursor: pointer;
141
141
  }
142
142
 
143
+ .file-ignored-row {
144
+ color: #838383;
145
+ padding-top: 5px;
146
+ padding-bottom: 5px;
147
+ border-style: solid;
148
+ border-color: #202020;
149
+ border-width: 0px 0px 1px 0px;
150
+ }
151
+
143
152
  .target-files {
144
153
  background-color: #363636;
145
154
  padding-top: 10px;
@@ -3,6 +3,7 @@ require 'xcov/version'
3
3
  require 'xcov/manager'
4
4
  require 'xcov/options'
5
5
  require 'xcov/runner'
6
+ require 'xcov/ignore_handler'
6
7
  require 'xcov/error_handler'
7
8
  require 'xcov/slack_poster'
8
9
  require 'xcov/model/base'
@@ -16,13 +17,11 @@ module Xcov
16
17
  class << self
17
18
 
18
19
  attr_accessor :config
20
+ attr_accessor :ignore_list
19
21
  attr_accessor :project
20
22
 
21
- def config=(value)
22
- @config = value
23
-
24
- FastlaneCore::Project.detect_projects(value)
25
- @project = FastlaneCore::Project.new(config)
23
+ def project=(value)
24
+ @project = value
26
25
  @project.select_scheme
27
26
  end
28
27
 
@@ -11,16 +11,13 @@ module Xcov
11
11
  FastlaneCore::CommanderGenerator.new.generate(Xcov::Options.available_options)
12
12
 
13
13
  def self.start
14
- FastlaneCore::UpdateChecker.start_looking_for_update("xcov")
15
14
  new.run
16
- ensure
17
- FastlaneCore::UpdateChecker.show_update_status("xcov", Xcov::VERSION)
18
15
  end
19
16
 
20
17
  def convert_options(options)
21
- o = options.__hash__.dup
22
- o.delete(:verbose)
23
- o
18
+ converted_options = options.__hash__.dup
19
+ converted_options.delete(:verbose)
20
+ converted_options
24
21
  end
25
22
 
26
23
  def run
@@ -43,7 +40,6 @@ module Xcov
43
40
  end
44
41
 
45
42
  default_command :report
46
-
47
43
  run!
48
44
  end
49
45
 
@@ -0,0 +1,19 @@
1
+
2
+ module Xcov
3
+ class IgnoreHandler
4
+
5
+ def read_ignore_file
6
+ require "yaml"
7
+ ignore_file_path = Xcov.config[:ignore_file_path]
8
+ ignore_list = []
9
+ begin
10
+ ignore_list = YAML.load_file(ignore_file_path)
11
+ rescue
12
+ Helper.log.info "Skipping file blacklisting as no ignore file was found at path #{ignore_file_path}".yellow
13
+ end
14
+
15
+ ignore_list
16
+ end
17
+
18
+ end
19
+ end
@@ -4,8 +4,20 @@ module Xcov
4
4
  class Manager
5
5
 
6
6
  def work(options)
7
+ # Set command options
7
8
  Xcov.config = options
8
- FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:slack_url], title: "Summary for xCov #{Xcov::VERSION}")
9
+
10
+ # Set project options
11
+ FastlaneCore::Project.detect_projects(options)
12
+ Xcov.project = FastlaneCore::Project.new(options)
13
+
14
+ # Set ignored files list
15
+ Xcov.ignore_list = IgnoreHandler.new.read_ignore_file
16
+
17
+ # Print summary
18
+ FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:slack_url], title: "Summary for xcov #{Xcov::VERSION}")
19
+
20
+ # Run xcov
9
21
  Runner.new.run
10
22
  end
11
23
 
@@ -11,10 +11,14 @@ module Xcov
11
11
  attr_accessor :id
12
12
 
13
13
  def create_displayable_coverage
14
+ return "" if @ignored
15
+
14
16
  "%.0f%%" % [(@coverage*100)]
15
17
  end
16
18
 
17
19
  def create_coverage_color
20
+ return "#363636" if @ignored
21
+
18
22
  if @coverage > 0.8
19
23
  return "#1FCB32"
20
24
  elsif @coverage > 0.65
@@ -5,6 +5,7 @@ module Xcov
5
5
 
6
6
  attr_accessor :name
7
7
  attr_accessor :type
8
+ attr_accessor :ignored
8
9
  attr_accessor :coverage
9
10
  attr_accessor :functions
10
11
  attr_accessor :function_templates
@@ -13,10 +14,15 @@ module Xcov
13
14
  @name = CGI::escapeHTML(name)
14
15
  @coverage = coverage
15
16
  @functions = functions
17
+ @ignored = Xcov.ignore_list.include?(name)
16
18
  @displayable_coverage = self.create_displayable_coverage
17
19
  @coverage_color = self.create_coverage_color
18
20
  @id = Source.create_id(name)
19
21
  @type = Source.type(name)
22
+
23
+ if @ignored
24
+ Helper.log.info "Ignoring #{name} coverage".yellow
25
+ end
20
26
  end
21
27
 
22
28
  def print_description
@@ -37,12 +37,22 @@ module Xcov
37
37
 
38
38
  def self.map (dictionary)
39
39
  name = dictionary["name"]
40
- coverage = dictionary["coverage"]
41
40
  files = dictionary["files"].map { |file| Source.map(file)}
42
41
  files = files.sort! { |lhs, rhs| lhs.coverage <=> rhs.coverage }
42
+ .sort! { |lhs, rhs| (lhs.ignored ? 1:0) <=> (rhs.ignored ? 1:0) }
43
+ coverage = Target.calculate_coverage(files)
43
44
 
44
45
  Target.new(name, coverage, files)
45
46
  end
46
47
 
48
+ def self.calculate_coverage (files)
49
+ coverage = 0
50
+ non_ignored_files = files.select { |file| !file.ignored }
51
+ non_ignored_files.each { |file| coverage += file.coverage }
52
+ coverage = coverage / non_ignored_files.count unless non_ignored_files.empty?
53
+
54
+ coverage
55
+ end
56
+
47
57
  end
48
58
  end
@@ -51,6 +51,11 @@ module Xcov
51
51
  description: "Raise exception if overall coverage percentage is under this value (ie. 75)",
52
52
  type: Float,
53
53
  default_value: 0),
54
+ FastlaneCore::ConfigItem.new(key: :ignore_file_path,
55
+ short_option: "-x",
56
+ env_name: "XCOV_IGNORE_FILE_PATH",
57
+ description: "Relative or absolute path to the file containing the list of ignored files",
58
+ default_value: File.join(containing, ".xcovignore")),
54
59
  FastlaneCore::ConfigItem.new(key: :include_test_targets,
55
60
  env_name: "XCOV_INCLUDE_TEST_TARGETS",
56
61
  description: "Enables coverage reports for .xctest targets",
@@ -66,7 +66,7 @@ module Xcov
66
66
  table_rows << [target.name, target.displayable_coverage]
67
67
  end
68
68
  puts Terminal::Table.new({
69
- title: "xCov Coverage Report".green,
69
+ title: "xcov Coverage Report".green,
70
70
  rows: table_rows
71
71
  })
72
72
  puts ""
@@ -25,7 +25,7 @@ module Xcov
25
25
  }
26
26
  end
27
27
 
28
- result = notifier.ping "xCov Coverage Report",
28
+ result = notifier.ping "Your *xcov* coverage report",
29
29
  icon_url: 'https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png',
30
30
  attachments: attachments
31
31
 
@@ -1,6 +1,6 @@
1
1
  module Xcov
2
2
 
3
- VERSION = "0.5"
4
- DESCRIPTION = "xCov is a friendly visualizer for Xcode's code coverage files"
3
+ VERSION = "0.6"
4
+ DESCRIPTION = "xcov is a friendly visualizer for Xcode's code coverage files"
5
5
 
6
6
  end
@@ -1,5 +1,9 @@
1
1
  <!-- Single file starts here -->
2
+ <% if @ignored %>
3
+ <div class="row file-ignored-row">
4
+ <% else %>
2
5
  <div class="row file-row" file-id="<%= @id %>">
6
+ <% end %>
3
7
  <div class="col-xs-10 col-md-10 col-lg-10">
4
8
  <span><img class="file-icon" src="resources/file_<%= @type %>.png"/></span>
5
9
  <%= @name %>
@@ -1,6 +1,6 @@
1
1
  <!DOCTYPE html>
2
2
  <!--
3
- Xcov - Xcode code coverage without hassle
3
+ xcov - Xcode code coverage without hassle
4
4
  A tool developed by Carlos Vidal @carlostify
5
5
  -->
6
6
  <html>
@@ -8,7 +8,7 @@ A tool developed by Carlos Vidal @carlostify
8
8
  <meta charset="utf-8">
9
9
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1">
11
- <title>xCov - Code coverage report</title>
11
+ <title>xcov - Code coverage report</title>
12
12
  <link rel="stylesheet" media="screen" href="resources/bootstrap.min.css" />
13
13
  <link rel="stylesheet" media="screen" href="resources/opensans.css" />
14
14
  <link rel="stylesheet" media="all" href="resources/main.css" />
@@ -52,7 +52,7 @@ A tool developed by Carlos Vidal @carlostify
52
52
  <!-- Footer starts here -->
53
53
  <div class="row footer">
54
54
  <div class="col-xs-12 col-md-offset-1 col-md-10 col-lg-offset-2 col-lg-8 text-center">
55
- xCov - Xcode coverage reports without hassle - A tool developed by
55
+ xcov - Xcode coverage reports without hassle - A tool developed by
56
56
  <a href="https://github.com/nakiostudio" target="_blank">Carlos Vidal</a> -
57
57
  <a href="https://twitter.com/carlostify" target="_blank">@carlostify</a>
58
58
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcov
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Vidal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
@@ -184,7 +184,7 @@ dependencies:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
- description: xCov is a friendly visualizer for Xcode's code coverage files
187
+ description: xcov is a friendly visualizer for Xcode's code coverage files
188
188
  email:
189
189
  - nakioparkour@gmail.com
190
190
  executables:
@@ -213,6 +213,7 @@ files:
213
213
  - lib/xcov.rb
214
214
  - lib/xcov/commands_generator.rb
215
215
  - lib/xcov/error_handler.rb
216
+ - lib/xcov/ignore_handler.rb
216
217
  - lib/xcov/manager.rb
217
218
  - lib/xcov/model/base.rb
218
219
  - lib/xcov/model/function.rb
@@ -250,6 +251,6 @@ rubyforge_project:
250
251
  rubygems_version: 2.4.8
251
252
  signing_key:
252
253
  specification_version: 4
253
- summary: xCov is a friendly visualizer for Xcode's code coverage files
254
+ summary: xcov is a friendly visualizer for Xcode's code coverage files
254
255
  test_files: []
255
256
  has_rdoc: