mercy 1.6.0 → 2.0.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/.circleci/config.yml +74 -12
- data/.claude/agents/architect.md +48 -0
- data/.claude/agents/infra.md +36 -0
- data/.claude/agents/ruby.md +45 -0
- data/.claude/configuration/arcanum-repo-config.json +3 -0
- data/.claude/scripts/check_infra.sh +6 -0
- data/.claude/scripts/check_ruby.sh +7 -0
- data/.claude/settings.json +10 -0
- data/.github/commit_message_template-2.0.md +32 -0
- data/.github/commit_message_template.md +10 -0
- data/.github/copilot-instructions.md +1 -0
- data/.github/pull_request_template.md +17 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +38 -1
- data/.rubocop_todo.yml +6 -317
- data/AGENTS.md +58 -0
- data/CLAUDE.md +1 -0
- data/Dockerfile +18 -3
- data/Gemfile +26 -1
- data/README.md +8 -4
- data/Rakefile +3 -0
- data/config/check_specs.yml +7 -0
- data/config/yardstick.yml +11 -3
- data/docs/agents/arcanum-split-issue.md +9 -0
- data/docs/agents/architecture.md +61 -0
- data/docs/agents/contributing.md +195 -0
- data/docs/agents/flow.md +5 -0
- data/docs/agents/folder-structure.md +26 -0
- data/docs/agents/issue-enhancement.md +10 -0
- data/docs/agents/issues/.gitkeep +1 -0
- data/docs/agents/plans/.gitkeep +1 -0
- data/lib/arstotzka/type_cast_ext.rb +52 -2
- data/lib/mercy/class_methods.rb +77 -7
- data/lib/mercy/concern.rb +105 -1
- data/lib/mercy/period_parser.rb +46 -3
- data/lib/mercy/report/active_record.rb +20 -16
- data/lib/mercy/report/error.rb +6 -4
- data/lib/mercy/report/multiple.rb +26 -22
- data/lib/mercy/report/range.rb +6 -4
- data/lib/mercy/report.rb +38 -7
- data/lib/mercy/report_builder.rb +2 -0
- data/lib/mercy/report_config.rb +5 -0
- data/lib/mercy/status.rb +7 -1
- data/lib/mercy/status_builder.rb +2 -0
- data/lib/mercy/version.rb +3 -1
- data/lib/mercy.rb +2 -0
- data/mercy.gemspec +14 -27
- data/scripts/bump_version.sh +62 -0
- data/spec/dummy/.ruby-version +1 -0
- data/spec/dummy/Rakefile +10 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/document_report_controller.rb +34 -0
- data/spec/dummy/app/controllers/example_report_controller.rb +27 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/jobs/application_job.rb +4 -0
- data/spec/dummy/app/mailers/application_mailer.rb +6 -0
- data/spec/dummy/app/models/application_record.rb +5 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/document.rb +9 -0
- data/spec/dummy/app/models/dummy_report.rb +6 -0
- data/spec/dummy/app/models/mercy/report/doc_type_error.rb +20 -0
- data/spec/dummy/app/models/mercy/report/dummy1.rb +19 -0
- data/spec/dummy/app/models/mercy/report/dummy_report.rb +11 -0
- data/spec/dummy/app/models/mercy/report/multiple/dummy.rb +28 -0
- data/spec/dummy/app/models/mercy/report/multiple/successes.rb +28 -0
- data/spec/dummy/app/models/mercy/report/success.rb +18 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +38 -0
- data/spec/dummy/bin/update +33 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +24 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +20 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +55 -0
- data/spec/dummy/config/environments/production.rb +95 -0
- data/spec/dummy/config/environments/test.rb +52 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/inflections.rb +18 -0
- data/spec/dummy/config/initializers/mime_types.rb +6 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +36 -0
- data/spec/dummy/config/routes.rb +16 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/db/migrate/20190508170435_create_documents.rb +13 -0
- data/spec/dummy/db/schema.rb +27 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/dummy/tmp/.keep +0 -0
- data/spec/dummy/tmp/storage/.keep +0 -0
- data/spec/integration/controller/error_report_controller_spec.rb +196 -0
- data/spec/integration/controller/multiple_report_spec.rb +86 -0
- data/spec/integration/controller/range_report_spec.rb +194 -0
- data/spec/integration/yard/arstotzka/type_cast_spec.rb +43 -0
- data/spec/integration/yard/controller/example_report_controller_spec.rb +95 -0
- data/spec/integration/yard/mercy/period_parser_spec.rb +21 -0
- data/spec/lib/arstotzka/type_cast_spec.rb +10 -9
- data/spec/lib/mercy/period_parser_spec.rb +10 -9
- data/spec/lib/mercy/report/error_spec.rb +93 -70
- data/spec/lib/mercy/report/multiple_spec.rb +9 -57
- data/spec/lib/mercy/report/range_spec.rb +70 -41
- data/spec/lib/mercy/report_builder_spec.rb +34 -17
- data/spec/lib/mercy/report_config_spec.rb +48 -0
- data/spec/lib/mercy/report_spec.rb +5 -15
- data/spec/lib/mercy/status_builder_spec.rb +33 -22
- data/spec/lib/mercy/status_spec.rb +69 -49
- data/spec/spec_helper.rb +18 -7
- data/spec/support/fixture_helpers.rb +4 -2
- data/spec/support/models/arstotzka/type_cast/dummy.rb +9 -0
- data/spec/support/shared_contexts/document_setup.rb +31 -0
- data/spec/support/shared_examples/time_parser.rb +2 -0
- metadata +113 -191
- data/spec/lib/mercy/report/report_config_spec.rb +0 -39
- data/spec/support/models/document.rb +0 -6
- data/spec/support/report/dummy.rb +0 -15
- data/spec/support/schema.rb +0 -11
data/.rubocop_todo.yml
CHANGED
|
@@ -1,181 +1,16 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2019-05-07
|
|
3
|
+
# on 2019-05-07 17:55:11 +0000 using RuboCop version 0.58.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
# Cop supports --auto-correct.
|
|
11
|
-
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
|
12
|
-
# Include: **/*.gemspec
|
|
13
|
-
Gemspec/OrderedDependencies:
|
|
14
|
-
Exclude:
|
|
15
|
-
- 'mercy.gemspec'
|
|
16
|
-
|
|
17
|
-
# Offense count: 1
|
|
18
|
-
# Configuration parameters: Include.
|
|
19
|
-
# Include: **/*.gemspec
|
|
20
|
-
Gemspec/RequiredRubyVersion:
|
|
21
|
-
Exclude:
|
|
22
|
-
- 'mercy.gemspec'
|
|
23
|
-
|
|
24
|
-
# Offense count: 1
|
|
25
|
-
# Cop supports --auto-correct.
|
|
26
|
-
Layout/EmptyLineAfterMagicComment:
|
|
27
|
-
Exclude:
|
|
28
|
-
- 'mercy.gemspec'
|
|
29
|
-
|
|
30
|
-
# Offense count: 2
|
|
31
|
-
# Cop supports --auto-correct.
|
|
32
|
-
# Configuration parameters: EnforcedStyle.
|
|
33
|
-
# SupportedStyles: empty_lines, no_empty_lines
|
|
34
|
-
Layout/EmptyLinesAroundBlockBody:
|
|
35
|
-
Exclude:
|
|
36
|
-
- 'spec/lib/mercy/report/error_spec.rb'
|
|
37
|
-
- 'spec/lib/mercy/status_spec.rb'
|
|
38
|
-
|
|
39
|
-
# Offense count: 1
|
|
40
|
-
# Cop supports --auto-correct.
|
|
41
|
-
# Configuration parameters: EnforcedStyle.
|
|
42
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
43
|
-
Layout/EmptyLinesAroundModuleBody:
|
|
44
|
-
Exclude:
|
|
45
|
-
- 'lib/mercy/class_methods.rb'
|
|
46
|
-
|
|
47
|
-
# Offense count: 2
|
|
48
|
-
# Cop supports --auto-correct.
|
|
49
|
-
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
|
50
|
-
Layout/ExtraSpacing:
|
|
51
|
-
Exclude:
|
|
52
|
-
- 'mercy.gemspec'
|
|
53
|
-
- 'spec/spec_helper.rb'
|
|
54
|
-
|
|
55
|
-
# Offense count: 3
|
|
56
|
-
# Cop supports --auto-correct.
|
|
57
|
-
# Configuration parameters: Width, IgnoredPatterns.
|
|
58
|
-
Layout/IndentationWidth:
|
|
59
|
-
Exclude:
|
|
60
|
-
- 'spec/lib/mercy/status_builder_spec.rb'
|
|
61
|
-
- 'spec/support/fixture_helpers.rb'
|
|
62
|
-
|
|
63
|
-
# Offense count: 11
|
|
64
|
-
# Cop supports --auto-correct.
|
|
65
|
-
# Configuration parameters: AllowForAlignment.
|
|
66
|
-
Layout/SpaceAroundOperators:
|
|
67
|
-
Exclude:
|
|
68
|
-
- 'lib/mercy/report/error.rb'
|
|
69
|
-
- 'lib/mercy/report/range.rb'
|
|
70
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
71
|
-
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
72
|
-
- 'spec/lib/mercy/status_builder_spec.rb'
|
|
73
|
-
- 'spec/support/report/dummy.rb'
|
|
74
|
-
|
|
75
|
-
# Offense count: 16
|
|
76
|
-
# Cop supports --auto-correct.
|
|
77
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
|
78
|
-
# SupportedStyles: space, no_space, compact
|
|
79
|
-
# SupportedStylesForEmptyBrackets: space, no_space
|
|
80
|
-
Layout/SpaceInsideArrayLiteralBrackets:
|
|
81
|
-
Exclude:
|
|
82
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
83
|
-
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
84
|
-
- 'spec/lib/mercy/status_builder_spec.rb'
|
|
85
|
-
- 'spec/lib/mercy/status_spec.rb'
|
|
86
|
-
|
|
87
|
-
# Offense count: 4
|
|
88
|
-
# Cop supports --auto-correct.
|
|
89
|
-
# Configuration parameters: EnforcedStyle.
|
|
90
|
-
# SupportedStyles: space, no_space
|
|
91
|
-
Layout/SpaceInsideParens:
|
|
92
|
-
Exclude:
|
|
93
|
-
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
94
|
-
|
|
95
|
-
# Offense count: 5
|
|
96
|
-
# Cop supports --auto-correct.
|
|
97
|
-
# Configuration parameters: EnforcedStyle.
|
|
98
|
-
# SupportedStyles: final_newline, final_blank_line
|
|
99
|
-
Layout/TrailingBlankLines:
|
|
100
|
-
Exclude:
|
|
101
|
-
- 'Gemfile'
|
|
102
|
-
- 'lib/mercy/report/multiple.rb'
|
|
103
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
104
|
-
- 'spec/lib/mercy/report/report_config_spec.rb'
|
|
105
|
-
- 'spec/lib/mercy/report_spec.rb'
|
|
106
|
-
|
|
107
|
-
# Offense count: 9
|
|
108
|
-
# Cop supports --auto-correct.
|
|
109
|
-
# Configuration parameters: AllowInHeredoc.
|
|
110
|
-
Layout/TrailingWhitespace:
|
|
111
|
-
Exclude:
|
|
112
|
-
- 'spec/lib/mercy/report/range_spec.rb'
|
|
113
|
-
- 'spec/lib/mercy/report_spec.rb'
|
|
114
|
-
|
|
115
|
-
# Offense count: 4
|
|
116
|
-
Lint/AmbiguousBlockAssociation:
|
|
117
|
-
Exclude:
|
|
118
|
-
- 'spec/support/models/document.rb'
|
|
119
|
-
|
|
120
|
-
# Offense count: 1
|
|
121
|
-
Lint/IneffectiveAccessModifier:
|
|
122
|
-
Exclude:
|
|
123
|
-
- 'lib/mercy/report.rb'
|
|
124
|
-
|
|
125
|
-
# Offense count: 1
|
|
126
|
-
Lint/ParenthesesAsGroupedExpression:
|
|
127
|
-
Exclude:
|
|
128
|
-
- 'spec/support/fixture_helpers.rb'
|
|
129
|
-
|
|
130
|
-
# Offense count: 27
|
|
131
10
|
# Configuration parameters: CountComments, ExcludedMethods.
|
|
132
11
|
# ExcludedMethods: refine
|
|
133
12
|
Metrics/BlockLength:
|
|
134
|
-
Max:
|
|
135
|
-
|
|
136
|
-
# Offense count: 2
|
|
137
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
|
138
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
|
139
|
-
Naming/MemoizedInstanceVariableName:
|
|
140
|
-
Exclude:
|
|
141
|
-
- 'lib/mercy/period_parser.rb'
|
|
142
|
-
|
|
143
|
-
# Offense count: 3
|
|
144
|
-
# Cop supports --auto-correct.
|
|
145
|
-
Performance/RedundantMatch:
|
|
146
|
-
Exclude:
|
|
147
|
-
- 'lib/arstotzka/type_cast_ext.rb'
|
|
148
|
-
- 'lib/mercy/period_parser.rb'
|
|
149
|
-
|
|
150
|
-
# Offense count: 18
|
|
151
|
-
# Configuration parameters: Prefixes.
|
|
152
|
-
# Prefixes: when, with, without
|
|
153
|
-
RSpec/ContextWording:
|
|
154
|
-
Exclude:
|
|
155
|
-
- 'spec/lib/mercy/report/error_spec.rb'
|
|
156
|
-
- 'spec/lib/mercy/report/range_spec.rb'
|
|
157
|
-
|
|
158
|
-
# Offense count: 39
|
|
159
|
-
# Cop supports --auto-correct.
|
|
160
|
-
RSpec/EmptyLineAfterFinalLet:
|
|
161
|
-
Exclude:
|
|
162
|
-
- 'spec/lib/mercy/report/error_spec.rb'
|
|
163
|
-
- 'spec/lib/mercy/report/range_spec.rb'
|
|
164
|
-
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
165
|
-
- 'spec/lib/mercy/status_builder_spec.rb'
|
|
166
|
-
- 'spec/lib/mercy/status_spec.rb'
|
|
167
|
-
|
|
168
|
-
# Offense count: 3
|
|
169
|
-
# Cop supports --auto-correct.
|
|
170
|
-
RSpec/EmptyLineAfterHook:
|
|
171
|
-
Exclude:
|
|
172
|
-
- 'spec/lib/mercy/report/error_spec.rb'
|
|
173
|
-
|
|
174
|
-
# Offense count: 1
|
|
175
|
-
# Configuration parameters: CustomTransform, IgnoreMethods.
|
|
176
|
-
RSpec/FilePath:
|
|
177
|
-
Exclude:
|
|
178
|
-
- 'spec/lib/mercy/report/report_config_spec.rb'
|
|
13
|
+
Max: 28
|
|
179
14
|
|
|
180
15
|
# Offense count: 11
|
|
181
16
|
# Configuration parameters: AggregateFailuresByDefault.
|
|
@@ -189,8 +24,8 @@ RSpec/NamedSubject:
|
|
|
189
24
|
- 'spec/lib/mercy/report/error_spec.rb'
|
|
190
25
|
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
191
26
|
- 'spec/lib/mercy/report/range_spec.rb'
|
|
192
|
-
- 'spec/lib/mercy/report/report_config_spec.rb'
|
|
193
27
|
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
28
|
+
- 'spec/lib/mercy/report_config_spec.rb'
|
|
194
29
|
- 'spec/lib/mercy/report_spec.rb'
|
|
195
30
|
- 'spec/lib/mercy/status_builder_spec.rb'
|
|
196
31
|
- 'spec/lib/mercy/status_spec.rb'
|
|
@@ -200,37 +35,6 @@ RSpec/NamedSubject:
|
|
|
200
35
|
RSpec/NestedGroups:
|
|
201
36
|
Max: 6
|
|
202
37
|
|
|
203
|
-
# Offense count: 11
|
|
204
|
-
# Cop supports --auto-correct.
|
|
205
|
-
# Configuration parameters: Strict, EnforcedStyle.
|
|
206
|
-
# SupportedStyles: inflected, explicit
|
|
207
|
-
RSpec/PredicateMatcher:
|
|
208
|
-
Exclude:
|
|
209
|
-
- 'spec/lib/mercy/report/error_spec.rb'
|
|
210
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
211
|
-
- 'spec/lib/mercy/report/range_spec.rb'
|
|
212
|
-
- 'spec/lib/mercy/report_builder_spec.rb'
|
|
213
|
-
|
|
214
|
-
# Offense count: 2
|
|
215
|
-
# Cop supports --auto-correct.
|
|
216
|
-
# Configuration parameters: EnforcedStyle.
|
|
217
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
|
218
|
-
Style/BracesAroundHashParameters:
|
|
219
|
-
Exclude:
|
|
220
|
-
- 'spec/lib/arstotzka/type_cast_spec.rb'
|
|
221
|
-
- 'spec/lib/mercy/period_parser_spec.rb'
|
|
222
|
-
|
|
223
|
-
# Offense count: 7
|
|
224
|
-
# Cop supports --auto-correct.
|
|
225
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
|
226
|
-
# SupportedStyles: nested, compact
|
|
227
|
-
Style/ClassAndModuleChildren:
|
|
228
|
-
Exclude:
|
|
229
|
-
- 'lib/mercy/report/active_record.rb'
|
|
230
|
-
- 'lib/mercy/report/multiple.rb'
|
|
231
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
232
|
-
- 'spec/lib/mercy/report_spec.rb'
|
|
233
|
-
|
|
234
38
|
# Offense count: 14
|
|
235
39
|
Style/Documentation:
|
|
236
40
|
Exclude:
|
|
@@ -250,122 +54,7 @@ Style/Documentation:
|
|
|
250
54
|
- 'lib/mercy/report_config.rb'
|
|
251
55
|
- 'lib/mercy/status.rb'
|
|
252
56
|
- 'lib/mercy/status_builder.rb'
|
|
57
|
+
- 'spec/dummy/**/*.rb'
|
|
253
58
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
# Configuration parameters: EnforcedStyle.
|
|
257
|
-
# SupportedStyles: compact, expanded
|
|
258
|
-
Style/EmptyMethod:
|
|
259
|
-
Exclude:
|
|
260
|
-
- 'spec/support/report/dummy.rb'
|
|
261
|
-
|
|
262
|
-
# Offense count: 1
|
|
263
|
-
# Cop supports --auto-correct.
|
|
264
|
-
Style/Encoding:
|
|
265
|
-
Exclude:
|
|
266
|
-
- 'mercy.gemspec'
|
|
267
|
-
|
|
268
|
-
# Offense count: 1
|
|
269
|
-
# Cop supports --auto-correct.
|
|
270
|
-
Style/ExpandPathArguments:
|
|
271
|
-
Exclude:
|
|
272
|
-
- 'mercy.gemspec'
|
|
273
|
-
|
|
274
|
-
# Offense count: 2
|
|
275
|
-
# Cop supports --auto-correct.
|
|
276
|
-
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
277
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
278
|
-
Style/HashSyntax:
|
|
279
|
-
Exclude:
|
|
280
|
-
- 'Rakefile'
|
|
281
|
-
- 'spec/support/schema.rb'
|
|
282
|
-
|
|
283
|
-
# Offense count: 14
|
|
284
|
-
# Cop supports --auto-correct.
|
|
285
|
-
Style/MutableConstant:
|
|
286
|
-
Exclude:
|
|
287
|
-
- 'lib/mercy/report.rb'
|
|
288
|
-
- 'lib/mercy/report/error.rb'
|
|
289
|
-
- 'lib/mercy/report/range.rb'
|
|
290
|
-
- 'lib/mercy/version.rb'
|
|
291
|
-
- 'spec/lib/mercy/report/multiple_spec.rb'
|
|
292
|
-
- 'spec/lib/mercy/report_spec.rb'
|
|
293
|
-
- 'spec/support/report/dummy.rb'
|
|
294
|
-
|
|
295
|
-
# Offense count: 2
|
|
296
|
-
# Cop supports --auto-correct.
|
|
297
|
-
# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions.
|
|
298
|
-
Style/ParenthesesAroundCondition:
|
|
299
|
-
Exclude:
|
|
300
|
-
- 'lib/mercy/report/active_record.rb'
|
|
301
|
-
- 'lib/mercy/report/error.rb'
|
|
302
|
-
|
|
303
|
-
# Offense count: 4
|
|
304
|
-
# Cop supports --auto-correct.
|
|
305
|
-
Style/RedundantParentheses:
|
|
306
|
-
Exclude:
|
|
307
|
-
- 'lib/mercy/report/active_record.rb'
|
|
308
|
-
- 'lib/mercy/report/error.rb'
|
|
309
|
-
- 'spec/support/fixture_helpers.rb'
|
|
310
|
-
|
|
311
|
-
# Offense count: 1
|
|
312
|
-
# Cop supports --auto-correct.
|
|
313
|
-
# Configuration parameters: AllowMultipleReturnValues.
|
|
314
|
-
Style/RedundantReturn:
|
|
315
|
-
Exclude:
|
|
316
|
-
- 'lib/mercy/report/range.rb'
|
|
317
|
-
|
|
318
|
-
# Offense count: 2
|
|
319
|
-
# Cop supports --auto-correct.
|
|
320
|
-
Style/RedundantSelf:
|
|
321
|
-
Exclude:
|
|
322
|
-
- 'lib/mercy/class_methods.rb'
|
|
323
|
-
- 'lib/mercy/report.rb'
|
|
324
|
-
|
|
325
|
-
# Offense count: 1
|
|
326
|
-
# Cop supports --auto-correct.
|
|
327
|
-
# Configuration parameters: EnforcedStyle.
|
|
328
|
-
# SupportedStyles: use_perl_names, use_english_names
|
|
329
|
-
Style/SpecialGlobalVars:
|
|
330
|
-
Exclude:
|
|
331
|
-
- 'mercy.gemspec'
|
|
332
|
-
|
|
333
|
-
# Offense count: 10
|
|
334
|
-
# Cop supports --auto-correct.
|
|
335
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
336
|
-
# SupportedStyles: single_quotes, double_quotes
|
|
337
|
-
Style/StringLiterals:
|
|
338
|
-
Exclude:
|
|
339
|
-
- 'Gemfile'
|
|
340
|
-
- 'Rakefile'
|
|
341
|
-
- 'mercy.gemspec'
|
|
342
|
-
- 'spec/spec_helper.rb'
|
|
343
|
-
|
|
344
|
-
# Offense count: 11
|
|
345
|
-
# Cop supports --auto-correct.
|
|
346
|
-
# Configuration parameters: MinSize.
|
|
347
|
-
# SupportedStyles: percent, brackets
|
|
348
|
-
Style/SymbolArray:
|
|
349
|
-
EnforcedStyle: brackets
|
|
350
|
-
|
|
351
|
-
# Offense count: 1
|
|
352
|
-
# Cop supports --auto-correct.
|
|
353
|
-
# Configuration parameters: IgnoredMethods.
|
|
354
|
-
# IgnoredMethods: respond_to, define_method
|
|
355
|
-
Style/SymbolProc:
|
|
356
|
-
Exclude:
|
|
357
|
-
- 'lib/mercy/status.rb'
|
|
358
|
-
|
|
359
|
-
# Offense count: 1
|
|
360
|
-
# Cop supports --auto-correct.
|
|
361
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
|
362
|
-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
363
|
-
Style/TrailingCommaInHashLiteral:
|
|
364
|
-
Exclude:
|
|
365
|
-
- 'lib/mercy/report/range.rb'
|
|
366
|
-
|
|
367
|
-
# Offense count: 21
|
|
368
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
369
|
-
# URISchemes: http, https
|
|
370
|
-
Metrics/LineLength:
|
|
371
|
-
Max: 110
|
|
59
|
+
Gemspec/RequireMFA:
|
|
60
|
+
Enabled: false
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Project Instructions
|
|
2
|
+
|
|
3
|
+
Mercy is a Ruby gem for easy server health checks: a Rails controller concern
|
|
4
|
+
(`include Mercy`, `status_report`, `render_status`) that builds configurable
|
|
5
|
+
reports (`Error`, `Range`, `Multiple`) over ActiveRecord scopes and renders them
|
|
6
|
+
as a JSON status.
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
|
|
10
|
+
- Ruby (>= 2.5)
|
|
11
|
+
- ActiveSupport 5 / Rails controller concern, ActiveRecord
|
|
12
|
+
- arstotzka, darthjee-core_ext, darthjee-active_ext
|
|
13
|
+
- RSpec, RuboCop, YARD (yardstick), SimpleCov
|
|
14
|
+
- Docker (docker-compose) and CircleCI
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
- Tests are written with RSpec (unit and integration specs under `spec/`).
|
|
19
|
+
- RuboCop must pass.
|
|
20
|
+
- Public API is documented with YARD (checked with yardstick).
|
|
21
|
+
- Every Ruby file starts with `# frozen_string_literal: true`.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
All project documentation lives under [`docs/agents/`](docs/agents/):
|
|
26
|
+
|
|
27
|
+
| File | Contents |
|
|
28
|
+
|------|----------|
|
|
29
|
+
| [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
30
|
+
| [Architecture](docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
|
|
31
|
+
| [Flow](docs/agents/flow.md) | Main runtime flow of the application. |
|
|
32
|
+
| [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
33
|
+
| [Plans](docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
|
|
34
|
+
| [Issues](docs/agents/issues/) | Detailed specs for open issues. |
|
|
35
|
+
|
|
36
|
+
### Issues (`docs/agents/issues/`)
|
|
37
|
+
|
|
38
|
+
Each file documents an issue in detail. Naming convention:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
docs/agents/issues/<issue_id>_<issue_name>.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Example: `docs/agents/issues/5_release_docker_image.md` for issue #5.
|
|
45
|
+
|
|
46
|
+
### Plans (`docs/agents/plans/`)
|
|
47
|
+
|
|
48
|
+
Each plan is a directory named after the issue ID and topic, containing one or more related files:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
docs/agents/plans/<issue_id>_<topic>/<related_files>.md
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Example: `docs/agents/plans/12_add-auth/plan.md` for issue #12.
|
|
55
|
+
|
|
56
|
+
## Commit Attribution
|
|
57
|
+
|
|
58
|
+
Commit co-author trailers follow arcanum's resolved `git.omit_model_coauthor` and `git.remove_coauthors` config (check them with `/arcanum-check-config`); this overrides Claude Code's own attribution reminder for every commit, including ones written by hand.
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
See [AGENTS.md](AGENTS.md) for project instructions.
|
data/Dockerfile
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
FROM darthjee/
|
|
1
|
+
FROM darthjee/scripts:0.15.0 as scripts
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
COPY --chown=app ./ /home/app/app/
|
|
3
|
+
FROM darthjee/ruby_3412:1.0.0 as base
|
|
5
4
|
|
|
5
|
+
COPY --chown=app:app ./ /home/app/app/
|
|
6
|
+
|
|
7
|
+
######################################
|
|
8
|
+
|
|
9
|
+
FROM base as builder
|
|
10
|
+
|
|
11
|
+
COPY --chown=app:app --from=scripts /home/scripts/builder/bundle_builder.sh /usr/local/sbin/bundle_builder.sh
|
|
12
|
+
|
|
13
|
+
ENV HOME_DIR /home/app
|
|
14
|
+
RUN bundle_builder.sh
|
|
15
|
+
|
|
16
|
+
#######################
|
|
17
|
+
#FINAL IMAGE
|
|
18
|
+
FROM base
|
|
19
|
+
|
|
20
|
+
COPY --chown=app:app --from=builder /home/app/bundle/ /usr/local/bundle/
|
|
6
21
|
RUN bundle install
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
gemspec
|
|
4
6
|
|
|
7
|
+
gem 'activerecord', '7.2.4'
|
|
8
|
+
gem 'bundler', '>= 4.0.24'
|
|
9
|
+
gem 'pry', '0.14.2'
|
|
10
|
+
gem 'pry-nav', '1.0.0'
|
|
11
|
+
gem 'rails', '7.2.4'
|
|
12
|
+
gem 'rake', '13.4.2'
|
|
13
|
+
gem 'reek', '6.5.0'
|
|
14
|
+
gem 'rspec', '3.13.2'
|
|
15
|
+
gem 'rspec-core', '3.13.7'
|
|
16
|
+
gem 'rspec-expectations', '3.13.6'
|
|
17
|
+
gem 'rspec-mocks', '3.13.9'
|
|
18
|
+
gem 'rspec-rails', '8.0.4'
|
|
19
|
+
gem 'rspec-support', '3.13.8'
|
|
20
|
+
gem 'rubocop', '1.92.2'
|
|
21
|
+
gem 'rubocop-rake', '0.7.1'
|
|
22
|
+
gem 'rubocop-rspec', '3.10.2'
|
|
23
|
+
gem 'rubycritic', '5.0.0'
|
|
24
|
+
gem 'simplecov', '0.22.0'
|
|
25
|
+
gem 'simplecov-html', '0.13.2'
|
|
26
|
+
gem 'simplecov-lcov', '0.9.0'
|
|
27
|
+
gem 'sqlite3', '2.10.2'
|
|
28
|
+
gem 'yard', '0.9.45'
|
|
29
|
+
gem 'yardstick', '0.9.9'
|
data/README.md
CHANGED
|
@@ -6,14 +6,18 @@ Mercy
|
|
|
6
6
|
[](https://codeclimate.com/github/darthjee/mercy)
|
|
7
7
|
[](https://badge.fury.io/rb/mercy)
|
|
8
8
|
|
|
9
|
-

|
|
10
10
|
|
|
11
11
|
This gem tries to make server monitoring easier and more reliable by adding an easly configurable
|
|
12
12
|
report and making it avaliable in a controller
|
|
13
13
|
|
|
14
14
|
Yard Documentation
|
|
15
15
|
-------------------
|
|
16
|
-
https://www.rubydoc.info/gems/mercy/
|
|
16
|
+
[https://www.rubydoc.info/gems/mercy/2.0.0](https://www.rubydoc.info/gems/mercy/2.0.0)
|
|
17
|
+
|
|
18
|
+
**Current Release**: [2.0.0](https://github.com/darthjee/mercy/tree/2.0.0)
|
|
19
|
+
|
|
20
|
+
**Next release**: [2.1.0](https://github.com/darthjee/mercy/compare/2.0.0...main)
|
|
17
21
|
|
|
18
22
|
Getting started
|
|
19
23
|
---------------
|
|
@@ -64,14 +68,14 @@ with error and render the report
|
|
|
64
68
|
|
|
65
69
|
Remembering that each report may have its onw parameters
|
|
66
70
|
|
|
67
|
-
- ```Mercy::Error```
|
|
71
|
+
- ```Mercy::Report::Error```
|
|
68
72
|
- scope: scope to be fetched when trying to find objects with error (default: :with_error)
|
|
69
73
|
- external_key: column to be exposed as id for the objects with error
|
|
70
74
|
- threshold: default report threshold (default: 0.02)
|
|
71
75
|
- base_scope: scope to be universal sample
|
|
72
76
|
- uniq: when the output ids should not be repeated
|
|
73
77
|
- limit: limit of ids to be outputed
|
|
74
|
-
- ```Mercy::Range```
|
|
78
|
+
- ```Mercy::Report::Range```
|
|
75
79
|
- scope: scope of the query to be counted
|
|
76
80
|
- maximum: max value accepted in the range
|
|
77
81
|
- minimum: minimum value accepted in the range
|
data/Rakefile
CHANGED
data/config/yardstick.yml
CHANGED
|
@@ -15,13 +15,21 @@ rules:
|
|
|
15
15
|
exclude: []
|
|
16
16
|
ExampleTag:
|
|
17
17
|
enabled: true
|
|
18
|
-
exclude:
|
|
18
|
+
exclude:
|
|
19
|
+
- Mercy::Report#json
|
|
20
|
+
- Mercy::Report#initialize
|
|
19
21
|
ReturnTag:
|
|
20
22
|
enabled: true
|
|
21
|
-
exclude:
|
|
23
|
+
exclude:
|
|
24
|
+
- Mercy::PeriodParser#period
|
|
25
|
+
- Mercy::Report#json
|
|
22
26
|
Summary::Presence:
|
|
23
27
|
enabled: true
|
|
24
|
-
exclude:
|
|
28
|
+
exclude:
|
|
29
|
+
- Mercy::PeriodParser#initialize
|
|
30
|
+
- Mercy::PeriodParser#period
|
|
31
|
+
- Mercy::Report#initialize
|
|
32
|
+
- Mercy::Report#json
|
|
25
33
|
Summary::Length:
|
|
26
34
|
enabled: true
|
|
27
35
|
exclude: []
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Arcanum Split Issue
|
|
2
|
+
|
|
3
|
+
A checklist of concerns to consider when splitting a broad issue into sub-issues via `/arcanum-split-issue`. Not exhaustive — adjust or extend the list for this project's needs.
|
|
4
|
+
|
|
5
|
+
- **Sub-issue granularity** — is each sub-issue independently workable, or does it still depend on another sub-issue landing first?
|
|
6
|
+
- **Standalone clarity** — does each sub-issue stand on its own, without requiring the reader to have the parent issue open to understand it?
|
|
7
|
+
- **Shared contracts** — interfaces, schemas, or config keys touched by more than one sub-issue, and who owns getting them right first.
|
|
8
|
+
- **Sequencing** — is there a natural order sub-issues should be implemented/merged in, or can they proceed in parallel?
|
|
9
|
+
- **Responsible agents** — which specialist agent(s) each sub-issue is likely to fall to.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Mercy is a Rails controller concern for health checks. A controller does
|
|
6
|
+
`include Mercy`, declares reports at class level with `status_report`, and
|
|
7
|
+
renders them in an action with `render_status(bucket)`.
|
|
8
|
+
|
|
9
|
+
Declared reports are stored as configurations grouped into **buckets** (`on:`,
|
|
10
|
+
default `:default`). On each request the bucket's configurations are turned into
|
|
11
|
+
report instances (merging whitelisted request params such as `period` and
|
|
12
|
+
`threshold`), aggregated into a `Status`, and rendered as JSON with HTTP status
|
|
13
|
+
`:ok` or `:error`.
|
|
14
|
+
|
|
15
|
+
Report options are read through [Arstotzka](https://github.com/darthjee/arstotzka)
|
|
16
|
+
`expose`, with custom type casts (`period`, `infinity_float`).
|
|
17
|
+
|
|
18
|
+
## Source Code Layout
|
|
19
|
+
|
|
20
|
+
All source code lives under `lib/`.
|
|
21
|
+
|
|
22
|
+
### `lib/mercy.rb`
|
|
23
|
+
|
|
24
|
+
Entry point: requires dependencies (`darthjee-core_ext`, `darthjee-active_ext`,
|
|
25
|
+
`arstotzka`) and all Mercy components.
|
|
26
|
+
|
|
27
|
+
### `lib/mercy/`
|
|
28
|
+
|
|
29
|
+
- `concern.rb` — `Mercy` as an `ActiveSupport::Concern`; defines the instance
|
|
30
|
+
method `render_status`.
|
|
31
|
+
- `class_methods.rb` — `status_report` DSL and the per-controller `status_builder`.
|
|
32
|
+
- `status_builder.rb` — groups report keys into buckets and builds a `Status`
|
|
33
|
+
for a bucket.
|
|
34
|
+
- `report_builder.rb` — stores a `ReportConfig` per report key and builds reports.
|
|
35
|
+
- `report_config.rb` — resolves the report class from `type:` (symbol or class,
|
|
36
|
+
default `:error`) and slices request params to the class's `ALLOWED_PARAMETERS`.
|
|
37
|
+
- `status.rb` — aggregates reports; status is `:error` if any report errors.
|
|
38
|
+
- `report.rb` — base `Report` class (default options, `status`, `as_json`).
|
|
39
|
+
- `period_parser.rb` — parses strings like `3.days` / `1hours` into seconds.
|
|
40
|
+
- `version.rb` — gem version.
|
|
41
|
+
|
|
42
|
+
### `lib/mercy/report/`
|
|
43
|
+
|
|
44
|
+
- `active_record.rb` — base for ActiveRecord-backed reports: `clazz`,
|
|
45
|
+
`base_scope`, `period`, and chained scope resolution (`'active.with_error'`).
|
|
46
|
+
- `error.rb` — `Report::Error`: percentage of records in `scope` within the
|
|
47
|
+
period vs. `threshold`; outputs offending ids.
|
|
48
|
+
- `range.rb` — `Report::Range`: count of records in `scope` must be within
|
|
49
|
+
`minimum..maximum`.
|
|
50
|
+
- `multiple.rb` — `Report::Multiple` mixin: builds and aggregates sub-reports.
|
|
51
|
+
|
|
52
|
+
### `lib/arstotzka/`
|
|
53
|
+
|
|
54
|
+
- `type_cast_ext.rb` — adds `to_period` and `to_infinity_float` casts to
|
|
55
|
+
`Arstotzka::TypeCast`.
|
|
56
|
+
|
|
57
|
+
## Adding a new report type
|
|
58
|
+
|
|
59
|
+
Subclass `Mercy::Report` (or `Report::ActiveRecord`), define
|
|
60
|
+
`ALLOWED_PARAMETERS`, `DEFAULT_OPTION`, `error?` and `as_json`. It can then be
|
|
61
|
+
used via `type: :your_type` (resolved under `Mercy::Report`) or `type: YourClass`.
|