rubycritic-simplecov 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +290 -0
  3. data/CONTRIBUTING.md +93 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +259 -0
  7. data/ROADMAP.md +56 -0
  8. data/Rakefile +28 -0
  9. data/bin/rubycritic +10 -0
  10. data/lib/rubycritic/analysers/attributes.rb +29 -0
  11. data/lib/rubycritic/analysers/churn.rb +30 -0
  12. data/lib/rubycritic/analysers/complexity.rb +30 -0
  13. data/lib/rubycritic/analysers/coverage.rb +118 -0
  14. data/lib/rubycritic/analysers/helpers/ast_node.rb +76 -0
  15. data/lib/rubycritic/analysers/helpers/flay.rb +13 -0
  16. data/lib/rubycritic/analysers/helpers/flog.rb +17 -0
  17. data/lib/rubycritic/analysers/helpers/methods_counter.rb +25 -0
  18. data/lib/rubycritic/analysers/helpers/modules_locator.rb +42 -0
  19. data/lib/rubycritic/analysers/helpers/parser.rb +14 -0
  20. data/lib/rubycritic/analysers/helpers/reek.rb +11 -0
  21. data/lib/rubycritic/analysers/smells/flay.rb +79 -0
  22. data/lib/rubycritic/analysers/smells/flog.rb +69 -0
  23. data/lib/rubycritic/analysers/smells/reek.rb +53 -0
  24. data/lib/rubycritic/analysers_runner.rb +41 -0
  25. data/lib/rubycritic/analysis_summary.rb +40 -0
  26. data/lib/rubycritic/browser.rb +19 -0
  27. data/lib/rubycritic/cli/application.rb +34 -0
  28. data/lib/rubycritic/cli/options/argv.rb +137 -0
  29. data/lib/rubycritic/cli/options/file.rb +100 -0
  30. data/lib/rubycritic/cli/options.rb +33 -0
  31. data/lib/rubycritic/colorize.rb +17 -0
  32. data/lib/rubycritic/command_factory.rb +25 -0
  33. data/lib/rubycritic/commands/base.rb +18 -0
  34. data/lib/rubycritic/commands/ci.rb +14 -0
  35. data/lib/rubycritic/commands/compare.rb +106 -0
  36. data/lib/rubycritic/commands/default.rb +38 -0
  37. data/lib/rubycritic/commands/help.rb +18 -0
  38. data/lib/rubycritic/commands/status_reporter.rb +45 -0
  39. data/lib/rubycritic/commands/utils/build_number_file.rb +37 -0
  40. data/lib/rubycritic/commands/version.rb +16 -0
  41. data/lib/rubycritic/configuration.rb +69 -0
  42. data/lib/rubycritic/core/analysed_module.rb +93 -0
  43. data/lib/rubycritic/core/analysed_modules_collection.rb +95 -0
  44. data/lib/rubycritic/core/location.rb +47 -0
  45. data/lib/rubycritic/core/rating.rb +30 -0
  46. data/lib/rubycritic/core/smell.rb +84 -0
  47. data/lib/rubycritic/generators/console_report.rb +20 -0
  48. data/lib/rubycritic/generators/html/assets/fonts/FontAwesome.otf +0 -0
  49. data/lib/rubycritic/generators/html/assets/fonts/Roboto-Medium.ttf +0 -0
  50. data/lib/rubycritic/generators/html/assets/fonts/Roboto-Regular.ttf +0 -0
  51. data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.eot +0 -0
  52. data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.svg +2671 -0
  53. data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.ttf +0 -0
  54. data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff +0 -0
  55. data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff2 +0 -0
  56. data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  57. data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  58. data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  59. data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  60. data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  61. data/lib/rubycritic/generators/html/assets/images/logo.png +0 -0
  62. data/lib/rubycritic/generators/html/assets/javascripts/application.js +281 -0
  63. data/lib/rubycritic/generators/html/assets/javascripts/bootstrap.min.js +7 -0
  64. data/lib/rubycritic/generators/html/assets/javascripts/highcharts.src-4.0.1.js +17672 -0
  65. data/lib/rubycritic/generators/html/assets/javascripts/jquery.filtertable.min.js +13 -0
  66. data/lib/rubycritic/generators/html/assets/javascripts/jquery.min.js +4 -0
  67. data/lib/rubycritic/generators/html/assets/javascripts/jquery.scrollTo.min.js +7 -0
  68. data/lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.js +1031 -0
  69. data/lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.min.js +4 -0
  70. data/lib/rubycritic/generators/html/assets/javascripts/jquery.timeago.js +231 -0
  71. data/lib/rubycritic/generators/html/assets/javascripts/prettify.js +46 -0
  72. data/lib/rubycritic/generators/html/assets/stylesheets/application.css +570 -0
  73. data/lib/rubycritic/generators/html/assets/stylesheets/bootstrap.min.css +6 -0
  74. data/lib/rubycritic/generators/html/assets/stylesheets/font-awesome.min.css +4 -0
  75. data/lib/rubycritic/generators/html/assets/stylesheets/prettify.css +1 -0
  76. data/lib/rubycritic/generators/html/assets/stylesheets/prettify.custom_theme.css +69 -0
  77. data/lib/rubycritic/generators/html/base.rb +54 -0
  78. data/lib/rubycritic/generators/html/code_file.rb +51 -0
  79. data/lib/rubycritic/generators/html/code_index.rb +33 -0
  80. data/lib/rubycritic/generators/html/line.rb +37 -0
  81. data/lib/rubycritic/generators/html/overview.rb +38 -0
  82. data/lib/rubycritic/generators/html/simple_cov_index.rb +44 -0
  83. data/lib/rubycritic/generators/html/smells_index.rb +45 -0
  84. data/lib/rubycritic/generators/html/templates/code_file.html.erb +61 -0
  85. data/lib/rubycritic/generators/html/templates/code_index.html.erb +55 -0
  86. data/lib/rubycritic/generators/html/templates/layouts/application.html.erb +66 -0
  87. data/lib/rubycritic/generators/html/templates/line.html.erb +1 -0
  88. data/lib/rubycritic/generators/html/templates/overview.html.erb +68 -0
  89. data/lib/rubycritic/generators/html/templates/simple_cov_index.html.erb +44 -0
  90. data/lib/rubycritic/generators/html/templates/smells_index.html.erb +47 -0
  91. data/lib/rubycritic/generators/html/templates/smelly_line.html.erb +23 -0
  92. data/lib/rubycritic/generators/html/turbulence.rb +17 -0
  93. data/lib/rubycritic/generators/html/view_helpers.rb +58 -0
  94. data/lib/rubycritic/generators/html_report.rb +77 -0
  95. data/lib/rubycritic/generators/json/simple.rb +43 -0
  96. data/lib/rubycritic/generators/json_report.rb +26 -0
  97. data/lib/rubycritic/generators/lint_report.rb +30 -0
  98. data/lib/rubycritic/generators/text/lint.rb +41 -0
  99. data/lib/rubycritic/generators/text/list.rb +45 -0
  100. data/lib/rubycritic/generators/text/templates/lint.erb +3 -0
  101. data/lib/rubycritic/generators/text/templates/list.erb +12 -0
  102. data/lib/rubycritic/rake_task.rb +71 -0
  103. data/lib/rubycritic/reporter.rb +39 -0
  104. data/lib/rubycritic/revision_comparator.rb +45 -0
  105. data/lib/rubycritic/serializer.rb +32 -0
  106. data/lib/rubycritic/smells_status_setter.rb +18 -0
  107. data/lib/rubycritic/source_control_systems/base.rb +41 -0
  108. data/lib/rubycritic/source_control_systems/double.rb +19 -0
  109. data/lib/rubycritic/source_control_systems/git.rb +95 -0
  110. data/lib/rubycritic/source_control_systems/mercurial.rb +29 -0
  111. data/lib/rubycritic/source_control_systems/perforce.rb +116 -0
  112. data/lib/rubycritic/source_locator.rb +52 -0
  113. data/lib/rubycritic/version.rb +5 -0
  114. data/lib/rubycritic.rb +6 -0
  115. metadata +528 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4adf242d4461e0d849cdf31a6d257e7171753cff1f9bc71cf2907ba6207ad5e9
4
+ data.tar.gz: 213321116c7a70f355bf59fdef92bca97bcfdb59adb36b9ed7046955edd568d3
5
+ SHA512:
6
+ metadata.gz: 2e1ee647b7f6df5bcbc9441477e38a9b0bd7b319e289e1ff53e9aea1a235adfeff193ad1ec00f587c4d7185e29493eeb6fda07c3f6aabe69a3a1b57ee249aa63
7
+ data.tar.gz: a2c02926b34d2dcd5aa6d9906dc8503cb66687b9b00a846a5afc6e8fe35940a17f4f9fe9b9852e984d2d6efb50a8ed46c2d6b0597163d9374530ddac109d8169
data/CHANGELOG.md ADDED
@@ -0,0 +1,290 @@
1
+ # master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.1.0...master)
2
+
3
+ * [FEATURE] Add Markdown linting to the Travis build by using the Rubygem `markdownlint` (by [@jbampton][])
4
+
5
+ # master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.0.2...v4.1.0)
6
+
7
+ * [BUGFIX] Assorted fixes in HTML report (by [@jbampton][])
8
+ * [BUGFIX] Fix duplicate HTML5 DOCTYPE (by [@jbampton][])
9
+ * [BUGFIX] Config options getting overwritten by nil argv options (by [@nathanbwright][])
10
+ * [CHANGE] Update Reek dependency to '~> 5.0', '< 6.0' (by [@leksster][])
11
+
12
+ # 4.0.2 / 2019-03-14 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.0.1...v4.0.2)
13
+
14
+ * [BUGFIX] Fix generating the default html report (by [@lightalloy][])
15
+
16
+ # 4.0.1 / 2019-03-12 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.0.0...v4.0.1)
17
+
18
+ * [FEATURE] Allow passing formatters from the outside (by [@marcgrimme][] and [@onumis][])
19
+ * [CHANGE] Fix aruba deprecation warning
20
+
21
+ # 4.0.0 / 2019-02-27 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.5.1...v4.0.0)
22
+
23
+ * [FEATURE] Allow generating reports in multiple formats in one run (by [@katafrakt])
24
+ * [FEATURE] Allow to accept a config file (by [@mfbmina])
25
+ * [CHANGE] Update `reek` to 5.3 (by [@taitran19][] and [@onumis][])
26
+ * [CHANGE] Update `parser` to 2.6.0 (by [@onumis][])
27
+ * [CHANGE] Update `tty-which` to 0.4.0 (by [@onumis][])
28
+ * [CHANGE] Drop support for ruby 2.1 and 2.2 (by [@onumis][])
29
+ * [CHANGE] Fix rubocop offenses (by [@AllanSiqueira][] and [@harman28][])
30
+
31
+ # 3.5.2 / 2018-09-27 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.5.1...v3.5.2)
32
+
33
+ * [BUGFIX] Use a better uncommitted changes detection for git (by [@onumis][])
34
+
35
+ # 3.5.1 / 2018-09-05 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.5.0...v3.5.1)
36
+
37
+ * [BUGFIX] Fix branches score comparison when threshold is 0 (by [@antoineLeclercq][])
38
+
39
+ # 3.5.0 / 2018-09-03 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.4.0...v3.5.0)
40
+
41
+ * [CHANGE] Add ability to compare only the modified files between two branches. Refactored option `--mode-ci`, added `--branch` and `--maximum-decrease` (by [@HemanthMudalaiah][])
42
+ * [CHANGE] Optimized all images (by [@SuperSandro2000][])
43
+ * [BUGFIX] Fixed opening report in chrome on windows (by [@SuperSandro2000][])
44
+ * [BUGFIX] Fixed churn on windows (by [@SuperSandro2000][])
45
+ * [BUGFIX] Fixed gem not installing under restricted windows environments (by [@onumis][])
46
+
47
+ # 3.4.0 / 2018-03-22 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.3.0...v3.4.0)
48
+
49
+ * [CHANGE] Update `rubocop` to 0.51.0 (by [@olleolleolle][])
50
+ * [CHANGE] Update `parser` to 2.5.0 (by [@joshrpowell][])
51
+ * [CHANGE] Update `rainbow` to 3.0 (by [@joshrpowell][])
52
+ * [CHANGE] Update `rubocop` to 0.53.0 (by [@joshrpowell][])
53
+ * [BUGFIX] Fix wrong label for churn in the code file template (by [@nbekirov][])
54
+
55
+ # 3.3.0 / 2017-10-10 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.2.3...v3.3.0)
56
+
57
+ * [FEATURE] Add lint format similar to Golint (by [@nightscape][])
58
+ * [CHANGE] Update `cucumber` to 3.0 (by [@onumis][])
59
+ * [CHANGE] Update `rake` to 12.0 (by [@onumis][])
60
+ * [CHANGE] Update `rubocop` to 0.50.0 (by [@onumis][])
61
+ * [CHANGE] Accepting floating point values from Flog (by [@onumis][])
62
+
63
+ # 3.2.3 / 2017-05-31 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.2.2...v3.2.3)
64
+
65
+ * [BUGFIX] Fix rendering of churn chart in large codebases. (by [@ochagata][])
66
+
67
+ # 3.2.2 / 2017-05-18 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.2.1...v3.2.2)
68
+
69
+ * [CHANGE] Relax dependency of parser gem (by [@yuku-t][])
70
+ * [BUGFIX] Only scroll Y axis when visiting page with anchor tag (by [@georgedrummond][])
71
+
72
+ # 3.2.1 / 2017-05-13 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.2.0...v3.2.1)
73
+
74
+ * [CHANGE] Update `rubocop` to 0.48.x from 0.47.1 (by [@koic][] and [@Onumis][])
75
+ * [BUGFIX] Nest ordered list so we don't render errors as line numbers (by [@georgedrummond][])
76
+
77
+ # 3.2.0 / 2017-03-24
78
+
79
+ * [CHANGE] Update `rubocop` to 0.47.1 from 0.42.0 (by [@jdickey][])
80
+ * [CHANGE] Update for Ruby 2.4.0 compatibility; update `parser` gem to 2.4.0 (by [@jdickey][])
81
+ * [CHANGE] Improve YARD documentation (by [@olleolleolle][] and [@tejasbubane][])
82
+
83
+ # 3.1.3 / 2016-12-19
84
+
85
+ * [BUGFIX] Fix crash with the usage of an unavailable color in "rainbow" gem (by [@thedrow][])
86
+
87
+ # 3.1.2 / 2016-12-17
88
+
89
+ * [BUGFIX] Fix errors when no source-control is found (by [@tejasbubane][])
90
+ * [BUGFIX] Fix lack of the GPA chart when used with rake/rails (by [@hoshinotsuyoshi][])
91
+ * [BUGFIX] Fix code navigation links in the new UI (by [@rohitcy][])
92
+
93
+ # 3.1.1 / 2016-12-02
94
+
95
+ * [FEATURE] Implement search and filter on code and smells view (by [@rohitcy][])
96
+ * [CHANGE] Use Ruby's File instead of `wc` system command (by [@tejasbubane][])
97
+ * [CHANGE] Add MRI 2.3.3 compatibility by updating `parser` to v2.3.3.1 (by [@josephpage][])
98
+ * [BUGFIX] Fix code navigation links in the new UI (by [@rohitcy][])
99
+ * [BUGFIX] Add missing method 'head_reference' for Perforce source control (by [@Rataah][])
100
+
101
+ # 3.1.0 / 2016-11-23
102
+
103
+ * [FEATURE] Support for Perforce source control system (by [@Rataah][])
104
+ * [CHANGE] New Web UI (by [@tejasbubane][])
105
+ * [CHANGE] Significant improvements to documentation (by [@olleolleolle][])
106
+ * [CHANGE] Typo / consistency updates to features and tests (by [@olleolleolle][])
107
+ * [CHANGE] Fix test warnings and upgrade 'parser' to '2.3.1.4' (by [@tejasbubane][])
108
+ * [BUGFIX] Increase the turboThreshold of Highcharts so that it renders nicely even with lots of data (by [@victormartins][])
109
+
110
+ # 3.0.0 / 2016-11-01
111
+
112
+ * [CHANGE] Set required ruby version to 2.1 (by [@Onumis][])
113
+ * [BUGFIX] Respect the .reek configuration file (by [@mereghost][])
114
+
115
+ # 2.9.4 / 2016-09-16
116
+
117
+ * [CHANGE] Update Reek, flog, flay (by [@bglusman][])
118
+
119
+ # 2.9.3 / 2016-08-17
120
+
121
+ * [FEATURE] Save json report to file (by [@NickTroy][])
122
+ * [CHANGE] Rename Rubycritic to RubyCritic (by [@troessner][])
123
+
124
+ # 2.9.2 / 2016-07-01
125
+
126
+ * [CHANGE] Upgrade rubocop to 0.41.1 (by [@nijikon][])
127
+ * [CHANGE] Upgrade flog to 4.4.0 (by [@nijikon][])
128
+ * [CHANGE] Upgrade flay to 2.8.0 (by [@nijikon][])
129
+ * [CHANGE] Upgrade Reek to 4.1.0 and Parser to 2.3.1.2 (by [@y-yagi][])
130
+
131
+ # 2.9.1 / 2016-05-16
132
+
133
+ * [CHANGE] Upgrade 'parser' to 2.3.1.0 (by [@y-yagi][])
134
+ * [CHANGE] Upgrade 'reek' to 4.0.2 (by [@onumis][])
135
+ * [CHANGE] Upgrade 'rubocop' to 0.40.0 (by [@onumis][])
136
+
137
+ # 2.9.0 / 2016-04-12
138
+
139
+ * [FEATURE] Add links to Flay and Flog code smells documentation (by [@ragesoss][])
140
+ * [FEATURE] Documentation updates (by [@troessner][])
141
+ * [CHANGE] Bump Rubocop to 0.39.0 (by [@nijikon][])
142
+ * [CHANGE] Bump Reek to 4.0.1 (by [@nijikon][])
143
+ * [CHANGE] Drop support for Ruby 2.0 (by [@nijikon][])
144
+
145
+ # 2.8.0 / 2016-02-29
146
+
147
+ * [FEATURE] Add link to Reek's code smells documentation (by [@danielmbarlow][])
148
+ * [FEATURE] Make RubyCritic usable as Rake Task (by [@troessner][])
149
+ * [CHANGE] Bump Rubocop to 0.37.2 (by [@nijikon][])
150
+ * [CHANGE] Bump Flay to 2.7.0 (by [@nijikon][])
151
+ * [CHANGE] Bump Reek to 3.11 (by [@nijikon][])
152
+ * [CHANGE] Add explicit runtime dependency on ruby_parser ('~> 3.8') (by [@Onumis][])
153
+
154
+ # 2.7.1 / 2016-02-09
155
+
156
+ * [CHANGE] Bump Reek to 3.10.1 (by [@nijikon][])
157
+ * [BUGFIX] Analyse only the files whose paths are specified in the CLI (by [@Onumis][])
158
+
159
+ # 2.7.0 / 2016-01-23
160
+
161
+ * [FEATURE] Open html report with browser (by [@superiorlu][])
162
+ * [CHANGE] Bump Reek to 3.9.1
163
+ * [CHANGE] Bump Rubocop to 0.36 and internal cleanup (preparing for Ruby 2.3)
164
+
165
+ # 2.6.0 / 2016-01-21
166
+
167
+ * [FEATURE] Add a minimum score option to the command line interface (by [@RobertoSchneiders][])
168
+ * [CHANGE] Display the class and module names when the file has no methods
169
+
170
+ # 2.5.0 / 2016-01-16
171
+
172
+ * [FEATURE] Add a ConsoleReport format (by [@jbodah][])
173
+
174
+ # 2.4.1 / 2015-12-27
175
+
176
+ * [CHANGE] Bump Reek to 3.8.1
177
+
178
+ # 2.4.0 / 2015-12-26
179
+
180
+ * [FEATURE] Add progress bar functionality (by [@natesholland][])
181
+
182
+ # 2.3.0 / 2015-11-30
183
+
184
+ * [FEATURE] Added global score calculation (by [@ancorgs][])
185
+ * [CHANGE] Bump Reek dependency to 3.7.1.
186
+
187
+ # 2.2.0 / 2015-11-20
188
+
189
+ * [CHANGE] Use `Reeks` default configuration loading.
190
+
191
+ # 2.1.0 / 2015-11-11
192
+
193
+ * [CHANGE] Bump flay dependency to 2.6.1.
194
+ * [CHANGE] Bump reek dependency to 3.6.0.
195
+ * [CHANGE] Bump flog dependency to 4.3.2.
196
+
197
+ # 2.0.0 / 2015-11-11
198
+
199
+ * [CHANGE] Drop support for ruby 1.9
200
+
201
+ # 1.4.0 / 2015-03-14
202
+
203
+ * [FEATURE] New report in JSON format. Available by using the new CLI option `-f`
204
+ * [FEATURE] New CLI option `--suppress-ratings` to suppress ratings (by [@halostatue][])
205
+ * [CHANGE] Improve UI, particularly the sortable tables (by [@crackofdusk][])
206
+
207
+ # 1.3.0 / 2015-02-16
208
+
209
+ * [FEATURE] New CLI option `--deduplicate-symlinks` to deduplicate symlinks (by [@LeeXGreen][])
210
+ * [CHANGE] Update to Reek 1.6.5 (from 1.6.3)
211
+ * [CHANGE] Remove ruby2ruby dependency
212
+
213
+ # 1.2.1 / 2015-01-17
214
+
215
+ * [FEATURE] Support Ruby 2.2
216
+ * [CHANGE] Update to Reek 1.6.3 (from 1.6.0)
217
+ * [CHANGE] Update to at least Parser 2.2.0 (from 2.2.0.pre.5)
218
+
219
+ # 1.2.0 / 2014-12-27
220
+
221
+ * [FEATURE] Add CI mode that only analyses the last commit
222
+ * [FEATURE] Add partial support for Mercurial
223
+ * [FEATURE] Allow using RubyCritic programatically
224
+ * [CHANGE] Update to Reek 1.6.0 (from 1.3.8)
225
+ * [BUGFIX] Fix issue #18 - Prevent encoding issues when using Git
226
+
227
+ # 1.1.1 / 2014-07-29
228
+
229
+ * [BUGFIX] Analyse only the files whose paths are specified in the CLI
230
+
231
+ # 1.1.0 / 2014-07-27
232
+
233
+ * [FEATURE] Display name of the first module found in a file instead of the file's name
234
+
235
+ # 1.0.2 / 2014-07-23
236
+
237
+ * [BUGFIX] Fix issue #8 - Solve a dependency error by requiring at least ruby2ruby 2.1.1
238
+
239
+ # 1.0.1 / 2014-07-22
240
+
241
+ * [BUGFIX] Fix issue #6 - Rescue `Parser::SyntaxError` when a file is unparsable
242
+
243
+ # 1.0.0 / 2014-07-13
244
+
245
+ * Official Release
246
+
247
+ [@LeeXGreen]: https://github.com/LeeXGreen
248
+ [@crackofdusk]: https://github.com/crackofdusk
249
+ [@halostatue]: https://github.com/halostatue
250
+ [@ancorgs]: https://github.com/ancorgs
251
+ [@natesholland]: https://github.com/natesholland
252
+ [@jbodah]: https://github.com/jbodah
253
+ [@RobertoSchneiders]: https://github.com/RobertoSchneiders
254
+ [@superiorlu]: https://github.com/superiorlu
255
+ [@Onumis]: https://github.com/Onumis
256
+ [@nijikon]: https://github.com/nijikon
257
+ [@troessner]: https://github.com/troessner
258
+ [@danielmbarlow]: https://github.com/danielmbarlow
259
+ [@ragesoss]: https://github.com/ragesoss
260
+ [@y-yagi]: https://github.com/y-yagi
261
+ [@NickTroy]: https://github.com/NickTroy
262
+ [@bglusman]: https://github.com/bglusman
263
+ [@mereghost]: https://github.com/mereghost
264
+ [@victormartins]: https://github.com/victormartins
265
+ [@tejasbubane]: https://github.com/tejasbubane
266
+ [@olleolleolle]: https://github.com/olleolleolle
267
+ [@Rataah]: https://github.com/Rataah
268
+ [@rohitcy]: https://github.com/rohitcy
269
+ [@josephpage]: https://github.com/josephpage
270
+ [@hoshinotsuyoshi]: https://github.com/hoshinotsuyoshi
271
+ [@thedrow]: https://github.com/thedrow
272
+ [@jdickey]: https://github.com/jdickey
273
+ [@koic]: https://github.com/koic
274
+ [@georgedrummond]: https://github.com/georgedrummond
275
+ [@yuku-t]: https://github.com/yuku-t
276
+ [@ochagata]: https://github.com/ochagata
277
+ [@nightscape]: https://github.com/nightscape
278
+ [@nbekirov]: https://github.com/nbekirov
279
+ [@joshrpowell]: https://github.com/joshrpowell
280
+ [@HemanthMudalaiah]: https://github.com/HemanthMudalaiah
281
+ [@SuperSandro2000]: https://github.com/SuperSandro2000
282
+ [@antoineLeclercq]: https://github.com/antoineLeclercq
283
+ [@mfbmina]: https://github.com/mfbmina
284
+ [@taitran19]: https://github.com/taitran19
285
+ [@AllanSiqueira]: https://github.com/AllanSiqueira
286
+ [@harman28]: https://github.com/harman28
287
+ [@lightalloy]: https://github.com/lightalloy
288
+ [@jbampton]: https://github.com/jbampton
289
+ [@nathanbwright]: https://github.com/nathanbwright
290
+ [@leksster]: https://github.com/leksster
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,93 @@
1
+ Contributing
2
+ ============
3
+
4
+ RubyCritic is open source and contributions from the community are encouraged! No contribution is too small. Please consider:
5
+
6
+ * [Writing some Code](#writing-some-code)
7
+ * [Improving the Documentation](#improving-the-documentation)
8
+ * [Reporting a Bug](#reporting-a-bug)
9
+
10
+ Writing some Code
11
+ -----------------
12
+
13
+ If you want to squash a bug or add a new feature, please:
14
+
15
+ 1. Fork the project.
16
+
17
+ 2. Create a feature branch (`git checkout -b my-new-feature`).
18
+
19
+ 3. Make your changes. Include tests for your changes, otherwise I may accidentally break them in the future.
20
+
21
+ 4. Run the tests with the `rake` command. Make sure that they are still passing.
22
+
23
+ 5. Add a Changelog entry. Refer [Changelog entry format](#changelog-entry-format).
24
+
25
+ 6. [Stage partial-file changesets] \(`git add -p`).
26
+
27
+ 7. Commit your changes (`git commit`).
28
+ Make exactly as many commits as you need.
29
+ Each commit should do one thing and one thing only. For example, all whitespace fixes should be relegated to a single commit.
30
+
31
+ 8. Write [descriptive commit messages].
32
+
33
+ 9. Push the branch to GitHub (`git push origin my-new-feature`).
34
+
35
+ 10. [Create a Pull Request] and send it to be merged with the master branch.
36
+
37
+ 11. After your code is reviewed, [hide the sausage making]. We follow the "one commit per pull request" [principle](http://ndlib.github.io/practices/one-commit-per-pull-request/) since this allows for a clean git history, easy handling of features and convenient rollbacks when things go wrong. Or in one sentence: You can have as many commits as you want in your pull request, but after the final review and before the merge you need to squash all of those in one single commit.
38
+ For a more in-depth look at interactive rebasing, be sure to check [how to rewrite history] as well.
39
+
40
+ Improving the Documentation
41
+ ---------------------------
42
+
43
+ You are welcome to clarify how something works or simply fix a typo. Please include `[ci skip]` on a new line in each of your commit messages. This will signal [Travis] that running the test suite is not necessary for these changes.
44
+
45
+ Reporting a Bug
46
+ ---------------
47
+
48
+ If you are experiencing unexpected behavior and, after having read the documentation, you are convinced this behavior is a bug, please:
49
+
50
+ 1. Search the [issues tracker] to see if it was already reported / fixed.
51
+
52
+ 2. [Create a new issue].
53
+
54
+ 3. Include the Ruby and RubyCritic versions in your report. Here's a little table to help you out:
55
+
56
+ ```
57
+ | | Version |
58
+ |------------|---------|
59
+ | Ruby | 2.1.2 |
60
+ | RubyCritic | 1.0.0 |
61
+ ```
62
+
63
+ The more information you provide, the easier it will be to track down the issue and fix it.
64
+ If you have never written a bug report before, or if you want to brush up on your bug reporting skills, read Simon Tatham's essay [How to Report Bugs Effectively].
65
+
66
+ [Stage partial-file changesets]: http://nuclearsquid.com/writings/git-add/
67
+ [descriptive commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
68
+ [Create a pull request]: https://help.github.com/articles/creating-a-pull-request
69
+ [hide the sausage making]: http://sethrobertson.github.io/GitBestPractices/#sausage
70
+ [how to rewrite history]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages
71
+ [Travis]: https://travis-ci.org
72
+ [issues tracker]: https://github.com/whitesmith/rubycritic/issues
73
+ [Create a new issue]: https://github.com/whitesmith/rubycritic/issues/new
74
+ [How to Report Bugs Effectively]: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
75
+
76
+ Changelog entry format
77
+ ------------------------
78
+
79
+ Here are a few examples:
80
+
81
+ ```
82
+ * [BUGFIX] Fix errors when no source-control is found (by [@tejasbubane][])
83
+ * [BUGFIX] Fix lack of the GPA chart when used with rake/rails (by [@hoshinotsuyoshi][])
84
+ * [BUGFIX] Fix code navigation links in the new UI (by [@rohitcy][])
85
+ ```
86
+
87
+ * Mark it up in [Markdown syntax](http://daringfireball.net/projects/markdown/syntax).
88
+ * Add your entry in the `master (unreleased)` section.
89
+ * The entry line should start with `* ` (an asterisk and a space).
90
+ * Start with the change type BUGFIX / CHANGE / FEATURE.
91
+ * Describe the brief of the change.
92
+ * At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
93
+ * If this is your first contribution to RuboCop project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in rubycritic.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Guilherme Simoes
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,259 @@
1
+ # RubyCritic
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rubycritic.svg)](http://badge.fury.io/rb/rubycritic)
4
+ [![Build Status](https://travis-ci.org/whitesmith/rubycritic.svg?branch=master)](https://travis-ci.org/whitesmith/rubycritic)
5
+ [![Code Climate](https://codeclimate.com/github/whitesmith/rubycritic/badges/gpa.svg)](https://codeclimate.com/github/whitesmith/rubycritic)
6
+
7
+ <img src="https://github.com/whitesmith/rubycritic/raw/master/images/logo.png" alt="RubyCritic Icon" align="right">
8
+
9
+ RubyCritic is a gem that wraps around static analysis gems such as [Reek][1], [Flay][2] and [Flog][3] to provide a quality report of your Ruby code.
10
+
11
+ ## Table of Contents
12
+
13
+ - [Overview](#overview)
14
+ - [Getting Started](#getting-started)
15
+ - [Usage](#usage)
16
+ + [Analyzer Configuration](#analyzer-configuration)
17
+ + [Alternative Usage Methods](#alternative-usage-methods)
18
+ + [Rake Task](#rake-task)
19
+ - [Compatibility](#compatibility)
20
+ - [Improving RubyCritic](#improving-rubyCritic)
21
+ - [Contributors](#contributors)
22
+ - [Credits](#credits)
23
+
24
+ ## Overview
25
+
26
+ This gem provides features such as:
27
+
28
+ 1. An overview of your project:
29
+
30
+ ![RubyCritic overview screenshot](https://github.com/whitesmith/rubycritic/raw/master/images/overview.png)
31
+
32
+ 2. An index of the project files with their respective number of smells:
33
+
34
+ ![RubyCritic code index screenshot](https://github.com/whitesmith/rubycritic/raw/master/images/code.png)
35
+
36
+ 3. An index of the smells detected:
37
+
38
+ ![RubyCritic smells index screenshot](https://github.com/whitesmith/rubycritic/raw/master/images/smells.png)
39
+
40
+ 4. When analysing code like the following:
41
+
42
+ ```ruby
43
+ class Dirty
44
+ def awful(x, y)
45
+ if y
46
+ @screen = widgets.map {|w| w.each {|key| key += 3}}
47
+ end
48
+ end
49
+ end
50
+ ```
51
+
52
+ It basically turns something like this:
53
+
54
+ ![Reek output screenshot](https://github.com/whitesmith/rubycritic/raw/master/images/reek.png)
55
+
56
+ Into something like this:
57
+
58
+ ![RubyCritic file code screenshot](https://github.com/whitesmith/rubycritic/raw/master/images/smell-details.png)
59
+
60
+ 5. It uses your source control system (only Git, Mercurial and Perforce
61
+ are currently supported) to compare your currently uncommitted
62
+ changes with your last commit.
63
+
64
+ **Warning**: If your code is not as you expect it to be after running
65
+ RubyCritic, please check your source control system stash.
66
+
67
+ Checkout the `/docs` if you want to read more about our [core metrics](https://github.com/whitesmith/rubycritic/blob/master/docs/core-metrics.md).
68
+
69
+ ## Getting Started
70
+
71
+ RubyCritic can be installed with the following command:
72
+
73
+ ```bash
74
+ $ gem install rubycritic
75
+ ```
76
+
77
+ If you'd rather install RubyCritic using Bundler, add this line to your
78
+ application's Gemfile:
79
+
80
+ ```ruby
81
+ gem "rubycritic", require: false
82
+ ```
83
+
84
+ And then execute:
85
+
86
+ ```bash
87
+ $ bundle
88
+ ```
89
+
90
+ ## Usage
91
+
92
+ Running `rubycritic` with no arguments will analyse all the Ruby files in the
93
+ current directory:
94
+
95
+ ```bash
96
+ $ rubycritic
97
+ ```
98
+
99
+ Alternatively you can pass `rubycritic` a list of files and directories to check:
100
+
101
+ ```bash
102
+ $ rubycritic app lib/foo.rb
103
+ ```
104
+
105
+ For a full list of the command-line options run:
106
+
107
+ ```bash
108
+ $ rubycritic --help
109
+ ```
110
+
111
+ | Command flag | Description |
112
+ |-------------------------------------|-----------------------------------------------------------------|
113
+ | `-v` / `--version` | Displays the current version and exits |
114
+ | `-p` / `--path` | Set path where report will be saved (tmp/rubycritic by default) |
115
+ | `-f` / `--format` | Report smells in the given format(s)<sup>1</sup> |
116
+ | `--custom-format path:classname` | Load and instantiate custom formatter(s)<sup>2</sup> |
117
+ | `-s` / `--minimum-score` | Set a minimum score (FLOAT: ex: 96.28), default: 0 |
118
+ | `-m` / `--mode-ci` | Use CI mode<sup>3</sup> |
119
+ | `-b` / `--branch` | Set branch to compare |
120
+ | `-t` / `--maximum-decrease` | Threshold for score difference between two branches<sup>4</sup> |
121
+ | `--deduplicate-symlinks` | De-duplicate symlinks based on their final target |
122
+ | `--suppress-ratings` | Suppress letter ratings |
123
+ | `--no-browser` | Do not open html report with browser |
124
+
125
+ 1. Available output formats:
126
+ - `html` (default; will open in a browser)
127
+ - `json`
128
+ - `console`
129
+ - `lint`
130
+ 2. See [custom formatters docs](/docs/formatters.md)
131
+ 3. Faster, analyses diffs w.r.t base_branch (default: master), see `-b`
132
+ 4. Works only with `-b`, default: 0
133
+
134
+ You also can use a config file. Just create a `.rubycritic.yml` on your project root path.
135
+
136
+ Here are one example:
137
+
138
+ ```yml
139
+ mode_ci:
140
+ enabled: true # default is false
141
+ branch: 'production' # default is master
142
+ branch: 'production' # default is master
143
+ path: '/tmp/mycustompath' # Set path where report will be saved (tmp/rubycritic by default)
144
+ threshold_score: 10 # default is 0
145
+ deduplicate_symlinks: true # default is false
146
+ suppress_ratings: true # default is false
147
+ no_browser: true # default is false
148
+ formats: # Available values are: html, json, console, lint. Default value is html.
149
+ - console
150
+ minimum_score: 95 # default is 0
151
+ paths: # Files to analyse.
152
+ - 'app/controllers/'
153
+ - 'app/models/'
154
+ ```
155
+
156
+ ### Analyzer Configuration
157
+
158
+ * [`Reek`](https://github.com/troessner/reek): `RubyCritic` utilizes `Reek`'s default [configuration loading mechanism](https://github.com/troessner/reek#configuration-file).
159
+ This means that if you have an existing `Reek` configuration file, you can just put this into your
160
+ project root and `RubyCritic` will respect this configuration.
161
+ * [`flay`](https://github.com/seattlerb/flay): We use `flay`'s default configuration.
162
+ * [`flog`](https://github.com/seattlerb/flog): We use `flog`'s default configuration with a couple of [smaller tweaks](https://github.com/whitesmith/rubycritic/blob/master/lib/rubycritic/analysers/helpers/flog.rb#L5):
163
+ * `all`: Forces `flog` to report scores on all classes and methods. Without this option `flog` will only give results up to a certain threshold.
164
+ * `continue`: Makes it so that `flog` does not abort when a ruby file cannot be parsed.
165
+ * `methods`: Configures `flog` to skip code outside of methods. It prevents `flog` from reporting on the "methods" `private` and `protected`. It also prevents `flog` from reporting on Rails methods like `before_action` and `has_many`.
166
+
167
+ ### Alternative Usage Methods
168
+
169
+ If you're fond of Guard you might like [guard-rubycritic][4]. It automatically analyses your Ruby files as they are modified.
170
+
171
+ For continuous integration, you can give [Jenkins CI][5] a spin. With it, you can [easily build your own (poor-man's) Code Climate][6]!
172
+
173
+ ### Rake Task
174
+
175
+ You can use RubyCritic as Rake command in its most simple form like this:
176
+
177
+ ```ruby
178
+ require "rubycritic/rake_task"
179
+
180
+ RubyCritic::RakeTask.new
181
+ ```
182
+
183
+ A more sophisticated Rake task that would make use of all available configuration options could look like this:
184
+
185
+ ```ruby
186
+ RubyCritic::RakeTask.new do |task|
187
+ # Name of RubyCritic task. Defaults to :rubycritic.
188
+ task.name = 'something_special'
189
+
190
+ # Glob pattern to match source files. Defaults to FileList['.'].
191
+ task.paths = FileList['vendor/**/*.rb']
192
+
193
+ # You can pass all the options here in that are shown by "rubycritic -h" except for
194
+ # "-p / --path" since that is set separately. Defaults to ''.
195
+ task.options = '--mode-ci --format json'
196
+
197
+ # Defaults to false
198
+ task.verbose = true
199
+ end
200
+ ```
201
+
202
+ RubyCritic will try to open the generated report with a browser by default. If you don't want this
203
+ you can prevent this behaviour by setting the options correspondingly:
204
+
205
+ ```ruby
206
+ RubyCritic::RakeTask.new do |task|
207
+ task.options = '--no-browser'
208
+ end
209
+ ```
210
+
211
+ ## Formatters
212
+
213
+ See [formatters](docs/formatters.md)
214
+
215
+ ## Compatibility
216
+
217
+ RubyCritic is supporting Ruby versions:
218
+
219
+ * 2.3
220
+ * 2.4
221
+ * 2.5
222
+ * 2.6
223
+
224
+ ## Improving RubyCritic
225
+
226
+ RubyCritic doesn't have to remain a second choice to other code quality analysis services. Together, we can improve it and continue to build on the great code metric tools that are available in the Ruby ecosystem.
227
+
228
+ Arguably, the [better_errors gem][7] only got popular after receiving a [(pretty awesome) Pull Request][8] that changed its page design.
229
+
230
+ Similarly, Pull Requests that improve the look and feel of the gem, that tweak the calculation of ratings or that fix existing issues will be most welcome. Just commenting on an issue and giving some insight into how something should work will be appreciated. No contribution is too small.
231
+
232
+ See RubyCritic's [contributing guidelines](https://github.com/whitesmith/rubycritic/blob/master/CONTRIBUTING.md) about how to proceed.
233
+
234
+ ## Contributors
235
+
236
+ `RubyCritics` initial author was [Guilherme Simões](https://github.com/guilhermesimoes).
237
+
238
+ The current core team consists of:
239
+
240
+ * [Nuno Silva](https://github.com/Onumis)
241
+ * [Lucas Mazza](https://github.com/lucasmazza)
242
+ * [Timo Rößner](https://github.com/troessner)
243
+
244
+ ## Credits
245
+
246
+ ![Whitesmith](https://github.com/whitesmith/rubycritic/raw/master/images/whitesmith.png)
247
+
248
+ RubyCritic is maintained and funded by [Whitesmith][9]. Tweet your questions or suggestions to [@Whitesmithco][10].
249
+
250
+ [1]: https://github.com/troessner/reek
251
+ [2]: https://github.com/seattlerb/flay
252
+ [3]: https://github.com/seattlerb/flog
253
+ [4]: https://github.com/whitesmith/guard-rubycritic
254
+ [5]: http://jenkins-ci.org/
255
+ [6]: https://github.com/whitesmith/rubycritic/blob/master/docs/building-own-code-climate.md
256
+ [7]: https://github.com/charliesome/better_errors
257
+ [8]: https://github.com/charliesome/better_errors/pull/22
258
+ [9]: http://www.whitesmith.co/
259
+ [10]: https://twitter.com/Whitesmithco