quality_report 1.3.0 → 1.4.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/exe/ruby-quality-report +38 -7
- data/lib/quality_report/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c36b81a22b99492d9995e4446769315fe3a01df58e39ed71a3a1050bc05f1791
|
4
|
+
data.tar.gz: ebc3e1150b528d795fd72e926a462a93aca6311f4a232a3d94c04416bc0a7a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9379b163149edcab1180868a320b7b5529f6c73b5a8c90cc2ffe3292fa818ccc1a48a1cfef9fb6a319fd9dbdf348fc9e6f66749d9b82e4886f2f4a42a50d4d
|
7
|
+
data.tar.gz: f9911d996413da6cf9264b34749e318d01a1c64e85925c76dae7da609966495341e7fc9d5956866b32c477cc7adbf9f0fbbe50bd0422773242b69e16a122003f
|
data/exe/ruby-quality-report
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'tty-table'
|
5
|
+
require 'pastel'
|
5
6
|
|
6
7
|
#
|
7
8
|
# ruby-quality-report
|
@@ -10,6 +11,9 @@ require 'tty-table'
|
|
10
11
|
# of lines of code written by each author that have been flagged as
|
11
12
|
# having too high of a complexity.
|
12
13
|
#
|
14
|
+
#
|
15
|
+
|
16
|
+
SIXTY_DAYS_IN_SECONDS = 60 * 24 * 60 * 60
|
13
17
|
|
14
18
|
def create_combined_stats(part_stats, whole_stats)
|
15
19
|
part_data = make_data_set(part_stats)
|
@@ -40,15 +44,42 @@ def generate_csv(combined_stats)
|
|
40
44
|
end
|
41
45
|
|
42
46
|
def generate_table(combined_stats)
|
43
|
-
table
|
47
|
+
table = TTY::Table.new(header: %W[Author Percent\nFlagged Flagged\nLines All\nLines])
|
48
|
+
table_data = generate_data(combined_stats).reject { should_skip?(_1) }
|
49
|
+
|
50
|
+
table_data.each do |stats|
|
51
|
+
table << [
|
52
|
+
{ value: stats[:label], alignment: :left },
|
53
|
+
{ value: "#{stats[:percent]}%", alignment: :right },
|
54
|
+
{ value: stats[:part_count], alignment: :right },
|
55
|
+
{ value: stats[:whole_count], alignment: :right }
|
56
|
+
]
|
57
|
+
end
|
44
58
|
|
45
|
-
|
46
|
-
|
59
|
+
render_table(table, table_data)
|
60
|
+
end
|
47
61
|
|
48
|
-
|
62
|
+
def render_table(table, table_data)
|
63
|
+
pastel = Pastel.new
|
64
|
+
|
65
|
+
table.render(:unicode, alignment: :center, padding: [0, 1], multiline: true) do |renderer|
|
66
|
+
renderer.border.style = :dim
|
67
|
+
renderer.filter = lambda { |val, row_index, _col_index|
|
68
|
+
if row_index <= 0
|
69
|
+
# Header row
|
70
|
+
val
|
71
|
+
else
|
72
|
+
case table_data[row_index - 1][:percent]
|
73
|
+
when 0...40
|
74
|
+
val
|
75
|
+
when 40...50
|
76
|
+
pastel.bold.yellow(val)
|
77
|
+
else
|
78
|
+
pastel.bold.red(val)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
}
|
49
82
|
end
|
50
|
-
|
51
|
-
table.render(:unicode, alignments: %i[left right right right])
|
52
83
|
end
|
53
84
|
|
54
85
|
def generate_data(combined_stats)
|
@@ -73,7 +104,7 @@ def no_commits_in_last_60_days?(stats)
|
|
73
104
|
|
74
105
|
# Convert Unix timestamp to Time object
|
75
106
|
last_commit_time = Time.at(last_commit.to_i)
|
76
|
-
sixty_days_ago = Time.now -
|
107
|
+
sixty_days_ago = Time.now - SIXTY_DAYS_IN_SECONDS
|
77
108
|
|
78
109
|
last_commit_time < sixty_days_ago
|
79
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quality_report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|