xcov 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e2fbf38638743436f19f20c895047c07af963e5
4
- data.tar.gz: 611fa1e2c51729ae7a96f40c92bf259609cc1a90
3
+ metadata.gz: 91702d34b310b64ac9b161ffdc46a375d514e164
4
+ data.tar.gz: 07e3acb2b8fbd7cb674c94acb7ee258655f8322b
5
5
  SHA512:
6
- metadata.gz: 57198ae9212ebdead54ddad4217af75e2f2e8a64211ec937cda182c685b2881e9fe96ee416c381983f7bac6c6a26f9f7e1958ea241fcb926a5226cc39f431ed1
7
- data.tar.gz: d68831b7fcf3b8b08b48f93ff8ba4656da14f10e05abbd1146dc7b08abd03dd936a43f56894dc3a80f43962e7c9e07795d78adc5f819a503a2b524ebda3d667a
6
+ metadata.gz: d44ad849fd3de7ba246fbdd35b594b958dcb46b622f11365ac2d8b271db7a095bd67af9aae64141dd5920be75b3b5f04304627bf92c7e1d66c650463e62ce733
7
+ data.tar.gz: 9d1a384c93f4fb49078a7d7775a818556350b18de2fb76b5ca1344b6e19fcb530e8f3434fb5d72bcb51e96afb84b4f3276af77f14070e3c41e94945abb12f0ec
data/README.md CHANGED
@@ -48,12 +48,13 @@ xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
48
48
  * `--minimum_coverage_percentage` `-m`: Raise exception if overall coverage percentage is under this value (ie. 75).
49
49
  * `--include_test_targets`: Enables coverage reports for `.xctest` targets.
50
50
  * `--ignore_file_path` `-x`: Relative or absolute path to the file containing the list of ignored files.
51
+ * `--exclude_targets`: Comma separated list of targets to exclude from coverage report.
51
52
  * `--slack_url` `-i`: Incoming WebHook for your Slack group to post results (optional).
52
53
  * `--slack_channel` `-e`: Slack channel where the results will be posted (optional).
53
54
  * `--skip_slack`: Add this flag to avoid publishing results on Slack (optional).
54
55
 
55
56
  ### 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
+ 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). You can also specify a wildcard expression for matching a group of files.
57
58
 
58
59
  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
 
@@ -69,9 +70,12 @@ Each one of the filenames you would like to ignore must be prefixed by the dash
69
70
 
70
71
  # Utils
71
72
  - LSTStateMachine.swift
73
+
74
+ # Exclude all files ending by "View.swift"
75
+ - .*View.swift
72
76
  ```
73
77
 
74
- ### [Fastlane](https://github.com/fastlane/fastlane/blob/master/docs/Actions.md)
78
+ ### [Fastlane](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md)
75
79
  *Fastlane 1.61.0* includes *xcov* as a custom action. You can easily create your coverage reports as follows:
76
80
  ```ruby
77
81
  xcov(
@@ -83,6 +87,10 @@ xcov(
83
87
 
84
88
  ## Changelog
85
89
 
90
+ ### v.0.7
91
+ * Ignore file allows wildcards for matching a group of files (by **stevenreinisch**)
92
+ * New `exclude_targets` option to exclude reporting for the targets given (by **stevenreinisch**)
93
+
86
94
  ### v.0.6
87
95
  * Ignored coverage for a specified list of files
88
96
 
@@ -104,6 +112,7 @@ xcov(
104
112
 
105
113
  * [nakiostudio](https://github.com/nakiostudio)
106
114
  * [opfeffer](https://github.com/opfeffer)
115
+ * [stevenreinisch](https://github.com/stevenreinisch)
107
116
 
108
117
  ## License
109
118
  This project is licensed under the terms of the MIT license. See the LICENSE file.
@@ -17,7 +17,7 @@ module Xcov
17
17
  class << self
18
18
 
19
19
  attr_accessor :config
20
- attr_accessor :ignore_list
20
+ attr_accessor :ignore_handler
21
21
  attr_accessor :project
22
22
 
23
23
  def project=(value)
@@ -11,7 +11,10 @@ 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")
14
15
  new.run
16
+ ensure
17
+ FastlaneCore::UpdateChecker.show_update_status("xcov", Xcov::VERSION)
15
18
  end
16
19
 
17
20
  def convert_options(options)
@@ -2,7 +2,23 @@
2
2
  module Xcov
3
3
  class IgnoreHandler
4
4
 
5
- def read_ignore_file
5
+ attr_accessor :list
6
+
7
+ def initialize
8
+ @list = IgnoreHandler.read_ignore_file
9
+ end
10
+
11
+ def should_ignore_file filename
12
+ return false if @list.empty?
13
+ return true if @list.include?(filename)
14
+
15
+ # Evaluate possible regexs
16
+ return @list.any? { |pattern| filename =~ Regexp.new("#{pattern}$") }
17
+ end
18
+
19
+ # Static methods
20
+
21
+ def self.read_ignore_file
6
22
  require "yaml"
7
23
  ignore_file_path = Xcov.config[:ignore_file_path]
8
24
  ignore_list = []
@@ -12,7 +28,7 @@ module Xcov
12
28
  Helper.log.info "Skipping file blacklisting as no ignore file was found at path #{ignore_file_path}".yellow
13
29
  end
14
30
 
15
- ignore_list
31
+ return ignore_list
16
32
  end
17
33
 
18
34
  end
@@ -11,8 +11,8 @@ module Xcov
11
11
  FastlaneCore::Project.detect_projects(options)
12
12
  Xcov.project = FastlaneCore::Project.new(options)
13
13
 
14
- # Set ignored files list
15
- Xcov.ignore_list = IgnoreHandler.new.read_ignore_file
14
+ # Set ignored files handler
15
+ Xcov.ignore_handler = IgnoreHandler.new
16
16
 
17
17
  # Print summary
18
18
  FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:slack_url], title: "Summary for xcov #{Xcov::VERSION}")
@@ -17,7 +17,7 @@ module Xcov
17
17
 
18
18
  def average_coverage targets
19
19
  return 0 if targets.count == 0
20
-
20
+
21
21
  coverage = 0
22
22
  targets.each do |target|
23
23
  coverage = coverage + target.coverage
@@ -44,10 +44,7 @@ module Xcov
44
44
  # Class methods
45
45
 
46
46
  def self.map dictionary
47
- targets = dictionary["targets"].select { |target| !target["name"].include?(".xctest") }
48
-
49
- # Don't filter test targets if the flag is set
50
- targets = dictionary["targets"] if Xcov.config[:include_test_targets]
47
+ targets = Report.filter_targets dictionary["targets"]
51
48
 
52
49
  # Create target objects
53
50
  targets = targets.map { |target| Target.map(target)}
@@ -55,5 +52,23 @@ module Xcov
55
52
  Report.new(targets)
56
53
  end
57
54
 
55
+ def self.filter_targets targets
56
+ filtered_targets = Array.new(targets)
57
+ filtered_targets = filtered_targets.select { |target| !target["name"].include?(".xctest") } if !Xcov.config[:include_test_targets]
58
+ filtered_targets = filtered_targets.select { |target| !self.excluded_targets.include?(target["name"])}
59
+
60
+ filtered_targets
61
+ end
62
+
63
+ def self.excluded_targets
64
+ excluded_targets = Array.new()
65
+
66
+ if Xcov.config[:exclude_targets]
67
+ excluded_targets = Xcov.config[:exclude_targets].split(/\s*,\s*/)
68
+ end
69
+
70
+ excluded_targets
71
+ end
72
+
58
73
  end
59
74
  end
@@ -14,7 +14,7 @@ module Xcov
14
14
  @name = CGI::escapeHTML(name)
15
15
  @coverage = coverage
16
16
  @functions = functions
17
- @ignored = Xcov.ignore_list.include?(name)
17
+ @ignored = Xcov.ignore_handler.should_ignore_file(name)
18
18
  @displayable_coverage = self.create_displayable_coverage
19
19
  @coverage_color = self.create_coverage_color
20
20
  @id = Source.create_id(name)
@@ -77,7 +77,10 @@ module Xcov
77
77
  FastlaneCore::ConfigItem.new(key: :skip_slack,
78
78
  description: "Don't publish to slack, even when an URL is given",
79
79
  is_string: false,
80
- default_value: false)
80
+ default_value: false),
81
+ FastlaneCore::ConfigItem.new(key: :exclude_targets,
82
+ optional: true,
83
+ description: "Comma separated list of targets to exclude from coverage report")
81
84
  ]
82
85
  end
83
86
 
@@ -1,6 +1,6 @@
1
1
  module Xcov
2
2
 
3
- VERSION = "0.6"
3
+ VERSION = "0.7"
4
4
  DESCRIPTION = "xcov is a friendly visualizer for Xcode's code coverage files"
5
5
 
6
6
  end
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.6'
4
+ version: '0.7'
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-20 00:00:00.000000000 Z
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core