quality_report 1.4.0 → 1.5.0

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
  SHA256:
3
- metadata.gz: c36b81a22b99492d9995e4446769315fe3a01df58e39ed71a3a1050bc05f1791
4
- data.tar.gz: ebc3e1150b528d795fd72e926a462a93aca6311f4a232a3d94c04416bc0a7a7e
3
+ metadata.gz: 23d2fbfb3f81887e40858181c9822346e770e8f242d96cfb39b8239b5288cb37
4
+ data.tar.gz: f39b9f3ae08503660b79bcc0d286ae622d5e0aa5c06b056ef635a8af8def8576
5
5
  SHA512:
6
- metadata.gz: 1e9379b163149edcab1180868a320b7b5529f6c73b5a8c90cc2ffe3292fa818ccc1a48a1cfef9fb6a319fd9dbdf348fc9e6f66749d9b82e4886f2f4a42a50d4d
7
- data.tar.gz: f9911d996413da6cf9264b34749e318d01a1c64e85925c76dae7da609966495341e7fc9d5956866b32c477cc7adbf9f0fbbe50bd0422773242b69e16a122003f
6
+ metadata.gz: de5bfd72e7ea4b31e0bf57785ea38d5503624f0861adc660c1844848d32d839a90ecfb0ed6f5de1eabe13293846fd1771be45bb8f373725eabf6aed092fb50bf
7
+ data.tar.gz: bd38063b3c625ac4296dacff7ca0499192bcbb140f744ea7a063a8fe4e3f98c5f1a1ee93831242592e0f744fecef512081f5fc5c9f134751dba6ea91d14e0285
data/README.md CHANGED
@@ -8,6 +8,8 @@ gem install quality-report
8
8
 
9
9
  ## Usage
10
10
 
11
+ Change to a project directory that contains `*.rb` files. Then:
12
+
11
13
  ```sh
12
14
  ruby-quality-report
13
15
  ```
@@ -16,7 +18,7 @@ After a bit of a wait, it outputs a report in table form:
16
18
 
17
19
  ![Screenshot](screenshot-1@2x.webp)
18
20
 
19
- This is showing, for each author, the percentage of problematic lines of code. Lower is better.
21
+ This is showing, for each author, the percentage of problematic lines of code in the repo. Lower is better.
20
22
 
21
23
 
22
24
  ### For improved relevance, it has two filters.
@@ -44,7 +46,7 @@ It runs a subset of [Rubocop Metrics cops](https://docs.rubocop.org/rubocop/cops
44
46
  - [Method Length](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmethodlength)
45
47
  - [Perceived Complexity](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsperceivedcomplexity)
46
48
 
47
- It then calculates the percentage of warnings per line written, per author. Each failing check is another warning.
49
+ Then, using git, it calculates the percentage of warnings per line written, per author. Each failing check is another warning.
48
50
 
49
51
 
50
52
  ## Intent
@@ -56,7 +58,7 @@ This is a team management tool to:
56
58
 
57
59
  ## Foundational Research
58
60
 
59
- Diving a little deeper, I've seen the phenomenon of micro-economies of bug-creation and bug-fixing develop within teams. Some developers appear to be extremely productive. They write a lot of code. But they also introduce a lot of bugs. The productivity is illusory.
61
+ Diving a little deeper, I've seen the phenomenon of "micro-economies" of bug-creation and bug-fixing develop within teams. Some developers appear to be extremely productive. They create a lot of commits. But they also create a lot of bugs. Their productivity is illusory.
60
62
 
61
63
  This code quality report doesn't track **bugs** per se. But it does report **quality and complexity**. Researchers have found a strong correlation between complexity and bug rate [1]. This link is reflected, _e.g.,_ in international safety standards that mandate low software complexity to reduce failures [2].
62
64
 
@@ -69,13 +71,13 @@ Complex code introduces bugs in a second, more subtle way. This is because code
69
71
 
70
72
  ## Roadmap
71
73
 
72
- - [ ] Colorize the output to separate high, medium, and low warning percentages.
73
- - [ ] Fix the numerical alignment.
74
- - [ ] Add a `--csv` option.
75
- - [ ] Make the filters configurable.
76
- - [ ] Speed up the scan.
74
+ - [x] Colorize the output to separate high, medium, and low warning percentages.
75
+ - [x] Fix the numerical alignment.
77
76
  - [ ] Add a progress bar.
77
+ - [ ] Speed up the scan.
78
78
  - [ ] Refactor from script-style coding to a more standard Ruby project.
79
+ - [ ] Make the filters configurable.
80
+ - [ ] Add a `--csv` option.
79
81
 
80
82
 
81
83
  ## Contributing
@@ -49,10 +49,10 @@ def generate_table(combined_stats)
49
49
 
50
50
  table_data.each do |stats|
51
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 }
52
+ { value: stats[:label], alignment: :left },
53
+ { value: "#{stats[:percent]}%", alignment: :right },
54
+ { value: int_to_accounting(stats[:part_count]), alignment: :right },
55
+ { value: int_to_accounting(stats[:whole_count]), alignment: :right }
56
56
  ]
57
57
  end
58
58
 
@@ -109,8 +109,21 @@ def no_commits_in_last_60_days?(stats)
109
109
  last_commit_time < sixty_days_ago
110
110
  end
111
111
 
112
+ ###
113
+ # Converts a float to an integer percentage
114
+ #
112
115
  def float_to_percent(a_float)
113
- (Float(a_float) * 100).round(1)
116
+ (Float(a_float) * 100).round
117
+ end
118
+
119
+ ##
120
+ # Converts an integer to a string with commas separating thousands.
121
+ #
122
+ # An alternative implementation is:
123
+ # an_int.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\\1,')
124
+ #
125
+ def int_to_accounting(an_int)
126
+ an_int.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
114
127
  end
115
128
 
116
129
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QualityReport
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
data/screenshot-1@2x.webp CHANGED
Binary file
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.0
4
+ version: 1.5.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-09 00:00:00.000000000 Z
11
+ date: 2024-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop