quality_report 1.2.2 → 1.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/README.md +71 -1
- data/exe/ruby-quality-report +3 -8
- data/lib/quality_report/version.rb +1 -1
- data/screenshot-1@2x.webp +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18d81f9fa7d9dca4e114657e18e06fed11bed99df6746c0438bf2bf9b625441
|
4
|
+
data.tar.gz: 19578513e16b8457a2e388e326834f31f1dd17876c822cf6f509349a2ae261e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '03793a5b452e7f3ecc1b3c805eb273ff60f5619dceb902d0f19fc7c1272da7b60751ee737602671b364c00f2a2894568b8cf9c09b6e707feed5029b195c00952'
|
7
|
+
data.tar.gz: 0da7cd9be8337214421ee9ed709dc5a6119fdc48611c4648c70b211e8df0aee85b39c65d24c30dc77be690237f205c34c788176d22e49db38467368c6a9fe9f5
|
data/README.md
CHANGED
@@ -1,12 +1,82 @@
|
|
1
1
|
# Ruby Quality Report
|
2
2
|
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
```sh
|
6
|
+
gem install quality-report
|
7
|
+
```
|
8
|
+
|
3
9
|
## Usage
|
4
10
|
|
5
11
|
```sh
|
6
12
|
ruby-quality-report
|
7
13
|
```
|
8
14
|
|
9
|
-
|
15
|
+
After a bit of a wait, it outputs a report in table form:
|
16
|
+
|
17
|
+

|
18
|
+
|
19
|
+
This is showing, for each author, the percentage of problematic lines of code. Lower is better.
|
20
|
+
|
21
|
+
|
22
|
+
### For improved relevance, it has two filters.
|
23
|
+
|
24
|
+
It excludes:
|
25
|
+
|
26
|
+
- authors with fewer than 200 lines of code
|
27
|
+
- authors with no commits in the previous 60 days
|
28
|
+
|
29
|
+
|
30
|
+
### In Rails Projects
|
31
|
+
|
32
|
+
This works great in Rails projects. It examines code recursively starting in the current directory. In my testing,
|
33
|
+
I like the results best when run from `/app`. This is how I generated the report, above.
|
34
|
+
|
35
|
+
|
36
|
+
## How it works
|
37
|
+
|
38
|
+
It runs a subset of [Rubocop Metrics cops](https://docs.rubocop.org/rubocop/cops_metrics.html) on `*.rb` files that flag single lines or methods:
|
39
|
+
|
40
|
+
- [ABC Size](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize)
|
41
|
+
- [Block Length](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocklength)
|
42
|
+
- [Block Nesting](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocknesting)
|
43
|
+
- [Cyclomatic Complexity](https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity)
|
44
|
+
- [Method Length](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmethodlength)
|
45
|
+
- [Perceived Complexity](https://docs.rubocop.org/rubocop/cops_metrics.html#metricsperceivedcomplexity)
|
46
|
+
|
47
|
+
It then calculates the percentage of warnings per line written, per author. Each failing check is another warning.
|
48
|
+
|
49
|
+
|
50
|
+
## Intent
|
51
|
+
|
52
|
+
This is a team management tool to:
|
53
|
+
|
54
|
+
- understand the quality of the code your team is producing
|
55
|
+
- identify programmers who'd benefit from mentorship and education
|
56
|
+
|
57
|
+
## Foundational Research
|
58
|
+
|
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.
|
60
|
+
|
61
|
+
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
|
+
|
63
|
+
Complex code introduces bugs in a second, more subtle way. This is because code complexity is the killer of understandability. Studies have found that developers devote 64% of their time to understanding code, while only 5% is spent on actually modifying it [3].
|
64
|
+
|
65
|
+
1. De Silva, Dilshan, et al. The Relationship between Code Complexity and Software Quality: An Empirical Study. 2023, https://www.researchgate.net/publication/370761578_The_Relationship_between_Code_Complexity_and_Software_Quality_An_Empirical_Study.
|
66
|
+
2. See e.g., ISO 26262-1:2018(En), Road Vehicles — Functional Safety — Part 1: Vocabulary. https://www.iso.org/obp/ui/en/#iso:std:iso:26262:-1:ed-2:v1:en. Accessed 29 Sept. 2024.
|
67
|
+
3. Feitelson, Dror G. “From Code Complexity Metrics to Program Comprehension.” Communications of the ACM, vol. 66, no. 5, May 2023, pp. 52–61. DOI.org (Crossref), https://doi.org/10.1145/3546576.
|
68
|
+
|
69
|
+
|
70
|
+
## Roadmap
|
71
|
+
|
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.
|
77
|
+
- [ ] Add a progress bar.
|
78
|
+
- [ ] Refactor from script-style coding to a more standard Ruby project.
|
79
|
+
|
10
80
|
|
11
81
|
## Contributing
|
12
82
|
|
data/exe/ruby-quality-report
CHANGED
@@ -17,13 +17,9 @@ def create_combined_stats(part_stats, whole_stats)
|
|
17
17
|
|
18
18
|
whole_data.map do |label, whole_count|
|
19
19
|
part_count = part_data[label] || 0
|
20
|
+
percent = float_to_percent(part_count.to_f / whole_count)
|
20
21
|
|
21
|
-
{
|
22
|
-
label:,
|
23
|
-
part_count:,
|
24
|
-
whole_count:,
|
25
|
-
percent: float_to_percent(part_count.to_f / whole_count)
|
26
|
-
}
|
22
|
+
{ label:, part_count:, whole_count:, percent: }
|
27
23
|
end
|
28
24
|
end
|
29
25
|
|
@@ -52,13 +48,12 @@ def generate_table(combined_stats)
|
|
52
48
|
table << [stats[:label], "#{stats[:percent]}%", stats[:part_count], stats[:whole_count]]
|
53
49
|
end
|
54
50
|
|
55
|
-
table.render(:unicode)
|
51
|
+
table.render(:unicode, alignments: %i[left right right right])
|
56
52
|
end
|
57
53
|
|
58
54
|
def generate_data(combined_stats)
|
59
55
|
combined_stats
|
60
56
|
.sort_by { |s| s[:percent] }
|
61
|
-
.reverse
|
62
57
|
end
|
63
58
|
|
64
59
|
def should_skip?(stats)
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quality_report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- exe/ruby-quality-report
|
76
76
|
- lib/quality_report.rb
|
77
77
|
- lib/quality_report/version.rb
|
78
|
+
- screenshot-1@2x.webp
|
78
79
|
- sig/quality_report.rbs
|
79
80
|
homepage: https://github.com/dogweather/ruby-quality-report
|
80
81
|
licenses:
|