rails_stats_fb 2.1.0.pre1

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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/test.yml +41 -0
  3. data/.gitignore +24 -0
  4. data/CHANGELOG.md +27 -0
  5. data/CODE_OF_CONDUCT.md +76 -0
  6. data/Gemfile +14 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +223 -0
  9. data/Rakefile +13 -0
  10. data/codecov.yml +2 -0
  11. data/lib/rails_stats/all.rb +14 -0
  12. data/lib/rails_stats/app_statistics.rb +62 -0
  13. data/lib/rails_stats/code_statistics.rb +24 -0
  14. data/lib/rails_stats/code_statistics_calculator.rb +93 -0
  15. data/lib/rails_stats/console_formatter.rb +73 -0
  16. data/lib/rails_stats/cucumber_statistics.rb +46 -0
  17. data/lib/rails_stats/gem_statistics.rb +31 -0
  18. data/lib/rails_stats/inflector.rb +605 -0
  19. data/lib/rails_stats/json_formatter.rb +81 -0
  20. data/lib/rails_stats/root_statistics.rb +42 -0
  21. data/lib/rails_stats/spec_statistics.rb +76 -0
  22. data/lib/rails_stats/stats_calculator.rb +169 -0
  23. data/lib/rails_stats/stats_formatter.rb +13 -0
  24. data/lib/rails_stats/tasks.rb +14 -0
  25. data/lib/rails_stats/test_statistics.rb +74 -0
  26. data/lib/rails_stats/util.rb +111 -0
  27. data/lib/rails_stats/version.rb +5 -0
  28. data/lib/rails_stats.rb +9 -0
  29. data/pull_request_template.md +9 -0
  30. data/rails_stats.gemspec +23 -0
  31. data/test/dummy/Gemfile +43 -0
  32. data/test/dummy/Rakefile +6 -0
  33. data/test/dummy/app/assets/config/manifest.js +2 -0
  34. data/test/dummy/app/assets/images/.keep +0 -0
  35. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  36. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  37. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  38. data/test/dummy/app/controllers/application_controller.rb +7 -0
  39. data/test/dummy/app/controllers/concerns/.keep +0 -0
  40. data/test/dummy/app/helpers/application_helper.rb +3 -0
  41. data/test/dummy/app/javascript/channels/consumer.js +6 -0
  42. data/test/dummy/app/javascript/channels/index.js +5 -0
  43. data/test/dummy/app/javascript/packs/application.js +16 -0
  44. data/test/dummy/app/jobs/application_job.rb +7 -0
  45. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  46. data/test/dummy/app/models/application_record.rb +3 -0
  47. data/test/dummy/app/models/comment.rb +3 -0
  48. data/test/dummy/app/models/concerns/.keep +0 -0
  49. data/test/dummy/app/models/pet.rb +2 -0
  50. data/test/dummy/app/models/user.rb +2 -0
  51. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  52. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  53. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  54. data/test/dummy/bin/rails +4 -0
  55. data/test/dummy/bin/rake +4 -0
  56. data/test/dummy/bin/setup +36 -0
  57. data/test/dummy/bin/yarn +11 -0
  58. data/test/dummy/config/application.rb +35 -0
  59. data/test/dummy/config/boot.rb +4 -0
  60. data/test/dummy/config/cable.yml +10 -0
  61. data/test/dummy/config/credentials.yml.enc +1 -0
  62. data/test/dummy/config/database.yml +85 -0
  63. data/test/dummy/config/environment.rb +5 -0
  64. data/test/dummy/config/environments/development.rb +62 -0
  65. data/test/dummy/config/environments/production.rb +112 -0
  66. data/test/dummy/config/environments/test.rb +49 -0
  67. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  68. data/test/dummy/config/initializers/assets.rb +14 -0
  69. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  70. data/test/dummy/config/initializers/content_security_policy.rb +30 -0
  71. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  72. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  73. data/test/dummy/config/initializers/inflections.rb +16 -0
  74. data/test/dummy/config/initializers/mime_types.rb +4 -0
  75. data/test/dummy/config/initializers/pagy.rb +1 -0
  76. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  77. data/test/dummy/config/locales/en.yml +33 -0
  78. data/test/dummy/config/master.key +1 -0
  79. data/test/dummy/config/puma.rb +38 -0
  80. data/test/dummy/config/routes.rb +3 -0
  81. data/test/dummy/config/spring.rb +6 -0
  82. data/test/dummy/config/storage.yml +34 -0
  83. data/test/dummy/config.ru +5 -0
  84. data/test/dummy/db/schema.rb +10 -0
  85. data/test/dummy/lib/monkeypatches.rb +1 -0
  86. data/test/dummy/package.json +10 -0
  87. data/test/dummy/spec/models/user_spec.rb +3 -0
  88. data/test/dummy/spec/support/support_file.rb +1 -0
  89. data/test/dummy/test/models/user_test.rb +2 -0
  90. data/test/dummy/test/support/test_helper.rb +1 -0
  91. data/test/fixtures/console-output.txt +43 -0
  92. data/test/lib/rails_stats/code_statistics_test.rb +23 -0
  93. data/test/lib/rails_stats/json_formatter_test.rb +293 -0
  94. data/test/test_helper.rb +27 -0
  95. metadata +228 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9968d204702aea7dba12249fbd2e4ed357e893926b9016faba1a26369dbe296a
4
+ data.tar.gz: 32d0fbc1add0d8273aa31b277c9fb06e15ae78bd5fbf1d06c8389208bb6d7490
5
+ SHA512:
6
+ metadata.gz: ab1996c2b36f35dc5c26216d2849c59b5d92d81191cfbffcdce14639772a3292fad32db3d2462b657fc249e33c32b367a04e95a13473e098a793ca6c15d150eb
7
+ data.tar.gz: 8e02f321c3ca11226bf0641926775d936219bfba7dfe2fa2722f7ed599d67641d2e56c501b9a1c5e2abda9a8d1f6e07e5dea321e1d114d7286b669a0bee12ff2
@@ -0,0 +1,41 @@
1
+ # .github/workflows/ci.yml
2
+
3
+ name: Test
4
+ on:
5
+ push:
6
+ branches:
7
+ - main
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v1
20
+ - name: Setup Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true
25
+ - name: Uninstall existing Bundler
26
+ run: |
27
+ gem uninstall bundler -a -x || true
28
+ - name: Install Bundler
29
+ run: |
30
+ if [[ "${{ matrix.ruby-version }}" == "2.5" ]]; then
31
+ gem install bundler -v "~> 2.3.27"
32
+ elif [[ "${{ matrix.ruby-version }}" == "2.6" || "${{ matrix.ruby-version }}" == "2.7" ]]; then
33
+ gem install bundler -v "~> 2.4.0"
34
+ fi
35
+ - name: Build and run tests
36
+ env:
37
+ COVERAGE: true
38
+ TERM: xterm
39
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40
+ run: |
41
+ bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ .byebug_history
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .ruby-version
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.bundle
21
+ *.so
22
+ *.o
23
+ *.a
24
+ mkmf.log
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # main ([unreleased](https://github.com/fastruby/rails_stats/compare/v1.0.2...main))
2
+
3
+ * [BUGFIX: Fix JSON output missing Code and Tests total count](https://github.com/fastruby/rails_stats/pull/40)
4
+ * Update README examples
5
+ * [FEATURE: Output number of tables created from schema.rb or structure.sql, add polymorphic models count](https://github.com/fastruby/rails_stats/pull/37)
6
+
7
+ # v2.0.1 ([commits](https://github.com/fastruby/rails_stats/compare/v2.0.0...v2.0.1))
8
+
9
+ * [BUGFIX: Remove conditional byebug](https://github.com/fastruby/rails_stats/pull/29)
10
+
11
+ # v2.0.0 ([commits](https://github.com/fastruby/rails_stats/compare/v1.0.2...v2.0.0))
12
+
13
+ * [FEATURE: Add basic coverage to RailsStats::CodeStatistics#to_s](https://github.com/fastruby/rails_stats/pull/10)
14
+ * [FEATURE: Enable simplecov and codecov](https://github.com/fastruby/rails_stats/pull/18)
15
+ * [BUGFIX: Add methods for calculating M/C and LOC/M](https://github.com/fastruby/rails_stats/pull/19)
16
+ * [FEATURE: Support JSON output](https://github.com/fastruby/rails_stats/pull/20)
17
+ * [FEATURE: Add dependency on bundler-stats and improve output](https://github.com/fastruby/rails_stats/pull/21)
18
+ * [FEATURE: Add files count to the console and JSON output](https://github.com/fastruby/rails_stats/pull/25)
19
+
20
+ # v1.0.2 / 2020-10-7 ([commits](https://github.com/fastruby/rails_stats/compare/v1.0.1...v1.0.2))
21
+
22
+ * [CHORE: Relax bundler dependency to make it easier to get started contributing](https://github.com/fastruby/rails_stats/pull/9)
23
+
24
+ # v1.0.1 / 2018-10-8
25
+
26
+ * [FEATURE: add more aggregate stats](https://github.com/fastruby/rails_stats/pull/5)
27
+ * [FEATURE: More detailed introspection of app](https://github.com/fastruby/rails_stats/pull/1)
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at oss@ombulabs.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem "bundler", ">= 1.6", "< 3.0"
7
+ gem "byebug"
8
+ gem "codecov", "~> 0.6.0"
9
+ gem "minitest"
10
+ gem "minitest-around"
11
+ gem "minitest-spec-context"
12
+ gem "simplecov", "~> 0.21"
13
+ gem "simplecov-console"
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # RailsStats
2
+
3
+ See stuff about a Rails app.
4
+
5
+ There were a few things missing to the included `rake stats`
6
+
7
+ RailsStats mainly adds the ability to be run from outside the project in question. This can be helpful if the app you are interested in can not be booted for some reason.
8
+
9
+ ### Run it outside Rails project
10
+
11
+ You will need a `Rakefile` in the directory where you call `rake` and you will
12
+ need to require `rails_stats`:
13
+
14
+ ```ruby
15
+ # Rakefile
16
+ require "rails_stats"
17
+ ```
18
+
19
+ Then you can call it:
20
+
21
+ ```bash
22
+ $ rake stats\[/path/to/app/\]
23
+
24
+ Directory: /path/to/app/
25
+
26
+ +-----------------------|------------|----------------+
27
+ | Name | Total Deps | 1st Level Deps |
28
+ +-----------------------|------------|----------------+
29
+ | simplecov-console | 7 | 3 |
30
+ | codecov | 5 | 2 |
31
+ | rails_stats | 4 | 2 |
32
+ | simplecov | 3 | 3 |
33
+ | minitest-around | 1 | 1 |
34
+ | bundler | 0 | 0 |
35
+ | byebug | 0 | 0 |
36
+ | minitest | 0 | 0 |
37
+ | minitest-spec-context | 0 | 0 |
38
+ +-----------------------|------------|----------------+
39
+
40
+ Declared Gems 9
41
+ Total Gems 18
42
+ Unpinned Versions 8
43
+ Github Refs 0
44
+
45
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
46
+ | Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
47
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
48
+ | Channels | 2 | 8 | 8 | 2 | 0 | 0 | 0 |
49
+ | Configuration | 19 | 417 | 111 | 1 | 0 | 0 | 0 |
50
+ | Controllers | 1 | 7 | 6 | 1 | 1 | 1 | 4 |
51
+ | Helpers | 1 | 3 | 3 | 0 | 0 | 0 | 0 |
52
+ | Javascripts | 3 | 27 | 7 | 0 | 0 | 0 | 0 |
53
+ | Jobs | 1 | 7 | 2 | 1 | 0 | 0 | 0 |
54
+ | Libraries | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
55
+ | Mailers | 1 | 4 | 4 | 1 | 0 | 0 | 0 |
56
+ | Model Tests | 2 | 5 | 4 | 2 | 0 | 0 | 0 |
57
+ | Models | 1 | 3 | 3 | 1 | 0 | 0 | 0 |
58
+ | Spec Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
59
+ | Test Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
60
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
61
+ | Code | 30 | 477 | 145 | 7 | 1 | 0 | 143 |
62
+ | Tests | 4 | 7 | 6 | 2 | 0 | 0 | 0 |
63
+ | Total | 34 | 484 | 151 | 9 | 1 | 0 | 149 |
64
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
65
+ Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 Files: 34
66
+ ```
67
+
68
+ ### Run it on many Rails engines
69
+
70
+ ```bash
71
+ $ for dir in /path/to/many/engines/*/; do bundle exec rake stats[$dir]; done
72
+ ```
73
+
74
+ ### Within your Rails project
75
+
76
+ You can also include it within your Rails application to _replace_ the default `rake stats` implementation.
77
+
78
+ Just add rails_stats to your Gemfile.
79
+ Depending on your setup, you might need to `require rails_stats` in your Rakefile.
80
+
81
+ Then you'll be able to just run:
82
+
83
+ ```bash
84
+ $ bundle exec rake stats
85
+ ```
86
+
87
+ ### Things it knows about
88
+
89
+ RailsStats adds more coverage than the default.
90
+
91
+ * Any concepts you've added within an `app` directory
92
+ * Configuration files
93
+ * Library files
94
+ * Gems that you've created and embedded in the project
95
+ * Engines and their code
96
+ * RSpec/Unit/Cucumber Tests
97
+
98
+ ### Example output
99
+
100
+ Here are some open source Rails projects and their output.
101
+
102
+ ```bash
103
+
104
+ $ bundle exec rake stats[/users/brian/examples/redmine/]
105
+
106
+ +-----------------------|------------|----------------+
107
+ | Name | Total Deps | 1st Level Deps |
108
+ +-----------------------|------------|----------------+
109
+ | rails | 62 | 13 |
110
+ | roadie-rails | 45 | 2 |
111
+ | actionpack-xml_parser | 41 | 2 |
112
+ | importmap-rails | 41 | 3 |
113
+ | propshaft | 41 | 4 |
114
+ | stimulus-rails | 41 | 1 |
115
+ | rubocop-rails | 28 | 5 |
116
+ | rubocop-performance | 15 | 3 |
117
+ | html-pipeline | 14 | 2 |
118
+ | rails-dom-testing | 14 | 3 |
119
+ | rubocop | 14 | 10 |
120
+ | bullet | 13 | 2 |
121
+ | capybara | 10 | 8 |
122
+ | debug | 10 | 2 |
123
+ | mail | 7 | 4 |
124
+ | selenium-webdriver | 5 | 5 |
125
+ | rails_stats | 4 | 2 |
126
+ | svg_sprite | 4 | 3 |
127
+ | bundle-audit | 3 | 1 |
128
+ | listen | 3 | 2 |
129
+ | net-imap | 3 | 2 |
130
+ | sanitize | 3 | 2 |
131
+ | simplecov | 3 | 3 |
132
+ | mini_magick | 2 | 2 |
133
+ | net-pop | 2 | 1 |
134
+ | net-smtp | 2 | 1 |
135
+ | rbpdf | 2 | 2 |
136
+ | rqrcode | 2 | 2 |
137
+ | addressable | 1 | 1 |
138
+ | i18n | 1 | 1 |
139
+ | mocha | 1 | 1 |
140
+ | nokogiri | 1 | 1 |
141
+ | puma | 1 | 1 |
142
+ | commonmarker | 0 | 0 |
143
+ | csv | 0 | 0 |
144
+ | ffi | 0 | 0 |
145
+ | marcel | 0 | 0 |
146
+ | mini_mime | 0 | 0 |
147
+ | net-ldap | 0 | 0 |
148
+ | rack | 0 | 0 |
149
+ | rotp | 0 | 0 |
150
+ | rouge | 0 | 0 |
151
+ | rubyzip | 0 | 0 |
152
+ | tzinfo-data | 0 | 0 |
153
+ | yard | 0 | 0 |
154
+ +-----------------------|------------|----------------+
155
+
156
+ Declared Gems 45
157
+ Total Gems 144
158
+ Unpinned Versions 19
159
+ Github Refs 0
160
+
161
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
162
+ | Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
163
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
164
+ | Configuration | 17 | 1090 | 666 | 7 | 14 | 2 | 45 |
165
+ | Controllers | 57 | 9042 | 6746 | 60 | 554 | 9 | 10 |
166
+ | Functional Tests | 65 | 35754 | 30234 | 65 | 2104 | 32 | 12 |
167
+ | Helper Tests | 27 | 5369 | 4090 | 28 | 302 | 10 | 11 |
168
+ | Helpers | 49 | 7068 | 5168 | 1 | 413 | 413 | 10 |
169
+ | Integration Tests | 98 | 10349 | 7237 | 104 | 297 | 2 | 22 |
170
+ | Javascripts | 117 | 6930 | 5362 | 0 | 446 | 0 | 10 |
171
+ | Job Tests | 2 | 142 | 94 | 2 | 2 | 1 | 45 |
172
+ | Jobs | 3 | 115 | 90 | 3 | 9 | 3 | 8 |
173
+ | Libraries | 134 | 18922 | 13178 | 128 | 1167 | 9 | 9 |
174
+ | Models | 88 | 20110 | 14528 | 110 | 1532 | 13 | 7 |
175
+ | Other Tests | 19 | 2339 | 1525 | 19 | 98 | 5 | 13 |
176
+ | Test Support | 16 | 1637 | 1229 | 20 | 142 | 7 | 6 |
177
+ | Unit Tests | 147 | 37173 | 28642 | 161 | 2778 | 17 | 8 |
178
+ | Validators | 1 | 29 | 10 | 1 | 1 | 1 | 8 |
179
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
180
+ | Code | 466 | 63306 | 45748 | 310 | 4136 | 13 | 9 |
181
+ | Tests | 374 | 92763 | 73051 | 399 | 5723 | 14 | 10 |
182
+ | Total | 840 | 156069 | 118799 | 709 | 9859 | 13 | 10 |
183
+ +----------------------+---------+---------+---------+---------+---------+-----+-------+
184
+ Code LOC: 45748 Test LOC: 73051 Code to Test Ratio: 1:1.6 Files: 840
185
+
186
+ ```
187
+
188
+ #### JSON Format
189
+
190
+ If you want to export the details using JSON, you can use this command:
191
+
192
+ ```
193
+ $ rake stats\[test/dummy,json\]
194
+
195
+ Directory: /Users/etagwerker/Projects/redmine
196
+
197
+ [{"summary":{"declared":45,"unpinned":19,"total":144,"github":0},"gems":[{"name":"rails","total_dependencies":62,"first_level_dependencies":13,"top_level_dependencies":{},"transitive_dependencies":["actioncable (= 7.2.2.1)","actionmailbox (= 7.2.2.1)","actionmailer (= 7.2.2.1)","actionpack (= 7.2.2.1)","actiontext (= 7.2.2.1)","actionview (= 7.2.2.1)","activejob (= 7.2.2.1)","activemodel (= 7.2.2.1)","activerecord (= 7.2.2.1)","activestorage (= 7.2.2.1)","activesupport (= 7.2.2.1)","bundler (>= 1.15.0)","railties (= 7.2.2.1)","nio4r (~> 2.0)","websocket-driver (>= 0.6.1)","zeitwerk (~> 2.6)","nokogiri (>= 1.8.5)","racc (>= 0)","rack (>= 2.2.4, < 3.2)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","websocket-extensions (>= 0.1.0)","mail (>= 2.8.0)","globalid (>= 0.3.6)","timeout (>= 0.4.0)","marcel (~> 1.0)","mini_mime (>= 0.1.1)","net-imap (>= 0)","net-pop (>= 0)","net-smtp (>= 0)","date (>= 0)","net-protocol (>= 0)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"roadie-rails","total_dependencies":45,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["railties (>= 5.1, < 8.1)","roadie (~> 5.0)","actionpack (= 7.2.2.1)","activesupport (= 7.2.2.1)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","zeitwerk (~> 2.6)","actionview (= 7.2.2.1)","nokogiri (>= 1.8.5)","racc (>= 0)","rack (>= 2.2.4, < 3.2)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)","css_parser (~> 1.4)","addressable (>= 0)","public_suffix (>= 2.0.2, < 7.0)"]},{"name":"actionpack-xml_parser","total_dependencies":41,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["actionpack (>= 5.0)","railties (>= 5.0)","actionview (= 7.2.2.1)","activesupport (= 7.2.2.1)","nokogiri (>= 1.8.5)","racc (>= 0)","rack (>= 2.2.4, < 3.2)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","zeitwerk (~> 2.6)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"importmap-rails","total_dependencies":41,"first_level_dependencies":3,"top_level_dependencies":{},"transitive_dependencies":["actionpack (>= 6.0.0)","activesupport (>= 6.0.0)","railties (>= 6.0.0)","actionview (= 7.2.2.1)","nokogiri (>= 1.8.5)","racc (>= 0)","rack (>= 2.2.4, < 3.2)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","zeitwerk (~> 2.6)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"propshaft","total_dependencies":41,"first_level_dependencies":4,"top_level_dependencies":{},"transitive_dependencies":["actionpack (>= 7.0.0)","activesupport (>= 7.0.0)","rack (>= 0)","railties (>= 7.0.0)","actionview (= 7.2.2.1)","nokogiri (>= 1.8.5)","racc (>= 0)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","zeitwerk (~> 2.6)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"stimulus-rails","total_dependencies":41,"first_level_dependencies":1,"top_level_dependencies":{},"transitive_dependencies":["railties (>= 6.0.0)","actionpack (= 7.2.2.1)","activesupport (= 7.2.2.1)","irb (~> 1.13)","rackup (>= 1.0.0)","rake (>= 12.2)","thor (~> 1.0, >= 1.2.2)","zeitwerk (~> 2.6)","actionview (= 7.2.2.1)","nokogiri (>= 1.8.5)","racc (>= 0)","rack (>= 2.2.4, < 3.2)","rack-session (>= 1.0.1)","rack-test (>= 0.6.3)","rails-dom-testing (~> 2.2)","rails-html-sanitizer (~> 1.6)","useragent (~> 0.16)","builder (~> 3.1)","erubi (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","loofah (~> 2.21)","crass (~> 1.0.2)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","reline (>= 0.4.2)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"rubocop-rails","total_dependencies":28,"first_level_dependencies":5,"top_level_dependencies":{},"transitive_dependencies":["activesupport (>= 4.2.0)","lint_roller (~> 1.1)","rack (>= 1.1)","rubocop (>= 1.75.0, < 2.0)","rubocop-ast (>= 1.38.0, < 2.0)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","json (~> 2.3)","language_server-protocol (~> 3.17.0.2)","parallel (~> 1.10)","parser (>= 3.3.0.2)","rainbow (>= 2.2.2, < 4.0)","regexp_parser (>= 2.9.3, < 3.0)","ruby-progressbar (~> 1.7)","unicode-display_width (>= 2.4.0, < 4.0)","ast (~> 2.4.1)","racc (>= 0)","prism (~> 1.4)","unicode-emoji (~> 4.0, >= 4.0.4)"]},{"name":"rubocop-performance","total_dependencies":15,"first_level_dependencies":3,"top_level_dependencies":{},"transitive_dependencies":["lint_roller (~> 1.1)","rubocop (>= 1.75.0, < 2.0)","rubocop-ast (>= 1.38.0, < 2.0)","json (~> 2.3)","language_server-protocol (~> 3.17.0.2)","parallel (~> 1.10)","parser (>= 3.3.0.2)","rainbow (>= 2.2.2, < 4.0)","regexp_parser (>= 2.9.3, < 3.0)","ruby-progressbar (~> 1.7)","unicode-display_width (>= 2.4.0, < 4.0)","ast (~> 2.4.1)","racc (>= 0)","prism (~> 1.4)","unicode-emoji (~> 4.0, >= 4.0.4)"]},{"name":"html-pipeline","total_dependencies":14,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["activesupport (>= 2)","nokogiri (>= 1.4)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","racc (~> 1.4)"]},{"name":"rails-dom-testing","total_dependencies":14,"first_level_dependencies":3,"top_level_dependencies":{"actioncable":"actioncable (7.2.2.1)","actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","actionpack":"actionpack (7.2.2.1)","actionpack-xml_parser":"actionpack-xml_parser (2.0.1)","actiontext":"actiontext (7.2.2.1)","actionview":"actionview (7.2.2.1)","activestorage":"activestorage (7.2.2.1)","importmap-rails":"importmap-rails (2.1.0)","propshaft":"propshaft (1.1.0)","rails":"rails (7.2.2.1)","railties":"railties (7.2.2.1)","roadie-rails":"roadie-rails (3.3.0)","stimulus-rails":"stimulus-rails (1.3.4)"},"transitive_dependencies":["activesupport (>= 5.0.0)","minitest (>= 0)","nokogiri (>= 1.6)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)","racc (~> 1.4)"]},{"name":"rubocop","total_dependencies":14,"first_level_dependencies":10,"top_level_dependencies":{"rubocop-performance":"rubocop-performance (1.25.0)","rubocop-rails":"rubocop-rails (2.31.0)"},"transitive_dependencies":["json (~> 2.3)","language_server-protocol (~> 3.17.0.2)","lint_roller (~> 1.1.0)","parallel (~> 1.10)","parser (>= 3.3.0.2)","rainbow (>= 2.2.2, < 4.0)","regexp_parser (>= 2.9.3, < 3.0)","rubocop-ast (>= 1.44.0, < 2.0)","ruby-progressbar (~> 1.7)","unicode-display_width (>= 2.4.0, < 4.0)","ast (~> 2.4.1)","racc (>= 0)","prism (~> 1.4)","unicode-emoji (~> 4.0, >= 4.0.4)"]},{"name":"bullet","total_dependencies":13,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["activesupport (>= 3.0.0)","uniform_notifier (~> 1.11)","base64 (>= 0)","benchmark (>= 0.3)","bigdecimal (>= 0)","concurrent-ruby (~> 1.0, >= 1.3.1)","connection_pool (>= 2.2.5)","drb (>= 0)","i18n (>= 1.6, < 2)","logger (>= 1.4.2)","minitest (>= 5.1)","securerandom (>= 0.3)","tzinfo (~> 2.0, >= 2.0.5)"]},{"name":"capybara","total_dependencies":10,"first_level_dependencies":8,"top_level_dependencies":{},"transitive_dependencies":["addressable (>= 0)","matrix (>= 0)","mini_mime (>= 0.1.3)","nokogiri (~> 1.11)","rack (>= 1.6.0)","rack-test (>= 0.6.3)","regexp_parser (>= 1.5, < 3.0)","xpath (~> 3.2)","public_suffix (>= 2.0.2, < 7.0)","racc (~> 1.4)"]},{"name":"debug","total_dependencies":10,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["irb (~> 1.10)","reline (>= 0.3.8)","pp (>= 0.6.0)","rdoc (>= 4.0.0)","prettyprint (>= 0)","erb (>= 0)","psych (>= 4.0.0)","date (>= 0)","stringio (>= 0)","io-console (~> 0.5)"]},{"name":"mail","total_dependencies":7,"first_level_dependencies":4,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":["mini_mime (>= 0.1.1)","net-imap (>= 0)","net-pop (>= 0)","net-smtp (>= 0)","date (>= 0)","net-protocol (>= 0)","timeout (>= 0)"]},{"name":"selenium-webdriver","total_dependencies":5,"first_level_dependencies":5,"top_level_dependencies":{},"transitive_dependencies":["base64 (~> 0.2)","logger (~> 1.4)","rexml (~> 3.2, >= 3.2.5)","rubyzip (>= 1.2.2, < 3.0)","websocket (~> 1.0)"]},{"name":"rails_stats","total_dependencies":4,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["bundler-stats (>= 2.1)","rake (>= 0)","bundler (>= 1.9, < 3)","thor (>= 0.19.0, < 2.0)"]},{"name":"svg_sprite","total_dependencies":4,"first_level_dependencies":3,"top_level_dependencies":{},"transitive_dependencies":["nokogiri (>= 0)","svg_optimizer (>= 0)","thor (>= 0)","racc (~> 1.4)"]},{"name":"bundle-audit","total_dependencies":3,"first_level_dependencies":1,"top_level_dependencies":{},"transitive_dependencies":["bundler-audit (>= 0)","bundler (>= 1.2.0, < 3)","thor (~> 1.0)"]},{"name":"listen","total_dependencies":3,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["rb-fsevent (~> 0.10, >= 0.10.3)","rb-inotify (~> 0.9, >= 0.9.10)","ffi (~> 1.0)"]},{"name":"net-imap","total_dependencies":3,"first_level_dependencies":2,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","mail":"mail (2.8.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":["date (>= 0)","net-protocol (>= 0)","timeout (>= 0)"]},{"name":"sanitize","total_dependencies":3,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["crass (~> 1.0.2)","nokogiri (>= 1.12.0)","racc (~> 1.4)"]},{"name":"simplecov","total_dependencies":3,"first_level_dependencies":3,"top_level_dependencies":{},"transitive_dependencies":["docile (~> 1.1)","simplecov-html (~> 0.11)","simplecov_json_formatter (~> 0.1)"]},{"name":"mini_magick","total_dependencies":2,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["benchmark (>= 0)","logger (>= 0)"]},{"name":"net-pop","total_dependencies":2,"first_level_dependencies":1,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","mail":"mail (2.8.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":["net-protocol (>= 0)","timeout (>= 0)"]},{"name":"net-smtp","total_dependencies":2,"first_level_dependencies":1,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","mail":"mail (2.8.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":["net-protocol (>= 0)","timeout (>= 0)"]},{"name":"rbpdf","total_dependencies":2,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["htmlentities (>= 0)","rbpdf-font (~> 1.19.0)"]},{"name":"rqrcode","total_dependencies":2,"first_level_dependencies":2,"top_level_dependencies":{},"transitive_dependencies":["chunky_png (~> 1.0)","rqrcode_core (~> 2.0)"]},{"name":"addressable","total_dependencies":1,"first_level_dependencies":1,"top_level_dependencies":{"capybara":"capybara (3.40.0)","css_parser":"css_parser (1.21.1)","roadie":"roadie (5.2.1)","roadie-rails":"roadie-rails (3.3.0)"},"transitive_dependencies":["public_suffix (>= 2.0.2, < 7.0)"]},{"name":"i18n","total_dependencies":1,"first_level_dependencies":1,"top_level_dependencies":{"actioncable":"actioncable (7.2.2.1)","actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","actionpack":"actionpack (7.2.2.1)","actionpack-xml_parser":"actionpack-xml_parser (2.0.1)","actiontext":"actiontext (7.2.2.1)","actionview":"actionview (7.2.2.1)","activejob":"activejob (7.2.2.1)","activemodel":"activemodel (7.2.2.1)","activerecord":"activerecord (7.2.2.1)","activestorage":"activestorage (7.2.2.1)","activesupport":"activesupport (7.2.2.1)","bullet":"bullet (8.0.7)","globalid":"globalid (1.2.1)","html-pipeline":"html-pipeline (2.13.2)","importmap-rails":"importmap-rails (2.1.0)","propshaft":"propshaft (1.1.0)","rails":"rails (7.2.2.1)","rails-dom-testing":"rails-dom-testing (2.2.0)","railties":"railties (7.2.2.1)","roadie-rails":"roadie-rails (3.3.0)","rubocop-rails":"rubocop-rails (2.31.0)","stimulus-rails":"stimulus-rails (1.3.4)"},"transitive_dependencies":["concurrent-ruby (~> 1.0)"]},{"name":"mocha","total_dependencies":1,"first_level_dependencies":1,"top_level_dependencies":{},"transitive_dependencies":["ruby2_keywords (>= 0.0.5)"]},{"name":"nokogiri","total_dependencies":1,"first_level_dependencies":1,"top_level_dependencies":{"actioncable":"actioncable (7.2.2.1)","actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","actionpack":"actionpack (7.2.2.1)","actionpack-xml_parser":"actionpack-xml_parser (2.0.1)","actiontext":"actiontext (7.2.2.1)","actionview":"actionview (7.2.2.1)","activestorage":"activestorage (7.2.2.1)","capybara":"capybara (3.40.0)","html-pipeline":"html-pipeline (2.13.2)","importmap-rails":"importmap-rails (2.1.0)","loofah":"loofah (2.24.1)","propshaft":"propshaft (1.1.0)","rails":"rails (7.2.2.1)","rails-dom-testing":"rails-dom-testing (2.2.0)","rails-html-sanitizer":"rails-html-sanitizer (1.6.2)","railties":"railties (7.2.2.1)","roadie":"roadie (5.2.1)","roadie-rails":"roadie-rails (3.3.0)","sanitize":"sanitize (6.1.3)","stimulus-rails":"stimulus-rails (1.3.4)","svg_optimizer":"svg_optimizer (0.3.0)","svg_sprite":"svg_sprite (1.0.3)","xpath":"xpath (3.2.0)"},"transitive_dependencies":["racc (~> 1.4)"]},{"name":"puma","total_dependencies":1,"first_level_dependencies":1,"top_level_dependencies":{},"transitive_dependencies":["nio4r (~> 2.0)"]},{"name":"commonmarker","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"csv","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"ffi","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{"listen":"listen (3.9.0)","rb-inotify":"rb-inotify (0.11.1)"},"transitive_dependencies":[]},{"name":"marcel","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actiontext":"actiontext (7.2.2.1)","activestorage":"activestorage (7.2.2.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":[]},{"name":"mini_mime","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{"actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","capybara":"capybara (3.40.0)","mail":"mail (2.8.1)","rails":"rails (7.2.2.1)"},"transitive_dependencies":[]},{"name":"net-ldap","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"rack","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{"actioncable":"actioncable (7.2.2.1)","actionmailbox":"actionmailbox (7.2.2.1)","actionmailer":"actionmailer (7.2.2.1)","actionpack":"actionpack (7.2.2.1)","actionpack-xml_parser":"actionpack-xml_parser (2.0.1)","actiontext":"actiontext (7.2.2.1)","activestorage":"activestorage (7.2.2.1)","capybara":"capybara (3.40.0)","importmap-rails":"importmap-rails (2.1.0)","propshaft":"propshaft (1.1.0)","rack-session":"rack-session (2.1.1)","rack-test":"rack-test (2.2.0)","rackup":"rackup (2.2.1)","rails":"rails (7.2.2.1)","railties":"railties (7.2.2.1)","roadie-rails":"roadie-rails (3.3.0)","rubocop-rails":"rubocop-rails (2.31.0)","stimulus-rails":"stimulus-rails (1.3.4)"},"transitive_dependencies":[]},{"name":"rotp","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"rouge","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"rubyzip","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{"selenium-webdriver":"selenium-webdriver (4.32.0)"},"transitive_dependencies":[]},{"name":"tzinfo-data","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]},{"name":"yard","total_dependencies":0,"first_level_dependencies":0,"top_level_dependencies":{},"transitive_dependencies":[]}]},{"name":"Models","files":"88","lines":"20110","loc":"14528","classes":"110","methods":"1532","m_over_c":"13","loc_over_m":"7"},{"name":"Validators","files":"1","lines":"29","loc":"10","classes":"1","methods":"1","m_over_c":"1","loc_over_m":"8"},{"name":"Javascripts","files":"117","lines":"6930","loc":"5362","classes":"0","methods":"446","m_over_c":"0","loc_over_m":"10"},{"name":"Jobs","files":"3","lines":"115","loc":"90","classes":"3","methods":"9","m_over_c":"3","loc_over_m":"8"},{"name":"Controllers","files":"57","lines":"9042","loc":"6746","classes":"60","methods":"554","m_over_c":"9","loc_over_m":"10"},{"name":"Helpers","files":"49","lines":"7068","loc":"5168","classes":"1","methods":"413","m_over_c":"413","loc_over_m":"10"},{"name":"Libraries","files":"134","lines":"18922","loc":"13178","classes":"128","methods":"1167","m_over_c":"9","loc_over_m":"9"},{"name":"Configuration","files":"17","lines":"1090","loc":"666","classes":"7","methods":"14","m_over_c":"2","loc_over_m":"45"},{"name":"Integration Tests","files":"98","lines":"10349","loc":"7237","classes":"104","methods":"297","m_over_c":"2","loc_over_m":"22"},{"name":"Test Support","files":"16","lines":"1637","loc":"1229","classes":"20","methods":"142","m_over_c":"7","loc_over_m":"6"},{"name":"Other Tests","files":"19","lines":"2339","loc":"1525","classes":"19","methods":"98","m_over_c":"5","loc_over_m":"13"},{"name":"Functional Tests","files":"65","lines":"35754","loc":"30234","classes":"65","methods":"2104","m_over_c":"32","loc_over_m":"12"},{"name":"Helper Tests","files":"27","lines":"5369","loc":"4090","classes":"28","methods":"302","m_over_c":"10","loc_over_m":"11"},{"name":"Unit Tests","files":"147","lines":"37173","loc":"28642","classes":"161","methods":"2778","m_over_c":"17","loc_over_m":"8"},{"name":"Job Tests","files":"2","lines":"142","loc":"94","classes":"2","methods":"2","m_over_c":"1","loc_over_m":"45"},{"name":"Code","files":"466","lines":"63306","loc":"45748","classes":"310","methods":"4136","m_over_c":"13","loc_over_m":"9","code_to_test_ratio":"1.6","total":true},{"name":"Tests","files":"374","lines":"92763","loc":"73051","classes":"399","methods":"5723","m_over_c":"14","loc_over_m":"10","code_to_test_ratio":"1.6","total":true},{"name":"Total","files":"840","lines":"156069","loc":"118799","classes":"709","methods":"9859","m_over_c":"13","loc_over_m":"10","code_to_test_ratio":"1.6","total":true}]
198
+ ```
199
+
200
+ ### Testing
201
+
202
+ In order to run the tests for this gem:
203
+
204
+ ```bash
205
+ bundle exec rake test
206
+
207
+ # Running:
208
+
209
+ ..
210
+
211
+ Fabulous run in 0.097903s, 20.4284 runs/s, 142.9987 assertions/s.
212
+
213
+ 2 runs, 14 assertions, 0 failures, 0 errors, 0 skips
214
+ ```
215
+
216
+ ### TODO
217
+
218
+ * Option to print out by app directory (stats per engine)
219
+ * Add views (jbuilder, erb, haml) but don't count towards ratios
220
+ * Support JS for projects that have it in public (but not compiled)
221
+ * Add CSS but don't count towards ratios
222
+ * Output other metrics like number of tables and columns
223
+ * Different output formatters
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "rails_stats"
6
+
7
+ Rake::TestTask.new do |task|
8
+ task.libs.push "lib"
9
+ task.libs.push "test"
10
+ task.pattern = "test/**/*_test.rb"
11
+ end
12
+
13
+ task default: %i[test]
data/codecov.yml ADDED
@@ -0,0 +1,2 @@
1
+ codecov:
2
+ token: d7028c0e-97c5-485f-85e5-f63daabeef63
@@ -0,0 +1,14 @@
1
+ require 'rails_stats/stats_calculator'
2
+ require 'rails_stats/stats_formatter'
3
+ require 'rails_stats/json_formatter'
4
+ require 'rails_stats/console_formatter'
5
+ require 'rails_stats/inflector'
6
+ require 'rails_stats/code_statistics_calculator'
7
+ require 'rails_stats/util'
8
+ require 'rails_stats/app_statistics'
9
+ require 'rails_stats/test_statistics'
10
+ require 'rails_stats/spec_statistics'
11
+ require 'rails_stats/cucumber_statistics'
12
+ require 'rails_stats/root_statistics'
13
+ require 'rails_stats/gem_statistics'
14
+ require 'rails_stats/code_statistics'
@@ -0,0 +1,62 @@
1
+ module RailsStats
2
+ class AppStatistics
3
+ attr_reader :statistics, :total, :test
4
+
5
+ def initialize(directory)
6
+ @directories = []
7
+ @test = false
8
+ @directory = directory
9
+ @statistics = calculate_statistics
10
+ @total = calculate_total
11
+ end
12
+
13
+ def key_concepts
14
+ directories.collect{ |path| File.basename(path) }
15
+ end
16
+
17
+ private
18
+
19
+ def calculate_total
20
+ out = CodeStatisticsCalculator.new
21
+ @statistics.each do |key, stats|
22
+ out.add(stats)
23
+ end
24
+ out
25
+ end
26
+
27
+ def calculate_statistics
28
+ Util.calculate_statistics(directories)
29
+ end
30
+
31
+ def directories
32
+ return @directories if @directories.any?
33
+
34
+ Dir.foreach(@directory) do |file_name|
35
+ path = File.join(@directory, file_name)
36
+ next unless File.directory?(path)
37
+ next if (/^\./ =~ file_name)
38
+ next if file_name == "assets" # doing separately
39
+ next if file_name == "views" # TODO
40
+ @directories << path
41
+ end
42
+
43
+ assets = File.join(@directory, "assets")
44
+ if File.directory?(assets)
45
+ Dir.foreach(assets) do |file_name|
46
+ path = File.join(assets, file_name)
47
+ next unless File.directory?(path)
48
+ next if (/^\./ =~ file_name)
49
+
50
+ case file_name
51
+ when "javascripts"
52
+ @directories << path
53
+ # TODO when "css"
54
+ end
55
+ end
56
+ end
57
+
58
+ @directories
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,24 @@
1
+ # railties/lib/rails/code_statistics.rb
2
+
3
+ module RailsStats
4
+ class CodeStatistics
5
+ def initialize(root_directory, opts = {})
6
+ @calculator = RailsStats::StatsCalculator.new(root_directory)
7
+ @formatter = load_formatter(opts)
8
+ end
9
+
10
+ def to_s
11
+ @formatter.to_s
12
+ end
13
+
14
+ private
15
+
16
+ def load_formatter(opts = {})
17
+ if opts[:format] == "json"
18
+ RailsStats::JSONFormatter.new(@calculator, opts)
19
+ else
20
+ RailsStats::ConsoleFormatter.new(@calculator, opts)
21
+ end
22
+ end
23
+ end
24
+ end