xcov 0.11.3 → 0.12

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: 857a2cce20017d32986a779c445b0542be242af0
4
- data.tar.gz: 673eb99ccbb1f740fd7d41bfdcfd80dab8977f96
3
+ metadata.gz: c02009c2981afaac60ecbddd456a99e69a921862
4
+ data.tar.gz: f991f7a721295624e74205c55b1b703c8d912c96
5
5
  SHA512:
6
- metadata.gz: 02a500bb7dfcdf2c1eb57ec6dfc0e62bf034aabbe07c4557cc853459da6ab38d5ba41ae5f656ea804b53131acabcc9d52aba55657f07ae76ec91cfd64f8b7344
7
- data.tar.gz: 26cca614b0d16d9ea24665668339243b8fc4245d93021fa588ddef1b22850f1749e6938ffae0470c9f85308837a80478bcff555bc83a499891c8922a22f98f35
6
+ metadata.gz: 9a97f422cca8e295b7965303670f0ee281a510c355ccd31665c8c0bd732c7be1c9244bb91b8ad54ea5e5187afd353b775b15a740f5476445727a7cccc13842f4
7
+ data.tar.gz: a922d3a9d26b0b485b63fa35b2720bed5f4f6d29c084d9a972baee33dec87033c939d99240b365d86459d9b1442c3ab5246450d0490410bf901c6078d6bb978f
data/README.md CHANGED
@@ -44,11 +44,13 @@ xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
44
44
  * `--project` `-p`: Path of your `xcodeproj` file (optional).
45
45
  * `--scheme` `-s`: Scheme of the project to analyze.
46
46
  * `--output_directory` `-o`: Path for the output folder where the report files will be saved.
47
+ * `--source_directory` `-r`: The path to project's root directory.
47
48
  * `--derived_data_path` `-j`: Path of your project `Derived Data` folder (optional).
48
49
  * `--minimum_coverage_percentage` `-m`: Raise exception if overall coverage percentage is under this value (ie. 75).
49
50
  * `--include_test_targets`: Enables coverage reports for `.xctest` targets.
50
51
  * `--ignore_file_path` `-x`: Relative or absolute path to the file containing the list of ignored files.
51
52
  * `--exclude_targets`: Comma separated list of targets to exclude from coverage report.
53
+ * `--include_targets`: Comma separated list of targets to include in coverage report.
52
54
  * `--slack_url` `-i`: Incoming WebHook for your Slack group to post results (optional).
53
55
  * `--slack_channel` `-e`: Slack channel where the results will be posted (optional).
54
56
  * `--html_report`: Enables the creation of a html report. Enabled by default (optional).
@@ -61,6 +63,8 @@ _**Note:** All paths you provide should be absolute and unescaped_
61
63
  ### Ignoring files
62
64
  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.
63
65
 
66
+ If you want to ignore all the files from a directory (folder), specify directory's relative path in *ignore file*. Also, specify `source_directory` if that differs from working directory (which is the default value).
67
+
64
68
  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:
65
69
 
66
70
  ```yaml
@@ -78,6 +82,10 @@ Each one of the filenames you would like to ignore must be prefixed by the dash
78
82
 
79
83
  # Exclude all files ending by "View.swift"
80
84
  - .*View.swift
85
+
86
+ # Exclude all dependencies
87
+ - Pods
88
+ - Carthage/Checkouts
81
89
  ```
82
90
 
83
91
  ### [Fastlane](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md)
@@ -13,7 +13,7 @@ module Xcov
13
13
 
14
14
  def self.parse(file)
15
15
  report_output = Tempfile.new("report.json")
16
- command = "#{ENV['XCOV_CORE_LIBRARY_PATH'].shellescape} -s #{file.shellescape} -o #{report_output.path.shellescape}"
16
+ command = "#{ENV['XCOV_CORE_LIBRARY_PATH'].shellescape} -s #{file.shellescape} -o #{report_output.path.shellescape} --add-location"
17
17
  description = [{ prefix: "Parsing .xccoverage file: " }]
18
18
  execute_command(command, description)
19
19
  output_file = File.read(report_output.path)
Binary file
@@ -1,5 +1,5 @@
1
1
  module Xcov
2
2
  module Core
3
- VERSION = "0.1"
3
+ VERSION = "0.3"
4
4
  end
5
5
  end
@@ -16,6 +16,16 @@ module Xcov
16
16
  return @list.any? { |pattern| filename =~ Regexp.new("#{pattern}$") }
17
17
  end
18
18
 
19
+ def should_ignore_file_at_path path
20
+ # Ignore specific files
21
+ filename = File.basename(path)
22
+ return true if should_ignore_file(filename)
23
+
24
+ # Also ignore the files from ignored folders
25
+ relative = relative_path(path)
26
+ return @list.any? { |ignored_path| relative_path(path).start_with? ignored_path }
27
+ end
28
+
19
29
  # Static methods
20
30
 
21
31
  def self.read_ignore_file
@@ -31,5 +41,21 @@ module Xcov
31
41
  return ignore_list
32
42
  end
33
43
 
44
+ # Auxiliary methods
45
+
46
+ # Returns a relative path against `source_directory`.
47
+ def relative_path path
48
+ require 'pathname'
49
+
50
+ full_path = Pathname.new(path).realpath # /full/path/to/project/where/is/file.extension
51
+ base_path = Pathname.new(source_directory).realpath # /full/path/to/project/
52
+
53
+ full_path.relative_path_from(base_path).to_s # where/is/file.extension
54
+ end
55
+
56
+ def source_directory
57
+ Xcov.config[:source_directory]
58
+ end
59
+
34
60
  end
35
61
  end
@@ -66,7 +66,14 @@ module Xcov
66
66
  def self.filter_targets targets
67
67
  filtered_targets = Array.new(targets)
68
68
  filtered_targets = filtered_targets.select { |target| !target["name"].include?(".xctest") } if !Xcov.config[:include_test_targets]
69
- filtered_targets = filtered_targets.select { |target| !self.excluded_targets.include?(target["name"])}
69
+
70
+ if Xcov.config[:exclude_targets]
71
+ filtered_targets = filtered_targets.select { |target| !self.excluded_targets.include?(target["name"])}
72
+ end
73
+
74
+ if Xcov.config[:include_targets]
75
+ filtered_targets = filtered_targets.select { |target| self.included_targets.include?(target["name"])}
76
+ end
70
77
 
71
78
  filtered_targets
72
79
  end
@@ -75,11 +82,29 @@ module Xcov
75
82
  excluded_targets = Array.new()
76
83
 
77
84
  if Xcov.config[:exclude_targets]
78
- excluded_targets = Xcov.config[:exclude_targets].split(/\s*,\s*/)
85
+ if Xcov.config[:exclude_targets].is_a?(Array)
86
+ excluded_targets = Xcov.config[:exclude_targets]
87
+ else
88
+ excluded_targets = Xcov.config[:exclude_targets].split(/\s*,\s*/)
89
+ end
79
90
  end
80
91
 
81
92
  excluded_targets
82
93
  end
83
94
 
95
+ def self.included_targets
96
+ included_targets = Array.new()
97
+
98
+ if Xcov.config[:include_targets]
99
+ if Xcov.config[:include_targets].is_a?(Array)
100
+ included_targets = Xcov.config[:include_targets]
101
+ else
102
+ included_targets = Xcov.config[:include_targets].split(/\s*,\s*/)
103
+ end
104
+ end
105
+
106
+ included_targets
107
+ end
108
+
84
109
  end
85
110
  end
@@ -4,17 +4,19 @@ module Xcov
4
4
  class Source < Xcov::Base
5
5
 
6
6
  attr_accessor :name
7
+ attr_accessor :location
7
8
  attr_accessor :type
8
9
  attr_accessor :ignored
9
10
  attr_accessor :coverage
10
11
  attr_accessor :functions
11
12
  attr_accessor :function_templates
12
13
 
13
- def initialize (name, coverage, functions)
14
+ def initialize (name, location, coverage, functions)
14
15
  @name = CGI::escapeHTML(name)
16
+ @location = CGI::escapeHTML(location)
15
17
  @coverage = coverage
16
18
  @functions = functions
17
- @ignored = Xcov.ignore_handler.should_ignore_file(name)
19
+ @ignored = Xcov.ignore_handler.should_ignore_file_at_path(location)
18
20
  @displayable_coverage = self.create_displayable_coverage
19
21
  @coverage_color = self.create_coverage_color
20
22
  @id = Source.create_id(name)
@@ -63,10 +65,11 @@ module Xcov
63
65
 
64
66
  def self.map (dictionary)
65
67
  name = dictionary["name"]
68
+ location = dictionary["location"]
66
69
  coverage = dictionary["coverage"]
67
70
  functions = dictionary["functions"].map { |function| Function.map(function)}
68
71
 
69
- Source.new(name, coverage, functions)
72
+ Source.new(name, location, coverage, functions)
70
73
  end
71
74
 
72
75
  def self.type (name)
@@ -35,11 +35,28 @@ module Xcov
35
35
  optional: true,
36
36
  env_name: "XCOV_SCHEME",
37
37
  description: "The project's scheme. Make sure it's marked as `Shared`"),
38
+ FastlaneCore::ConfigItem.new(key: :source_directory,
39
+ short_option: "-r",
40
+ optional: true,
41
+ env_name: "XCOV_SOURCE_DIRECTORY",
42
+ description: "The path to project's root directory",
43
+ default_value: Dir.pwd,
44
+ verify_block: proc do |value|
45
+ v = File.expand_path(value.to_s)
46
+ raise "Specified source directory does not exist".red unless File.exist?(v)
47
+ raise "Invalid source directory path, it must point to a directory".red unless File.directory?(v)
48
+ end
49
+ ),
38
50
  FastlaneCore::ConfigItem.new(key: :derived_data_path,
39
51
  short_option: "-j",
40
52
  env_name: "XCOV_DERIVED_DATA_PATH",
41
53
  description: "The directory where build products and other derived data will go",
42
- optional: true),
54
+ optional: true,
55
+ verify_block: proc do |value|
56
+ v = File.expand_path(value.to_s)
57
+ raise "Specified derived data directory does not exist".red unless File.exist?(v)
58
+ raise "Invalid derived data path, it must point to a directory".red unless File.directory?(v)
59
+ end),
43
60
  FastlaneCore::ConfigItem.new(key: :output_directory,
44
61
  short_option: "-o",
45
62
  env_name: "XCOV_OUTPUT_DIRECTORY",
@@ -98,7 +115,12 @@ module Xcov
98
115
  default_value: false),
99
116
  FastlaneCore::ConfigItem.new(key: :exclude_targets,
100
117
  optional: true,
101
- description: "Comma separated list of targets to exclude from coverage report")
118
+ conflicting_options: [:include_targets],
119
+ description: "Comma separated list of targets to exclude from coverage report"),
120
+ FastlaneCore::ConfigItem.new(key: :include_targets,
121
+ optional: true,
122
+ conflicting_options: [:exclude_targets],
123
+ description: "Comma separated list of targets to include in coverage report. If specified then exlude_targets will be ignored")
102
124
  ]
103
125
  end
104
126
 
@@ -1,6 +1,6 @@
1
1
  module Xcov
2
2
 
3
- VERSION = "0.11.3"
3
+ VERSION = "0.12"
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.11.3
4
+ version: '0.12'
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-09-23 00:00:00.000000000 Z
11
+ date: 2016-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core