simple_cov-formatter-terminal 1.7.1 → 1.9.0

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
  SHA256:
3
- metadata.gz: 937028f9dff47048a0270872868b5d450adb9d2c3d59b5b8804f113943e68a5f
4
- data.tar.gz: f80a16c1a213906bb40789b8927ed7e205bb17851b8eabd5aeb62425dffdea95
3
+ metadata.gz: 9097ea695f30e44ce30001f876d6f54a7692b0500734a4a2681a753b2a685407
4
+ data.tar.gz: 415877eb22dfcfb888cbff4c40d453e7889214facfa3e2e7f8870750a16f823f
5
5
  SHA512:
6
- metadata.gz: 8061a5e8a7bc3d484a838310317b98b90af8be8329c126374d57f347b7f0981d2624b937d454edab0fb00f199a6f1b415eeb59ed5063f8c87d2b04e249b31749
7
- data.tar.gz: 6d228251a453b86e3ace2440a9a4c5c59343a40e09c16f630a81a065005e50f13f15b6a2ca61c03a3495d800c98cb44a2b82b9d809913492d6a6a0246acd667c
6
+ metadata.gz: 3906ff2828ba8a653922bcf434400381c9e6ba98b50b569f1bfb7167c7c273ebc823a12d76fd1399ef71a6b589fe688071f16e9220c7b7d2f0b191b89fce1ed7
7
+ data.tar.gz: e23b7894b2d161eb8da779bb7258106dadf2461ae4e90343b7db543488549ea99cea0c1d24794947d421c5e7ca2a4d09f9110dbc21582a92a337cebdccd3bed0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Unreleased
2
+ [no unreleased changes yet]
3
+
4
+ ## v1.9.0 (2025-04-03)
5
+ - Support specifying a range (or ranges) of lines for which to show coverage via a `SIMPLECOV_TERMINAL_LINES` environment variable.
6
+
7
+ ## v1.8.0 (2025-03-12)
8
+ - Support disabling via `DISABLE_SIMPLECOV_TERMINAL` environment variable.
9
+
10
+ ### Docs
11
+ - Add table of contents to README.
12
+
1
13
  ## v1.7.1 (2025-02-17)
2
14
  - Respect `SIMPLECOV_TARGET_FILE` env var for otherwise unmappable spec files.
3
15
 
data/Gemfile CHANGED
@@ -12,7 +12,6 @@ gemspec
12
12
  group :development, :test do
13
13
  gem 'bundler', require: false
14
14
  gem 'pry'
15
- # Go back to upstream if/when https://github.com/deivid-rodriguez/pry-byebug/pull/ 428 is merged.
16
15
  gem 'pry-byebug', github: 'davidrunger/pry-byebug'
17
16
  gem 'rubocop', require: false
18
17
  gem 'rubocop-performance', require: false
data/Gemfile.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  GIT
2
2
  remote: https://github.com/davidrunger/pry-byebug
3
- revision: 3ac27ef70a1b16a461db9f7572d3fe1a205effd4
3
+ revision: 0b596b133d49f9d1dcf7bd6210604cfd60c45cba
4
4
  specs:
5
5
  pry-byebug (3.10.1)
6
6
  pry (>= 0.13)
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- simple_cov-formatter-terminal (1.7.1)
12
+ simple_cov-formatter-terminal (1.9.0)
13
13
  activesupport (>= 7.0.4)
14
14
  memo_wise (>= 1.7.0)
15
15
  rouge (>= 4.0.0)
@@ -20,7 +20,7 @@ PATH
20
20
  GEM
21
21
  remote: https://rubygems.org/
22
22
  specs:
23
- activesupport (8.0.1)
23
+ activesupport (8.0.2)
24
24
  base64
25
25
  benchmark (>= 0.3)
26
26
  bigdecimal
@@ -33,7 +33,7 @@ GEM
33
33
  securerandom (>= 0.3)
34
34
  tzinfo (~> 2.0, >= 2.0.5)
35
35
  uri (>= 0.13.1)
36
- ast (2.4.2)
36
+ ast (2.4.3)
37
37
  base64 (0.2.0)
38
38
  benchmark (0.4.0)
39
39
  bigdecimal (3.1.9)
@@ -42,7 +42,7 @@ GEM
42
42
  concurrent-ruby (1.3.5)
43
43
  connection_pool (2.5.0)
44
44
  date (3.4.1)
45
- diff-lcs (1.6.0)
45
+ diff-lcs (1.6.1)
46
46
  docile (1.4.1)
47
47
  drb (2.2.1)
48
48
  i18n (1.14.7)
@@ -52,21 +52,21 @@ GEM
52
52
  pp (>= 0.6.0)
53
53
  rdoc (>= 4.0.0)
54
54
  reline (>= 0.4.2)
55
- json (2.10.1)
55
+ json (2.10.2)
56
56
  language_server-protocol (3.17.0.4)
57
57
  lint_roller (1.1.0)
58
- logger (1.6.6)
59
- memo_wise (1.10.0)
58
+ logger (1.7.0)
59
+ memo_wise (1.11.0)
60
60
  method_source (1.1.0)
61
- minitest (5.25.4)
61
+ minitest (5.25.5)
62
62
  parallel (1.26.3)
63
- parser (3.3.7.1)
63
+ parser (3.3.7.4)
64
64
  ast (~> 2.4.1)
65
65
  racc
66
66
  pp (0.6.2)
67
67
  prettyprint
68
68
  prettyprint (0.2.0)
69
- prism (1.3.0)
69
+ prism (1.4.0)
70
70
  pry (0.15.2)
71
71
  coderay (~> 1.1)
72
72
  method_source (~> 1.0)
@@ -76,7 +76,7 @@ GEM
76
76
  racc (1.8.1)
77
77
  rainbow (3.1.1)
78
78
  rake (13.2.1)
79
- rdoc (6.12.0)
79
+ rdoc (6.13.1)
80
80
  psych (>= 4.0.0)
81
81
  regexp_parser (2.10.0)
82
82
  reline (0.6.0)
@@ -96,7 +96,7 @@ GEM
96
96
  diff-lcs (>= 1.2.0, < 2.0)
97
97
  rspec-support (~> 3.13.0)
98
98
  rspec-support (3.13.2)
99
- rubocop (1.72.1)
99
+ rubocop (1.75.1)
100
100
  json (~> 2.3)
101
101
  language_server-protocol (~> 3.17.0.2)
102
102
  lint_roller (~> 1.1.0)
@@ -104,14 +104,15 @@ GEM
104
104
  parser (>= 3.3.0.2)
105
105
  rainbow (>= 2.2.2, < 4.0)
106
106
  regexp_parser (>= 2.9.3, < 3.0)
107
- rubocop-ast (>= 1.38.0, < 2.0)
107
+ rubocop-ast (>= 1.43.0, < 2.0)
108
108
  ruby-progressbar (~> 1.7)
109
109
  unicode-display_width (>= 2.4.0, < 4.0)
110
- rubocop-ast (1.38.0)
111
- parser (>= 3.3.1.0)
112
- rubocop-performance (1.24.0)
110
+ rubocop-ast (1.44.0)
111
+ parser (>= 3.3.7.2)
112
+ prism (~> 1.4)
113
+ rubocop-performance (1.25.0)
113
114
  lint_roller (~> 1.1)
114
- rubocop (>= 1.72.1, < 2.0)
115
+ rubocop (>= 1.75.0, < 2.0)
115
116
  rubocop-ast (>= 1.38.0, < 2.0)
116
117
  rubocop-rspec (3.5.0)
117
118
  lint_roller (~> 1.1)
@@ -122,12 +123,13 @@ GEM
122
123
  reline
123
124
  runger_config (5.2.0)
124
125
  activesupport (>= 7.1.2)
125
- runger_release_assistant (2.0.0)
126
+ runger_release_assistant (4.3.1)
126
127
  activesupport (>= 6)
127
128
  memo_wise (>= 1.7)
128
129
  rainbow (>= 3.0)
130
+ rake (>= 13.2.1)
129
131
  slop (~> 4.8)
130
- runger_style (5.3.1)
132
+ runger_style (5.8.1)
131
133
  prism (>= 0.24.0)
132
134
  rubocop (>= 1.72.0)
133
135
  securerandom (0.4.1)
@@ -141,13 +143,13 @@ GEM
141
143
  simplecov-html (0.13.1)
142
144
  simplecov_json_formatter (0.1.4)
143
145
  slop (4.10.1)
144
- stringio (3.1.3)
146
+ stringio (3.1.6)
145
147
  tzinfo (2.0.6)
146
148
  concurrent-ruby (~> 1.0)
147
149
  unicode-display_width (3.1.4)
148
150
  unicode-emoji (~> 4.0, >= 4.0.4)
149
151
  unicode-emoji (4.0.4)
150
- uri (1.0.2)
152
+ uri (1.0.3)
151
153
 
152
154
  PLATFORMS
153
155
  ruby
@@ -169,8 +171,8 @@ DEPENDENCIES
169
171
  simplecov-cobertura
170
172
 
171
173
  CHECKSUMS
172
- activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37
173
- ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12
174
+ activesupport (8.0.2) sha256=8565cddba31b900cdc17682fd66ecd020441e3eef320a9930285394e8c07a45e
175
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
174
176
  base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507
175
177
  benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a
176
178
  bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc
@@ -179,31 +181,31 @@ CHECKSUMS
179
181
  concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
180
182
  connection_pool (2.5.0) sha256=233b92f8d38e038c1349ccea65dd3772727d669d6d2e71f9897c8bf5cd53ebfc
181
183
  date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f
182
- diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e
184
+ diff-lcs (1.6.1) sha256=12a5a83f3e37a8e2f4427268e305914d5f1879f22b4e73bb1a09f76a3dd86cd4
183
185
  docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
184
186
  drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340
185
187
  i18n (1.14.7) sha256=ceba573f8138ff2c0915427f1fc5bdf4aa3ab8ae88c8ce255eb3ecf0a11a5d0f
186
188
  io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2
187
189
  irb (1.15.1) sha256=d9bca745ac4207a8b728a52b98b766ca909b86ff1a504bcde3d6f8c84faae890
188
- json (2.10.1) sha256=ddc88ad91a1baf3f0038c174f253af3b086d30dc74db17ca4259bbde982f94dc
190
+ json (2.10.2) sha256=34e0eada93022b2a0a3345bb0b5efddb6e9ff5be7c48e409cfb54ff8a36a8b06
189
191
  language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669
190
192
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
191
- logger (1.6.6) sha256=dd618d24e637715472732e7eed02e33cfbdf56deaad225edd0f1f89d38024017
192
- memo_wise (1.10.0) sha256=ae40ff8e7799697ff5d59d739b8766f76be22eba69c7c8468edb42ab83c94c3f
193
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
194
+ memo_wise (1.11.0) sha256=06ef23a1edb6b8ee4f37d950bba04836b437b4d1036e45d24c2fd2f25b5490c3
193
195
  method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
194
- minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947
196
+ minitest (5.25.5) sha256=391b6c6cb43a4802bfb7c93af1ebe2ac66a210293f4a3fb7db36f2fc7dc2c756
195
197
  parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef
196
- parser (3.3.7.1) sha256=7dbe61618025519024ac72402a6677ead02099587a5538e84371b76659e6aca1
198
+ parser (3.3.7.4) sha256=2b26282274280e13f891080dc4ef3f65ce658d62e13255b246b28ec6754e98ab
197
199
  pp (0.6.2) sha256=947ec3120c6f92195f8ee8aa25a7b2c5297bb106d83b41baa02983686577b6ff
198
200
  prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
199
- prism (1.3.0) sha256=b11620829831b1cb7e6c9b46c81ff8a6e36ccb3f888f164485eb7351f386273a
201
+ prism (1.4.0) sha256=dc0e3e00e93160213dc2a65519d9002a4a1e7b962db57d444cf1a71565bb703e
200
202
  pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b
201
203
  pry-byebug (3.10.1)
202
204
  psych (5.2.3) sha256=84a54bb952d14604fea22d99938348814678782f58b12648fcdfa4d2fce859ee
203
205
  racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
204
206
  rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
205
207
  rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d
206
- rdoc (6.12.0) sha256=7d6f706e070bffa5d18a448f24076cbfb34923a99c1eab842aa18e6ca69f56e0
208
+ rdoc (6.13.1) sha256=62a0dac99493c94e8eb7a3fb44e55aefcb4cecb119f7991f25bddc5ed8d472f7
207
209
  regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61
208
210
  reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2
209
211
  rexml (3.4.1) sha256=c74527a9a0a04b4ec31dbe0dc4ed6004b960af943d8db42e539edde3a871abca
@@ -213,27 +215,27 @@ CHECKSUMS
213
215
  rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58
214
216
  rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef
215
217
  rspec-support (3.13.2) sha256=cea3a2463fd9b84b9dcc9685efd80ea701aa8f7b3decb3b3ce795ed67737dbec
216
- rubocop (1.72.1) sha256=4306ae64c6e7e1026d2a90ed755a113c7b9bf0ac21037b8046fbc826a87daaa5
217
- rubocop-ast (1.38.0) sha256=4fdf6792fe443a9a18acb12dbc8225d0d64cd1654e41fedb30e79c18edbb26ae
218
- rubocop-performance (1.24.0) sha256=e5bd39ff3e368395b9af886927cc37f5892f43db4bd6c8526594352d5b4440b5
218
+ rubocop (1.75.1) sha256=c12900c55b0b52e6ed1384f7f7575beb92047019ce37ca14b9572d80239adc29
219
+ rubocop-ast (1.44.0) sha256=77fdaf4aacf0c7d1ef887b075686124fb4ae5743d42ff7e73bb1c0d6b61b5d0a
220
+ rubocop-performance (1.25.0) sha256=6f7d03568a770054117a78d0a8e191cefeffb703b382871ca7743831b1a52ec1
219
221
  rubocop-rspec (3.5.0) sha256=710c942fe1af884ba8eea75cbb8bdbb051929a2208880a6fc2e2dce1eed5304c
220
222
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
221
223
  runger_byebug (11.4.0) sha256=569e22ba2215f57e7f69e145fcb63be401e29fcd312f7936d813e12d0c7bbee6
222
224
  runger_config (5.2.0) sha256=9b76d767a2daa63f6f8f2c52a8183f3f09a877cd35bcaee692d25377f4dd4558
223
- runger_release_assistant (2.0.0) sha256=f4f5708291eaeef1b881208f87a494877fe768739d6e96b7293fc335b28a3865
224
- runger_style (5.3.1) sha256=418a1e1f8e840a95c0c955f500cd623df1a0353330fdaad07396139b65fdd311
225
+ runger_release_assistant (4.3.1) sha256=3246c925240739eb12b9e6b9526a77ea00fcf0a0941441ff5ffacefb7e3e4d83
226
+ runger_style (5.8.1) sha256=e1748117818758bfd0f2cb038eff86171fca6237c34a723e8dd33882ed5da233
225
227
  securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
226
- simple_cov-formatter-terminal (1.7.1)
228
+ simple_cov-formatter-terminal (1.9.0)
227
229
  simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
228
230
  simplecov-cobertura (2.1.0) sha256=2c6532e34df2e38a379d72cef9a05c3b16c64ce90566beebc6887801c4ad3f02
229
231
  simplecov-html (0.13.1) sha256=5dab0b7ee612e60e9887ad57693832fdf4695b4c0c859eaea5f95c18791ef10b
230
232
  simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
231
233
  slop (4.10.1) sha256=844322b5ffcf17ed4815fdb173b04a20dd82b4fd93e3744c88c8fafea696d9c7
232
- stringio (3.1.3) sha256=1eedb8369ee99a9a0edfdacea95c72d647feb8ce844427c150bd641e1797abc8
234
+ stringio (3.1.6) sha256=292c495d1657adfcdf0a32eecf12a60e6691317a500c3112ad3b2e31068274f5
233
235
  tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
234
236
  unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1
235
237
  unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a
236
- uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27
238
+ uri (1.0.3) sha256=e9f2244608eea2f7bc357d954c65c910ce0399ca5e18a7a29207ac22d8767011
237
239
 
238
240
  RUBY VERSION
239
241
  ruby 3.4.2p28
data/README.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  ![image](https://user-images.githubusercontent.com/8197963/195740768-e2cbb99d-7cf2-42bf-a178-2f78eb653dd3.png)
4
4
 
5
+ <!--ts-->
6
+ * [SimpleCov::Formatter::Terminal](#simplecovformatterterminal)
7
+ * [Installation](#installation)
8
+ * [Usage](#usage)
9
+ * [Which lines to print](#which-lines-to-print)
10
+ * [Modifying the spec_to_app_file_map](#modifying-the-spec_to_app_file_map)
11
+ * [Manually specifying file for which to show coverage](#manually-specifying-file-for-which-to-show-coverage)
12
+ * [Manually specifying the lines for which to show coverage](#manually-specifying-the-lines-for-which-to-show-coverage)
13
+ * [Branch coverage](#branch-coverage)
14
+ * [Terminal hyperlinks](#terminal-hyperlinks)
15
+ * [Disabling](#disabling)
16
+ * [Via env var](#via-env-var)
17
+ * [Development](#development)
18
+ * [Contributing](#contributing)
19
+ * [License](#license)
20
+
21
+ <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
22
+ <!-- Added by: david, at: Thu Apr 3 06:28:33 PM CDT 2025 -->
23
+
24
+ <!--te-->
25
+
5
26
  ## Installation
6
27
 
7
28
  *Note:* This gem depends upon RSpec. If you aren't using RSpec to run your tests, it won't work!
@@ -108,6 +129,10 @@ SimpleCov::Formatter::Terminal.config.spec_to_app_file_map = {
108
129
 
109
130
  An alternative to using the `spec_to_app_file_map` configuration is to set a `SIMPLECOV_TARGET_FILE` environment variable.
110
131
 
132
+ ### Manually specifying the lines for which to show coverage
133
+
134
+ To show coverage only for certain lines, you can specify a range (or ranges) via a `SIMPLECOV_TERMINAL_LINES` environment variable, e.g. `SIMPLECOV_TERMINAL_LINES=169-172` or `SIMPLECOV_TERMINAL_LINES=172,180-192`.
135
+
111
136
  ## Branch coverage
112
137
 
113
138
  If you enable branch coverage for SimpleCov (via `enable_coverage(:branch)` within your
@@ -134,6 +159,12 @@ For example, this pattern will work to make the line numbers clickable links tha
134
159
  SIMPLECOV_TERMINAL_HYPERLINK_PATTERN="vscode://file/%f:%l"
135
160
  ```
136
161
 
162
+ ## Disabling
163
+
164
+ ### Via env var
165
+
166
+ You can disable SimpleCov::Formatter::Terminal by setting a `DISABLE_SIMPLECOV_TERMINAL` environment variable to any value.
167
+
137
168
  ## Development
138
169
 
139
170
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run
@@ -20,8 +20,8 @@ module SimpleCov::Formatter::Terminal::BranchCoverage
20
20
 
21
21
  def missed_branch_info(line, sourcefile)
22
22
  uncovered_branches(sourcefile).
23
- select { _1.start_line == line.line_number }.
24
- map { _1.type.to_s }.
23
+ select { it.start_line == line.line_number }.
24
+ map { it.type.to_s }.
25
25
  join(', ').
26
26
  presence
27
27
  end
@@ -36,7 +36,7 @@ class SimpleCov::Formatter::Terminal::FileDeterminer
36
36
 
37
37
  memo_wise \
38
38
  def unmappable_spec_file?
39
- unmappable_spec_regexes.any? { executed_spec_file.match?(_1) }
39
+ unmappable_spec_regexes.any? { executed_spec_file.match?(it) }
40
40
  end
41
41
 
42
42
  memo_wise \
@@ -32,7 +32,7 @@ module SimpleCov::Formatter::Terminal::RSpecIntegration
32
32
  SimpleCov::Formatter::Terminal::RSpecIntegration.failure_occurred =
33
33
  examples.any?(&:exception)
34
34
  SimpleCov::Formatter::Terminal::RSpecIntegration.executed_spec_files =
35
- examples.map { _1.file_path.delete_prefix('./') }.uniq
35
+ examples.map { it.file_path.delete_prefix('./') }.uniq
36
36
  end
37
37
  end
38
38
  end
@@ -17,7 +17,7 @@ class SimpleCov::Formatter::Terminal::ResultPrinter
17
17
  end
18
18
 
19
19
  def print_coverage_info(result)
20
- sourcefile = result.files.find { _1.filename.end_with?(targeted_application_file) }
20
+ sourcefile = result.files.find { it.filename.end_with?(targeted_application_file) }
21
21
  force_coverage = ENV.fetch('SIMPLECOV_FORCE_DETAILS', nil) == '1'
22
22
 
23
23
  if sourcefile.nil?
@@ -81,12 +81,17 @@ class SimpleCov::Formatter::Terminal::ResultPrinter
81
81
  def print_skipped_lines(skipped_lines)
82
82
  divider = ' -' * 40
83
83
 
84
+ # If we are skipping lines because they aren't in an env var specified
85
+ # range, they might or might not be covered. If we are skipping them
86
+ # otherwise, it's because they're covered.
87
+ skipped_lines_adjective = ENV.fetch('SIMPLECOV_TERMINAL_LINES', nil).present? ? '' : 'covered '
88
+
84
89
  puts(line_printer.numbered_line_output(nil, :white, divider))
85
90
  puts(
86
91
  line_printer.numbered_line_output(
87
92
  nil,
88
93
  :white,
89
- "#{skipped_lines.size} covered line(s) omitted".center(80, ' '),
94
+ "#{skipped_lines.size} #{skipped_lines_adjective}line(s) omitted".center(80, ' '),
90
95
  ),
91
96
  )
92
97
  puts(line_printer.numbered_line_output(nil, :white, divider))
@@ -158,46 +163,51 @@ class SimpleCov::Formatter::Terminal::ResultPrinter
158
163
  end
159
164
 
160
165
  def sourcefile
161
- @sourcefile ||= @result.files.find { _1.filename.end_with?(targeted_application_file) }
166
+ @sourcefile ||= @result.files.find { it.filename.end_with?(targeted_application_file) }
162
167
  end
163
168
 
164
- # rubocop:disable Metrics/PerceivedComplexity
165
169
  memo_wise \
166
170
  def line_numbers_to_print
167
171
  max_line_number = sourcefile.lines.map(&:line_number).max
168
172
 
169
173
  begin
170
- case SimpleCov::Formatter::Terminal.config.lines_to_print.to_sym
171
- in SimpleCov::Formatter::Terminal::Config::LinesToPrint::ALL
172
- (1..max_line_number).to_a
173
- in SimpleCov::Formatter::Terminal::Config::LinesToPrint::UNCOVERED
174
- line_numbers_to_print = []
175
-
176
- sourcefile.lines.each do |line|
177
- if (
178
- line.coverage.nil? || (
179
- (line.coverage > 0) &&
180
- !line_numbers_with_missing_branches(sourcefile).include?(line.line_number)
174
+ if (env_var_line_ranges = ENV.fetch('SIMPLECOV_TERMINAL_LINES', nil)).present?
175
+ env_var_line_ranges.split(',').reduce([]) do |total_lines, env_var_line_range|
176
+ lines_start, lines_end = env_var_line_range.split('-').map { Integer(it) }
177
+ total_lines + (lines_start..(lines_end || lines_start)).to_a
178
+ end
179
+ else
180
+ case SimpleCov::Formatter::Terminal.config.lines_to_print.to_sym
181
+ in SimpleCov::Formatter::Terminal::Config::LinesToPrint::ALL
182
+ (1..max_line_number).to_a
183
+ in SimpleCov::Formatter::Terminal::Config::LinesToPrint::UNCOVERED
184
+ line_numbers_to_print = []
185
+
186
+ sourcefile.lines.each do |line|
187
+ if (
188
+ line.coverage.nil? || (
189
+ (line.coverage > 0) &&
190
+ !line_numbers_with_missing_branches(sourcefile).include?(line.line_number)
191
+ )
181
192
  )
182
- )
183
- next
193
+ next
194
+ end
195
+
196
+ line_number = line.line_number
197
+ contextualized_line_numbers =
198
+ ((line_number - 2)..(line_number + 2)).
199
+ to_a.
200
+ select do |context_line_number|
201
+ context_line_number.positive? && context_line_number <= max_line_number
202
+ end
203
+ line_numbers_to_print += contextualized_line_numbers
184
204
  end
185
205
 
186
- line_number = line.line_number
187
- contextualized_line_numbers =
188
- ((line_number - 2)..(line_number + 2)).
189
- to_a.
190
- select do |context_line_number|
191
- context_line_number.positive? && context_line_number <= max_line_number
192
- end
193
- line_numbers_to_print += contextualized_line_numbers
206
+ line_numbers_to_print
194
207
  end
195
-
196
- line_numbers_to_print
197
208
  end
198
209
  end.to_set
199
210
  end
200
- # rubocop:enable Metrics/PerceivedComplexity
201
211
 
202
212
  memo_wise \
203
213
  def line_printer
@@ -5,6 +5,6 @@ module SimpleCov::Formatter; end
5
5
 
6
6
  # rubocop:disable Style/StaticClass
7
7
  class SimpleCov::Formatter::Terminal
8
- VERSION = '1.7.1'
8
+ VERSION = '1.9.0'
9
9
  end
10
10
  # rubocop:enable Style/StaticClass
@@ -46,16 +46,18 @@ class SimpleCov::Formatter::Terminal
46
46
  end
47
47
 
48
48
  def format(result)
49
- if executed_spec_files.nil?
50
- print_info_for_no_executed_specs
51
- elsif unmappable_spec_file? && targeted_application_file.nil?
52
- print_info_for_undeterminable_application_target
53
- elsif targeted_application_file.nil?
54
- print_info_for_undetermined_application_target
55
- elsif File.exist?(targeted_application_file)
56
- print_coverage_info(result)
57
- else
58
- print_info_for_nonexistent_application_target
49
+ unless ENV.key?('DISABLE_SIMPLECOV_TERMINAL')
50
+ if executed_spec_files.nil?
51
+ print_info_for_no_executed_specs
52
+ elsif unmappable_spec_file? && targeted_application_file.nil?
53
+ print_info_for_undeterminable_application_target
54
+ elsif targeted_application_file.nil?
55
+ print_info_for_undetermined_application_target
56
+ elsif File.exist?(targeted_application_file)
57
+ print_coverage_info(result)
58
+ else
59
+ print_info_for_nonexistent_application_target
60
+ end
59
61
  end
60
62
  end
61
63
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_cov-formatter-terminal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Runger
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-18 00:00:00.000000000 Z
10
+ date: 2025-04-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.6.3
148
+ rubygems_version: 3.6.6
149
149
  specification_version: 4
150
150
  summary: Print detailed code coverage info to the terminal
151
151
  test_files: []