xcov 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/lib/xcov.rb +1 -1
- data/lib/xcov/commands_generator.rb +3 -0
- data/lib/xcov/ignore_handler.rb +18 -2
- data/lib/xcov/manager.rb +2 -2
- data/lib/xcov/model/report.rb +20 -5
- data/lib/xcov/model/source.rb +1 -1
- data/lib/xcov/options.rb +4 -1
- data/lib/xcov/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91702d34b310b64ac9b161ffdc46a375d514e164
|
4
|
+
data.tar.gz: 07e3acb2b8fbd7cb674c94acb7ee258655f8322b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/xcov.rb
CHANGED
@@ -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)
|
data/lib/xcov/ignore_handler.rb
CHANGED
@@ -2,7 +2,23 @@
|
|
2
2
|
module Xcov
|
3
3
|
class IgnoreHandler
|
4
4
|
|
5
|
-
|
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
|
data/lib/xcov/manager.rb
CHANGED
@@ -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
|
15
|
-
Xcov.
|
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}")
|
data/lib/xcov/model/report.rb
CHANGED
@@ -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"]
|
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
|
data/lib/xcov/model/source.rb
CHANGED
@@ -14,7 +14,7 @@ module Xcov
|
|
14
14
|
@name = CGI::escapeHTML(name)
|
15
15
|
@coverage = coverage
|
16
16
|
@functions = functions
|
17
|
-
@ignored = Xcov.
|
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)
|
data/lib/xcov/options.rb
CHANGED
@@ -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
|
|
data/lib/xcov/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|