countless 2.2.0 → 2.3.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 +4 -4
- data/.rubocop.yml +4 -34
- data/CHANGELOG.md +4 -0
- data/Envfile +1 -0
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/lib/countless/annotations.rb +0 -7
- data/lib/countless/cloc.rb +0 -4
- data/lib/countless/configuration.rb +1 -3
- data/lib/countless/extensions/configuration_handling.rb +0 -12
- data/lib/countless/statistics.rb +1 -32
- data/lib/countless/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9bd40e745d386b15e7078d50dfb2bb101a4eee94e959483558f2081bb336239e
|
|
4
|
+
data.tar.gz: 3ef387060b53e5757aa7261e24d0cf25c51613a3814dd73f206c2a0ba18d21a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b58d7d01c56663f3d3c17aa303fd0e4b88097afd53fa914a7ad3c49c5a16d44991139730493e344b5fb4e6a897e7fb42f5efe391b0b7cc6bfbec343f285200b2
|
|
7
|
+
data.tar.gz: 692e6523b3ba000c2454759aa3a9f725955b277518e98841ecb693234172764f01d9deeb1fae7abc685541e3e71f184d279c1e4df6907f07757ec77ee069608e
|
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://potpourri.hausgold.de/config/rubocop.yml
|
|
3
|
+
- https://potpourri.hausgold.de/config/rubocop-gem.yml
|
|
4
|
+
|
|
1
5
|
plugins:
|
|
2
6
|
- rubocop-rspec
|
|
3
7
|
- rubocop-rails
|
|
4
8
|
|
|
5
|
-
Style/Documentation:
|
|
6
|
-
Enabled: true
|
|
7
|
-
|
|
8
9
|
AllCops:
|
|
9
10
|
NewCops: enable
|
|
10
11
|
SuggestExtensions: false
|
|
@@ -18,43 +19,12 @@ AllCops:
|
|
|
18
19
|
- gemfiles/**/*
|
|
19
20
|
- spec/fixtures/files/**/*
|
|
20
21
|
|
|
21
|
-
Metrics/BlockLength:
|
|
22
|
-
Exclude:
|
|
23
|
-
- Rakefile
|
|
24
|
-
- '*.gemspec'
|
|
25
|
-
- spec/**/*.rb
|
|
26
|
-
- '**/*.rake'
|
|
27
|
-
- doc/**/*.rb
|
|
28
|
-
|
|
29
|
-
# MFA is not yet enabled for our gems yet.
|
|
30
|
-
Gemspec/RequireMFA:
|
|
31
|
-
Enabled: false
|
|
32
|
-
|
|
33
|
-
# We stay with the original Ruby Style Guide recommendation.
|
|
34
|
-
Layout/LineLength:
|
|
35
|
-
Max: 80
|
|
36
|
-
|
|
37
|
-
# Document all the things.
|
|
38
|
-
Style/DocumentationMethod:
|
|
39
|
-
Enabled: true
|
|
40
|
-
RequireForNonPublicMethods: true
|
|
41
|
-
|
|
42
22
|
# It's a deliberate idiom in RSpec.
|
|
43
23
|
# See: https://github.com/bbatsov/rubocop/issues/4222
|
|
44
24
|
Lint/AmbiguousBlockAssociation:
|
|
45
25
|
Exclude:
|
|
46
26
|
- "spec/**/*"
|
|
47
27
|
|
|
48
|
-
# Because +expect_any_instance_of().to have_received()+ is not
|
|
49
|
-
# supported with the +with(hash_including)+ matchers
|
|
50
|
-
RSpec/MessageSpies:
|
|
51
|
-
EnforcedStyle: receive
|
|
52
|
-
|
|
53
|
-
# Because nesting makes sense here to group the feature tests
|
|
54
|
-
# more effective. This increases maintainability.
|
|
55
|
-
RSpec/NestedGroups:
|
|
56
|
-
Max: 4
|
|
57
|
-
|
|
58
28
|
# Disable regular Rails spec paths.
|
|
59
29
|
Rails/FilePath:
|
|
60
30
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
|
4
4
|
|
|
5
|
+
### 2.3.0 (19 December 2025)
|
|
6
|
+
|
|
7
|
+
* Migrated to a shared Rubocop configuration for HAUSGOLD gems ([#16](https://github.com/hausgold/countless/pull/16))
|
|
8
|
+
|
|
5
9
|
### 2.2.0 (23 October 2025)
|
|
6
10
|
|
|
7
11
|
* Added support for Rails 8.1 ([#14](https://github.com/hausgold/countless/pull/14))
|
data/Envfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ with the gem package.
|
|
|
17
17
|
- [Installation](#installation)
|
|
18
18
|
- [Requirements](#requirements)
|
|
19
19
|
- [Usage](#usage)
|
|
20
|
-
- [
|
|
20
|
+
- [Additional Configuration](#additional-configuration)
|
|
21
21
|
- [Development](#development)
|
|
22
22
|
- [Code of Conduct](#code-of-conduct)
|
|
23
23
|
- [Contributing](#contributing)
|
|
@@ -50,7 +50,7 @@ $ bundle
|
|
|
50
50
|
|
|
51
51
|
## Usage
|
|
52
52
|
|
|
53
|
-
You can configure the Countless gem in
|
|
53
|
+
You can configure the Countless gem in several ways, but the most common
|
|
54
54
|
usecase is to install its Rake tasks and configure it in order to work
|
|
55
55
|
properly. Here comes a self descriptive example (within a Rakefile):
|
|
56
56
|
|
|
@@ -92,14 +92,14 @@ Afterwards the following Rake tasks are available to you:
|
|
|
92
92
|
* **notes:custom**: Show notes for custom annotation (run via `bundle exec
|
|
93
93
|
rake notes:custom ANNOTATION='NOTE'`)
|
|
94
94
|
|
|
95
|
-
###
|
|
95
|
+
### Additional Configuration
|
|
96
96
|
|
|
97
97
|
```ruby
|
|
98
98
|
# All the configured values here represent the Gem defaults.
|
|
99
99
|
Countless.configure do |config|
|
|
100
100
|
# The base/root path of the project to work on. This path is used as a #
|
|
101
101
|
# prefix to all relative path/file configurations. By default we check for a
|
|
102
|
-
# Rake
|
|
102
|
+
# Rake invocation (Rakefile location), a Rails invocation (project root) or
|
|
103
103
|
# fallback the the current working directory of the process.
|
|
104
104
|
config.base_path = Dir.pwd
|
|
105
105
|
|
|
@@ -10,9 +10,6 @@ module Countless
|
|
|
10
10
|
# of the line (or closing ERB comment tag) is considered to be their text.
|
|
11
11
|
#
|
|
12
12
|
# Heavily stolen from: https://bit.ly/3nBS0aj
|
|
13
|
-
#
|
|
14
|
-
# rubocop:disable Metrics/ClassLength -- because of the nested Annotation
|
|
15
|
-
# class
|
|
16
13
|
class Annotations
|
|
17
14
|
attr_reader :tag, :options, :dirs, :files, :annotations
|
|
18
15
|
|
|
@@ -124,8 +121,6 @@ module Countless
|
|
|
124
121
|
# Formats the found annotations.
|
|
125
122
|
#
|
|
126
123
|
# @return [String] the formatted annotations
|
|
127
|
-
#
|
|
128
|
-
# rubocop:disable Metrics/AbcSize -- because of the indentation logic
|
|
129
124
|
def to_s
|
|
130
125
|
buf = []
|
|
131
126
|
options[:indent] = annotations.flat_map do |_f, a|
|
|
@@ -138,7 +133,6 @@ module Countless
|
|
|
138
133
|
end
|
|
139
134
|
buf.join("\n")
|
|
140
135
|
end
|
|
141
|
-
# rubocop:enable Metrics/AbcSize
|
|
142
136
|
|
|
143
137
|
# A single annotation representation.
|
|
144
138
|
Annotation = Struct.new(:line, :tag, :text) do
|
|
@@ -240,5 +234,4 @@ module Countless
|
|
|
240
234
|
end
|
|
241
235
|
end
|
|
242
236
|
end
|
|
243
|
-
# rubocop:enable Metrics/ClassLength
|
|
244
237
|
end
|
data/lib/countless/cloc.rb
CHANGED
|
@@ -33,9 +33,6 @@ module Countless
|
|
|
33
33
|
# directories) to fetch the statistics for
|
|
34
34
|
# @return [Hash{String => Hash{String => Mixed}] the raw CLOC
|
|
35
35
|
# YAML output
|
|
36
|
-
#
|
|
37
|
-
# rubocop:disable Metrics/MethodLength -- because of the system command
|
|
38
|
-
# preparation
|
|
39
36
|
def raw_stats(*paths)
|
|
40
37
|
cmd = [
|
|
41
38
|
Countless.cloc_path,
|
|
@@ -61,7 +58,6 @@ module Countless
|
|
|
61
58
|
# Otherwise we use the CLOC produced YAML and parse it
|
|
62
59
|
YAML.safe_load(stdout) || {}
|
|
63
60
|
end
|
|
64
|
-
# rubocop:enable Metrics/MethodLength
|
|
65
61
|
end
|
|
66
62
|
end
|
|
67
63
|
end
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
module Countless
|
|
4
4
|
# The configuration for the countless gem.
|
|
5
5
|
#
|
|
6
|
-
# rubocop:disable Metrics/
|
|
7
|
-
# rubocop:disable Metrics/BlockLength -- ditto
|
|
6
|
+
# rubocop:disable Metrics/BlockLength -- because of the various defaults
|
|
8
7
|
class Configuration < ActiveSupport::OrderedOptions
|
|
9
8
|
# Track our configurations settings (+Symbol+ keys) and their defaults as
|
|
10
9
|
# lazy-loaded +Proc+'s values
|
|
@@ -242,6 +241,5 @@ module Countless
|
|
|
242
241
|
}.deep_merge(additional_annotation_patterns)
|
|
243
242
|
end
|
|
244
243
|
end
|
|
245
|
-
# rubocop:enable Metrics/ClassLength
|
|
246
244
|
# rubocop:enable Metrics/BlockLength
|
|
247
245
|
end
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
module Countless
|
|
4
4
|
module Extensions
|
|
5
5
|
# A top-level gem-module extension to handle configuration needs.
|
|
6
|
-
#
|
|
7
|
-
# rubocop:disable Metrics/BlockLength -- because this is how an
|
|
8
|
-
# +ActiveSupport::Concern+ looks like
|
|
9
6
|
module ConfigurationHandling
|
|
10
7
|
extend ActiveSupport::Concern
|
|
11
8
|
|
|
@@ -39,11 +36,6 @@ module Countless
|
|
|
39
36
|
# checked for code statistics.
|
|
40
37
|
#
|
|
41
38
|
# @return [Array<Hash{Symbol => Mixed}>] the statistics directories
|
|
42
|
-
#
|
|
43
|
-
# rubocop:disable Metrics/MethodLength -- because of the configuration
|
|
44
|
-
# assembling
|
|
45
|
-
# rubocop:disable Metrics/AbcSize -- ditto
|
|
46
|
-
# rubocop:disable Metrics/CyclomaticComplexity -- ditto
|
|
47
39
|
def statistic_directories
|
|
48
40
|
conf = configuration
|
|
49
41
|
pattern_suffix = "/**/*.{#{conf.stats_file_extensions.join(',')}}"
|
|
@@ -73,11 +65,7 @@ module Countless
|
|
|
73
65
|
|
|
74
66
|
res.sort_by { |cur| [cur[:test].to_s, cur[:name]] }
|
|
75
67
|
end
|
|
76
|
-
# rubocop:enable Metrics/MethodLength
|
|
77
|
-
# rubocop:enable Metrics/AbcSize
|
|
78
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
79
68
|
end
|
|
80
69
|
end
|
|
81
|
-
# rubocop:enable Metrics/BlockLength
|
|
82
70
|
end
|
|
83
71
|
end
|
data/lib/countless/statistics.rb
CHANGED
|
@@ -4,9 +4,6 @@ module Countless
|
|
|
4
4
|
# The source code statistics displaying handler.
|
|
5
5
|
#
|
|
6
6
|
# Heavily stolen from: https://bit.ly/3qpvgfu
|
|
7
|
-
#
|
|
8
|
-
# rubocop:disable Metrics/ClassLength -- because of the calculation and
|
|
9
|
-
# formatting logic
|
|
10
7
|
class Statistics
|
|
11
8
|
# Make the extracted information accessible
|
|
12
9
|
attr_reader :dirs, :statistics, :total
|
|
@@ -17,12 +14,6 @@ module Countless
|
|
|
17
14
|
#
|
|
18
15
|
# @param dirs [Array<Hash{Symbol => Mixed}>] the configurations
|
|
19
16
|
# @return [Countless::Statistics] the new instance
|
|
20
|
-
#
|
|
21
|
-
# rubocop:disable Metrics/AbcSize -- because of the directory/config
|
|
22
|
-
# resolving
|
|
23
|
-
# rubocop:disable Metrics/PerceivedComplexity -- ditto
|
|
24
|
-
# rubocop:disable Metrics/CyclomaticComplexity -- ditto
|
|
25
|
-
# rubocop:disable Metrics/MethodLength -- ditto
|
|
26
17
|
def initialize(*dirs)
|
|
27
18
|
base_path = Countless.configuration.base_path
|
|
28
19
|
|
|
@@ -47,10 +38,6 @@ module Countless
|
|
|
47
38
|
@statistics = calculate_statistics
|
|
48
39
|
@total = calculate_total if @dirs.length > 1
|
|
49
40
|
end
|
|
50
|
-
# rubocop:enable Metrics/AbcSize
|
|
51
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
52
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
53
|
-
# rubocop:enable Metrics/MethodLength
|
|
54
41
|
|
|
55
42
|
# Calculate the total statistics of all sub-statistics for the configured
|
|
56
43
|
# directories.
|
|
@@ -119,9 +106,6 @@ module Countless
|
|
|
119
106
|
#
|
|
120
107
|
# rubocop:disable Metrics/MethodLength -- because of the complex formatting
|
|
121
108
|
# logic with fully dynamic columns widths
|
|
122
|
-
# rubocop:disable Metrics/PerceivedComplexity -- ditto
|
|
123
|
-
# rubocop:disable Metrics/CyclomaticComplexity -- ditto
|
|
124
|
-
# rubocop:disable Metrics/AbcSize -- ditto
|
|
125
109
|
def to_s
|
|
126
110
|
col_sizes = {}
|
|
127
111
|
rows = to_table.map do |row|
|
|
@@ -152,9 +136,6 @@ module Countless
|
|
|
152
136
|
end.join("\n")
|
|
153
137
|
end
|
|
154
138
|
# rubocop:enable Metrics/MethodLength
|
|
155
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
156
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
157
|
-
# rubocop:enable Metrics/AbcSize
|
|
158
139
|
|
|
159
140
|
# Convert the code statistics to a processable table structure. Each
|
|
160
141
|
# element in the resulting array is a single line, while array elements
|
|
@@ -162,8 +143,6 @@ module Countless
|
|
|
162
143
|
# later by +#to_s+.
|
|
163
144
|
#
|
|
164
145
|
# @return [Array<Array<String, Integer>, Symbol>] the raw table
|
|
165
|
-
#
|
|
166
|
-
# rubocop:disable Metrics/MethodLength -- because of the table construction
|
|
167
146
|
def to_table
|
|
168
147
|
table = [
|
|
169
148
|
:splitter,
|
|
@@ -181,7 +160,6 @@ module Countless
|
|
|
181
160
|
table << code_test_stats_line
|
|
182
161
|
table
|
|
183
162
|
end
|
|
184
|
-
# rubocop:enable Metrics/MethodLength
|
|
185
163
|
|
|
186
164
|
# Return the final meta statistics line.
|
|
187
165
|
#
|
|
@@ -247,7 +225,7 @@ module Countless
|
|
|
247
225
|
# Parse and add statistics of a single file by path.
|
|
248
226
|
#
|
|
249
227
|
# @param path [String] the path of the file
|
|
250
|
-
# @param stats [Hash{Symbol => Integer}]
|
|
228
|
+
# @param stats [Hash{Symbol => Integer}] additional CLOC statistics
|
|
251
229
|
def add_by_file_path(path, **stats)
|
|
252
230
|
@lines += stats.fetch(:total, 0)
|
|
253
231
|
@code_lines += stats.fetch(:code, 0)
|
|
@@ -260,11 +238,6 @@ module Countless
|
|
|
260
238
|
# the current calculator instance metrics.
|
|
261
239
|
#
|
|
262
240
|
# @param path [String] the path of the file
|
|
263
|
-
#
|
|
264
|
-
# rubocop:disable Metrics/AbcSize -- because of the pattern search by
|
|
265
|
-
# file extension and pattern matching on each line afterwards
|
|
266
|
-
# rubocop:disable Metrics/CyclomaticComplexity -- ditto
|
|
267
|
-
# rubocop:disable Metrics/PerceivedComplexity -- ditto
|
|
268
241
|
def add_details_by_file_path(path)
|
|
269
242
|
all_patterns = Countless.configuration.detailed_stats_patterns
|
|
270
243
|
|
|
@@ -283,9 +256,6 @@ module Countless
|
|
|
283
256
|
@methods += 1 if patterns[:method]&.match? line
|
|
284
257
|
end
|
|
285
258
|
end
|
|
286
|
-
# rubocop:enable Metrics/AbcSize
|
|
287
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
288
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
289
259
|
|
|
290
260
|
# Return the methods per classes.
|
|
291
261
|
#
|
|
@@ -316,5 +286,4 @@ module Countless
|
|
|
316
286
|
end
|
|
317
287
|
end
|
|
318
288
|
end
|
|
319
|
-
# rubocop:enable Metrics/ClassLength
|
|
320
289
|
end
|
data/lib/countless/version.rb
CHANGED