recheck 0.6.0 → 0.8.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/changelog.md +26 -0
- data/comm-license.md +185 -0
- data/lib/recheck/rails/setup.rb +7 -6
- data/lib/recheck/rails/version.rb +1 -0
- data/lib/recheck/tasks/recheck_tasks.rake +19 -0
- data/lib/recheck/version.rb +1 -1
- data/license.md +9 -0
- data/readme.md +400 -0
- data/recheck.gemspec +44 -0
- data/template/active_record_model_check.rb.erb +16 -0
- data/template/application_record_check.rb.erb +11 -0
- data/template/validation_checker.rb.erb +33 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 486a238104811d7c0c89f9139bce5a9d484f4394e3c23645e1329635a2d462c2
|
4
|
+
data.tar.gz: af3d9af6493d3b684c1047635ad2481f638ad89166d01f1f11fd99c3e57e615b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '059a3fd50bc81f4788297e9c767094ea6fda175c4328ca6922778929c41612da1cec31e419a751e8705daf1b6a8409dd16185156947d5321a0f6976f109d113c'
|
7
|
+
data.tar.gz: c0237b5b87bcee83242f5c8a753eb89a61936519b9a2eedb1e39b071a832726b2c5a50e4bd036a1f126d892d399aecccd3e7c158f9c66793b913aca996774957
|
data/changelog.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## 0.8.0 - 2025-09-05
|
4
|
+
|
5
|
+
* Fixed generated check for ActiveRecord length validation
|
6
|
+
|
7
|
+
## 0.7.0 - 2025-09-05
|
8
|
+
|
9
|
+
* Fixed including rake tasks.
|
10
|
+
|
11
|
+
## 0.6.0 - 2025-09-05
|
12
|
+
|
13
|
+
* Folded recheck-rails gem into primary gem with conditional loading
|
14
|
+
|
15
|
+
## 0.5.0 - 2025-07-30
|
16
|
+
|
17
|
+
* setup: Generate some docs for reporters and checkers.
|
18
|
+
* Runner, reporter: add `around_query`
|
19
|
+
|
20
|
+
## 0.4.0 - 2025-07-16
|
21
|
+
|
22
|
+
* Public beta.
|
23
|
+
|
24
|
+
## 0.1.0 - 2024-03-16
|
25
|
+
|
26
|
+
* Placeholder.
|
data/comm-license.md
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
# END-USER LICENSE AGREEMENT
|
2
|
+
|
3
|
+
------------------------------------------------------------------------------
|
4
|
+
|
5
|
+
IMPORTANT: THIS SOFTWARE END-USER LICENSE AGREEMENT ("EULA") IS A LEGAL AGREEMENT (“Agreement”) BETWEEN YOU (THE CUSTOMER, EITHER AS AN INDIVIDUAL OR, IF PURCHASED OR OTHERWISE ACQUIRED BY OR FOR AN ENTITY, AS AN ENTITY) AND RECHECK LIMITED WORKER COOPERATIVE ASSOCIATION ("Recheck LWCA").
|
6
|
+
READ IT CAREFULLY BEFORE COMPLETING THE INSTALLATION PROCESS AND USING RECHECK PRO AND RELATED SOFTWARE COMPONENTS (“SOFTWARE”).
|
7
|
+
IT PROVIDES A LICENSE TO USE THE SOFTWARE AND CONTAINS WARRANTY INFORMATION AND LIABILITY DISCLAIMERS.
|
8
|
+
BY INSTALLING AND USING THE SOFTWARE, YOU ARE CONFIRMING YOUR ACCEPTANCE OF THE SOFTWARE AND AGREEING TO BECOME BOUND BY THE TERMS OF THIS AGREEMENT.
|
9
|
+
|
10
|
+
------------------------------------------------------------------------------
|
11
|
+
|
12
|
+
The Open Source version of the Software (“LGPL Version”) is licensed under the terms of the GNU Lesser General Public License version 3.0 (“LGPL”) and not under this EULA.
|
13
|
+
In order to use the Software under this Agreement, you must receive a “Source URL” at the time of purchase, in accordance with the scope of use and other terms specified for each type of Software and as set forth in this Section 1 of this Agreement.
|
14
|
+
|
15
|
+
## 1. License Grant
|
16
|
+
|
17
|
+
### 1.1 General Use
|
18
|
+
This Agreement grants you a non-exclusive, non-transferable, limited license to the use rights for the Software, without the right to grant sublicenses, subject to the terms and conditions in this Agreement. The Software is licensed, not sold.
|
19
|
+
|
20
|
+
### 1.2 Unlimited Organization License
|
21
|
+
If you purchased an Organization License (included with the Recheck Pro Software), you may install the Software on an unlimited number of Hosts.
|
22
|
+
“Host” means any physical or virtual machine which is controlled by you.
|
23
|
+
You may also run an unlimited number of Workers.
|
24
|
+
“Worker” means a thread within a Recheck server process which executes jobs.
|
25
|
+
You may concurrently run the software on an unlimited number of Hosts, with each host running an unlimited number of Workers.
|
26
|
+
|
27
|
+
### 1.3 Limited Enterprise License
|
28
|
+
If you purchased a Limited License for the Recheck Enterprise Software, you may install the Software on an unlimited number of Hosts.
|
29
|
+
“Host” means any physical or virtual machine which is controlled by you.
|
30
|
+
The aggregate number of Workers run by the hosts must not exceed the maximum number of Workers authorized at the time of purchase.
|
31
|
+
“Worker” means a thread within a Recheck server process which executes jobs. In order to run additional Workers, you must purchase an additional allowance from Recheck LWCA.
|
32
|
+
|
33
|
+
### 1.4 Enterprise Site License
|
34
|
+
If you purchased a Site License for the Recheck Enterprise Software, you may install the Software on an unlimited number of Hosts.
|
35
|
+
“Host” means any physical or virtual machine which is controlled by you.
|
36
|
+
You may also run an unlimited number of Workers.
|
37
|
+
“Worker” means a thread within a Recheck server process which executes jobs.
|
38
|
+
You may concurrently run the software on an unlimited number of Hosts, with each host running an unlimited number of Workers.
|
39
|
+
|
40
|
+
### 1.5 Appliance License
|
41
|
+
If you purchased an Appliance License, you may distribute the Software in any applications, frameworks, or elements (collectively referred to as an “Application” or “Applications”) that you develop using the Software in accordance with this EULA, provided that such distribution does not violate the restrictions set forth in section 3 of this EULA.
|
42
|
+
You must not remove, obscure or interfere with any copyright, acknowledgment, attribution, trademark, warning or disclaimer statement affixed to, incorporated in or otherwise applied in connection with the Software.
|
43
|
+
You are required to ensure that the Software is not reused by or with any applications other than those with which you distribute it as permitted herein.
|
44
|
+
For example, if You install the Software on a customer's server, that customer is not permitted to use the Software independently of your Application.
|
45
|
+
You must inform Recheck LWCA of your knowledge of any infringing use of the Software by any of your customers.
|
46
|
+
You are liable for compliance by those third parties with the terms and conditions of this EULA.
|
47
|
+
You will not owe Recheck LWCA any royalties for your distribution of the Software in accordance with this EULA.
|
48
|
+
|
49
|
+
### 1.6 Archive Copies
|
50
|
+
You are entitled to make a reasonable amount of copies of the Software for archival purposes.
|
51
|
+
Each copy must reproduce all copyright and other proprietary rights notices on or in the Software Product.
|
52
|
+
|
53
|
+
### 1.7 Electronic Delivery
|
54
|
+
All Software and license documentation shall be delivered by electronic means unless otherwise specified on the applicable invoice or at the time of purchase.
|
55
|
+
Software shall be deemed delivered when it is made available for download by you (“Delivery”).
|
56
|
+
|
57
|
+
### 2 Modifications
|
58
|
+
Recheck LWCA shall provide you with source code so that you can create Modifications of the original software.
|
59
|
+
“Modification” means: (a) any addition to or deletion from the contents of a file included in the original Software or previous Modifications created by You, or (b) any new file that contains any part of the original Software or previous Modifications.
|
60
|
+
While you retain all rights to any original work authored by you as part of the Modifications, We continue to own all copyright and other intellectual property rights in the Software.
|
61
|
+
|
62
|
+
## 3. Restricted Uses
|
63
|
+
|
64
|
+
### 3.1 Reversing
|
65
|
+
You shall not (and shall not allow any third party to):
|
66
|
+
(a) decompile, disassemble, or otherwise reverse engineer the Software or attempt to reconstruct or discover any source code, underlying ideas, algorithms, file formats or programming interfaces of the Software by any means whatsoever (except and only to the extent that applicable law prohibits or restricts reverse engineering restrictions);
|
67
|
+
(b) distribute, sell, sublicense, rent, lease or use the Software for time sharing, hosting, service provider or like purposes, except as expressly permitted under this Agreement;
|
68
|
+
(c) redistribute the Software or Modifications other than by including the Software or a portion thereof within your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes;
|
69
|
+
(d) redistribute the Software as part of a product, "appliance" or "virtual server";
|
70
|
+
(e) redistribute the Software on any server which is not directly under your control;
|
71
|
+
(f) remove any product identification, proprietary, copyright or other notices contained in the Software;
|
72
|
+
(g) modify any part of the Software, create a derivative work of any part of the Software (except as permitted in Section 4), or incorporate the Software, except to the extent expressly authorized in writing by Recheck LWCA;
|
73
|
+
(h) publicly disseminate performance information or analysis (including, without limitation, benchmarks) from any source relating to the Software;
|
74
|
+
(i) utilize any equipment, device, software, or other means designed to circumvent or remove any form of Source URL or copy protection used by Recheck LWCA in connection with the Software, or use the Software together with any authorization code, Source URL, serial number, or other copy protection device not supplied by Recheck LWCA;
|
75
|
+
(j) use the Software to develop a product which is competitive with any Recheck LWCA product offerings;
|
76
|
+
or (k) use unauthorized Source URLS or keycode(s) or distribute or publish Source URLs or keycode(s), except as may be expressly permitted by Recheck LWCA in writing.
|
77
|
+
|
78
|
+
If your unique Source URL is ever published, Recheck LWCA reserves the right to terminate your access without notice.
|
79
|
+
|
80
|
+
### 3.2 Reimplementing
|
81
|
+
Under no circumstances may you use the software as part of a product or service that provides similar functionality to the software itself.
|
82
|
+
|
83
|
+
### 4 Ownership
|
84
|
+
Notwithstanding anything to the contrary contained herein, except for the limited license rights expressly provided herein, Recheck LWCA and its suppliers have and will retain all rights, title and interest (including, without limitation, all patent, copyright, trademark, trade secret and other intellectual property rights) in and to the Software and all copies, modifications and derivative works thereof (including any changes which incorporate any of your ideas, feedback or suggestions).
|
85
|
+
You acknowledge that you are obtaining only a limited license right to the Software, and that irrespective of any use of the words “purchase”, “sale” or like terms hereunder no ownership rights are being conveyed to you under this Agreement or otherwise.
|
86
|
+
|
87
|
+
### 5 Fees and Payment
|
88
|
+
The Software license fees will be due and payable in full as set forth in the applicable invoice or at the time of purchase.
|
89
|
+
If the Software does not function properly within two weeks of purchase, please contact us within those two weeks for a refund.
|
90
|
+
You shall be responsible for all taxes, withholdings, duties and levies arising from the order (excluding taxes based on the net income of Recheck LWCA).
|
91
|
+
|
92
|
+
### 6 Support, Maintenance and Services.
|
93
|
+
Subject to the terms and conditions of this Agreement, as set forth in your invoice, and as set forth on the latest version of the Recheck Pro support page (https://github.com/recheckdev/recheck-ruby/wiki/Commercial-Support), support and maintenance services may be included with the purchase of your license subscription.
|
94
|
+
|
95
|
+
## 7. Term of Agreement
|
96
|
+
|
97
|
+
### 7.1 Term
|
98
|
+
This Agreement is effective as of the Delivery of the Software and expires at such time as all license and service subscriptions hereunder have expired in accordance with their own terms (the “Term”).
|
99
|
+
For clarification, the term of your license under this Agreement may be perpetual, limited for Evaluation Version, or designated as a fixed-term license in the Invoice, and shall be specified at your time of purchase.
|
100
|
+
Either party may terminate this Agreement (including all related Invoices) if the other party: (a) fails to cure any material breach of this Agreement within thirty (30) days after written notice of such breach, provided that Recheck LWCA may terminate this Agreement immediately upon any breach of Section 3 or if you exceed any other restrictions contained in Section 1, unless otherwise specified in this agreement; (b) ceases operation without a successor; or (c) seeks protection under any bankruptcy, receivership, trust deed, creditors arrangement, composition or comparable proceeding, or if any such proceeding is instituted against such party (and not dismissed within sixty (60) days)).
|
101
|
+
Termination is not an exclusive remedy and the exercise by either party of any remedy under this Agreement will be without prejudice to any other remedies it may have under this Agreement, by law, or otherwise.
|
102
|
+
|
103
|
+
### 7.2 Termination
|
104
|
+
Upon any termination of this Agreement, you shall cease any and all use of any Software and destroy all copies thereof.
|
105
|
+
|
106
|
+
### 7.3 Expiration of License
|
107
|
+
Upon the expiration of any term under this Agreement, (a) all Software updates and services pursuant to the license shall cease, (b) you may only continue to run existing installations of the Software, (c) you may not install the Software on any additional Hosts, and (d) any new installation of the Software shall require the purchase of a new license subscription from Recheck LWCA.
|
108
|
+
|
109
|
+
### 8 Disclaimer of Warranties
|
110
|
+
The Software is provided "as is," with all faults, defects and errors, and without warranty of any kind.
|
111
|
+
Recheck LWCA does not warrant that the Software will be free of bugs, errors, viruses or other defects, and Recheck LWCA shall have no liability of any kind for the use of or inability to use the Software, the Software content or any associated service, and you acknowledge that it is not technically practicable for Recheck LWCA to do so.
|
112
|
+
To the maximum extent permitted by applicable law, Recheck LWCA disclaims all warranties, express, implied, arising by law or otherwise, regarding the Software, the Software content and their respective performance or suitability for your intended use, including without limitation any implied warranty of merchantability, fitness for a particular purpose.
|
113
|
+
|
114
|
+
## 9. Limitation of Liability
|
115
|
+
In no event will Recheck LWCA be liable for any direct, indirect, consequential, incidental, special, exemplary, or punitive damages or liabilities whatsoever arising from or relating to the Software, the Software content or this Agreement, whether based on contract, tort (including negligence), strict liability or other theory, even if Recheck LWCA has been advised of the possibility of such damages.
|
116
|
+
|
117
|
+
In no event will Recheck LWCA' liability exceed the Software license price as indicated in the invoice. The existence of more than one claim will not enlarge or extend this limit.
|
118
|
+
|
119
|
+
## 10 Remedies
|
120
|
+
Your exclusive remedy and Recheck LWCA' entire liability for breach of this Agreement shall be limited, at Recheck LWCA' sole and exclusive discretion, to (a) replacement of any defective software or documentation; or (b) refund of the license fee paid to Recheck LWCA, payable in accordance with Recheck LWCA' refund policy.
|
121
|
+
|
122
|
+
## 11. Acknowledgements
|
123
|
+
|
124
|
+
### 11.1 Consent to the Use of Data
|
125
|
+
You agree that Recheck LWCA and its affiliates may collect and use technical information gathered as part of the product support services.
|
126
|
+
Recheck LWCA may use this information solely to improve products and services and will not disclose this information in a form that personally identifies you.
|
127
|
+
|
128
|
+
### 11.2 Verification
|
129
|
+
We or a certified auditor acting on our behalf, may, upon its reasonable request and at its expense, audit you with respect to the use of the Software.
|
130
|
+
Such audit may be conducted by mail, electronic means or through an in-person visit to your place of business.
|
131
|
+
Any such in-person audit shall be conducted during regular business hours at your facilities and shall not unreasonably interfere with your business activities.
|
132
|
+
We shall not remove, copy, or redistribute any electronic material during the course of an audit.
|
133
|
+
If an audit reveals that you are using the Software in a way that is in material violation of the terms of the EULA, then you shall pay our reasonable costs of conducting the audit.
|
134
|
+
In the case of a material violation, you agree to pay Us any amounts owing that are attributable to the unauthorized use.
|
135
|
+
In the alternative, We reserve the right, at our sole option, to terminate the licenses for the Software.
|
136
|
+
|
137
|
+
### 11.3 Government End Users
|
138
|
+
If the Software and related documentation are supplied to or purchased by or on behalf of the United States Government, then the Software is deemed to be "commercial software" as that term is used in the Federal Acquisition Regulation system.
|
139
|
+
Rights of the United States shall not exceed the minimum rights set forth in FAR 52.227-19 for "restricted computer software".
|
140
|
+
All other terms and conditions of this Agreement apply.
|
141
|
+
|
142
|
+
### 12 Third Party Software
|
143
|
+
Examples included in Software may provide links to third party libraries or code (collectively “Third Party Software”) to implement various functions.
|
144
|
+
Third Party Software does not comprise part of the Software.
|
145
|
+
In some cases, access to Third Party Software may be included along with the Software delivery as a convenience for demonstration purposes.
|
146
|
+
Such source code and libraries may be included in the “…/examples” source tree delivered with the Software and do not comprise the Software.
|
147
|
+
Licensee acknowledges (1) that some part of Third Party Software may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Software referencing or including any portion of a Third Party Software may require appropriate licensing from such third parties.
|
148
|
+
|
149
|
+
|
150
|
+
## 13. Miscellaneous
|
151
|
+
|
152
|
+
### 13.1 Entire Agreement
|
153
|
+
This Agreement sets forth our entire agreement with respect to the Software and the subject matter hereof and supersedes all prior and contemporaneous understandings and agreements whether written or oral.
|
154
|
+
|
155
|
+
### 13.2 Amendment
|
156
|
+
Recheck LWCA reserves the right, in its sole discretion, to amend this Agreement from time.
|
157
|
+
Amendments to this Agreement can be located at: https://github.com/recheckdev/recheck-ruby/blob/main/COMM-LICENSE.
|
158
|
+
|
159
|
+
### 13.3 Assignment
|
160
|
+
You may not assign this Agreement or any of its rights under this Agreement without the prior written consent of Recheck LWCA and any attempted assignment without such consent shall be void.
|
161
|
+
|
162
|
+
### 13.4 Export Compliance
|
163
|
+
You agree to comply with all applicable laws and regulations, including laws, regulations, orders or other restrictions on export, re-export or redistribution of software.
|
164
|
+
|
165
|
+
### 13.5 Indemnification
|
166
|
+
You agree to defend, indemnify, and hold harmless Recheck LWCA from and against any lawsuits, claims, losses, damages, fines and expenses (including attorneys' fees and costs) arising out of your use of the Software or breach of this Agreement.
|
167
|
+
|
168
|
+
### 13.6 Governing Law
|
169
|
+
This Agreement is governed by the laws of the State of Illinois and the United States without regard to conflicts of laws provisions thereof, and without regard to the United Nations Convention on the International Sale of Goods or the Uniform Computer Information Transactions Act, as currently enacted by any jurisdiction or as may be codified or amended from time to time by any jurisdiction.
|
170
|
+
The jurisdiction and venue for actions related to the subject matter hereof shall be the state of Illinois and United States federal courts located in Chicago, Illinois, and both parties hereby submit to the personal jurisdiction of such courts.
|
171
|
+
|
172
|
+
### 13.7 Attorneys' Fees and Costs
|
173
|
+
The prevailing party in any action to enforce this Agreement will be entitled to recover its attorneys' fees and costs in connection with such action.
|
174
|
+
|
175
|
+
### 13.8 Severability
|
176
|
+
If any provision of this Agreement is held by a court of competent jurisdiction to be invalid, illegal, or unenforceable, the remainder of this Agreement will remain in full force and effect.
|
177
|
+
|
178
|
+
### 13.9 Waiver
|
179
|
+
Failure or neglect by either party to enforce at any time any of the provisions of this licence Agreement shall not be construed or deemed to be a waiver of that party's rights under this Agreement.
|
180
|
+
|
181
|
+
### 13.10 Headings
|
182
|
+
The headings of sections and paragraphs of this Agreement are for convenience of reference only and are not intended to restrict, affect or be of any weight in the interpretation or construction of the provisions of such sections or paragraphs.
|
183
|
+
|
184
|
+
### 14 Contact Information
|
185
|
+
If you have any questions about this EULA, or if you want to contact Recheck LWCA for any reason, please direct correspondence to info@recheck.coop.
|
data/lib/recheck/rails/setup.rb
CHANGED
@@ -94,25 +94,26 @@ module Recheck
|
|
94
94
|
FunctionPlaceholder.new inspect:, name:, comment: "Coming soon to Recheck beta"
|
95
95
|
when ActiveRecord::Validations::LengthValidator
|
96
96
|
or_clauses = []
|
97
|
-
if type == :
|
97
|
+
if type == :string || type == :text || type == :integer
|
98
98
|
if validator.options[:is]
|
99
99
|
or_clauses << %{"LENGTH(`#{column.name}`) = '')"}
|
100
100
|
end
|
101
101
|
if validator.options[:minimum] && validator.options[:maximum]
|
102
|
-
or_clauses << %{"LENGTH(`#{column.name}`)
|
102
|
+
or_clauses << %{"LENGTH(`#{column.name}`) <= #{validator.options[:minimum]} and LENGTH(`#{column.name}`) >= #{validator.options[:maximum]}"}
|
103
103
|
elsif validator.options[:minimum]
|
104
|
-
or_clauses << %{"LENGTH(`#{column.name}`)
|
104
|
+
or_clauses << %{"LENGTH(`#{column.name}`) <= #{validator.options[:minimum]}"}
|
105
105
|
elsif validator.options[:maximum]
|
106
|
-
or_clauses << %{"LENGTH(`#{column.name}`)
|
106
|
+
or_clauses << %{"LENGTH(`#{column.name}`) >= #{validator.options[:maximum]}"}
|
107
107
|
end
|
108
108
|
elsif type == :boolean
|
109
|
-
comment = "Validating length of a boolean is backend-
|
109
|
+
comment = "Validating length of a boolean is backend-dependent and a strange idea."
|
110
110
|
else
|
111
|
-
comment = "Recheck doesn't know how to handle
|
111
|
+
comment = "Recheck doesn't know how to handle length on a #{type}, please report."
|
112
112
|
end
|
113
113
|
if !validator.options[:allow_nil] && !validator.options[:allow_blank]
|
114
114
|
or_clauses << "#{column.name}: nil"
|
115
115
|
end
|
116
|
+
Query.new inspect:, name:, warning:, comment:, or_clauses:
|
116
117
|
when ActiveRecord::Validations::NumericalityValidator
|
117
118
|
FunctionPlaceholder.new inspect:, name:, comment: "Coming soon to Recheck beta"
|
118
119
|
when ActiveRecord::Validations::PresenceValidator
|
@@ -0,0 +1 @@
|
|
1
|
+
../../../recheck/lib/recheck/version.rb
|
@@ -0,0 +1,19 @@
|
|
1
|
+
namespace :recheck do
|
2
|
+
desc "Set up a recheck suite"
|
3
|
+
task setup: :environment do
|
4
|
+
# Eager load all models for introspection
|
5
|
+
Rails.application.eager_load!
|
6
|
+
|
7
|
+
require "recheck/commands"
|
8
|
+
require "recheck/rails/setup"
|
9
|
+
|
10
|
+
Recheck::Command::Setup.new(argv: []).run
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run recheck checks"
|
14
|
+
task :run, [:args] => :environment do |_t, args|
|
15
|
+
require "recheck/commands"
|
16
|
+
|
17
|
+
Recheck::Command::Run.new(argv: args[:args]&.split || []).run
|
18
|
+
end
|
19
|
+
end
|
data/lib/recheck/version.rb
CHANGED
data/license.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Copyright (c) Recheck Limited Worker Cooperative Association
|
2
|
+
|
3
|
+
Recheck is an Open Source project licensed under the terms of the LGPLv3 license.
|
4
|
+
See <http://www.gnu.org/licenses/lgpl-3.0.html> for license text.
|
5
|
+
|
6
|
+
Recheck Pro and Recheck Enterprise have a commercial-friendly license.
|
7
|
+
You can find the commercial license in COMM-LICENSE.md.
|
8
|
+
|
9
|
+
Visit https://recheck.dev for purchasing options.
|
data/readme.md
ADDED
@@ -0,0 +1,400 @@
|
|
1
|
+
Beta note:
|
2
|
+
Recheck is in __early beta__.
|
3
|
+
You should expect and report crashes, bugs, or missing features.
|
4
|
+
It is safe to try out because, by design, it does not write to your database.
|
5
|
+
|
6
|
+
Please don't submit Recheck to Lobsters/Reddit/Hacker News/etc. yet,
|
7
|
+
I'd really like it to exercise it and reach 1.0 first.
|
8
|
+
|
9
|
+
# Recheck
|
10
|
+
|
11
|
+
Recheck is a tool for checking the correctness of production data, inspired by an internal tool at Stripe.
|
12
|
+
|
13
|
+
Have you ever pulled a record out of your database and been surprised to find it's not valid?
|
14
|
+
|
15
|
+
Order.find(123).valid?
|
16
|
+
=> false
|
17
|
+
|
18
|
+
Huh!?
|
19
|
+
|
20
|
+
You've probably seen this sort of problem, where production data is inconsistent or "impossible".
|
21
|
+
Not every row, but one in a few hundred thousand or a few million.
|
22
|
+
When you have a background job, hit a third-party API, or have a state machine that measures transition in days,
|
23
|
+
you sometimes get these bad records where there's a few `NULL`s where there shouldn't be,
|
24
|
+
a couple fields on a record contradict each other, or associated records are missing.
|
25
|
+
|
26
|
+
**It's not your codebase. This happens in every database at scale.**
|
27
|
+
|
28
|
+
In theory no background job would crash at 3 AM halfway through its run and every business rule would have perfectly reliable SQL constraints.
|
29
|
+
But the cost of perfection is very high, perhaps infinitely high.
|
30
|
+
|
31
|
+
**Recheck is the missing tool for pragmatically addressing data integrity.**
|
32
|
+
|
33
|
+
When you see a user report or an exception, you have to query to see if there's more bad data.
|
34
|
+
With Recheck you wrap up that query in a "check", a small bit of code like a unit test for your production data.
|
35
|
+
Out of the box it can detect and use your model validations, but the real value is in writing your own checks as you implement code or investigate bugs.
|
36
|
+
You can manually run your checks, or stand up a Recheck service to run them continuously in the background.
|
37
|
+
|
38
|
+
It's worth writing a check any time you have:
|
39
|
+
|
40
|
+
- A background job that edits or adds records
|
41
|
+
- A null is replaced by a third-party API call
|
42
|
+
- A painful bug you don't want to see again
|
43
|
+
- A slow state machine
|
44
|
+
- Any technical or business rule logic that is difficult to write a db constraint for
|
45
|
+
|
46
|
+
(Not using Ruby? Sign up to [get notified](https://recheck.dev) when Recheck is available in more languages.)
|
47
|
+
|
48
|
+
|
49
|
+
## Install and Configure
|
50
|
+
|
51
|
+
Add Recheck to your `Gemfile`:
|
52
|
+
|
53
|
+
gem "recheck"
|
54
|
+
|
55
|
+
Recheck runs against production data, so don't put it only in a `development` or `test` group like a testing tool.
|
56
|
+
|
57
|
+
Generate basic checks:
|
58
|
+
|
59
|
+
# if you're using Rails, run:
|
60
|
+
|
61
|
+
$ bundle exec rails recheck:setup
|
62
|
+
creating recheck/
|
63
|
+
generating recheck/recheck_helper.rb
|
64
|
+
creating recheck/site/domain_checker.rb
|
65
|
+
creating recheck/site/tls_checker.rb
|
66
|
+
detected ActiveRecord models, creating recheck/model/
|
67
|
+
app/models/comment.rb -> recheck/model/comment_checker.rb
|
68
|
+
app/models/story.rb -> recheck/model/story_checker.rb
|
69
|
+
app/models/user.rb -> recheck/model/user_checker.rb
|
70
|
+
detected ActiveJob jobs, creating recheck/job/
|
71
|
+
app/jobs/user_cleanup_job.rb -> recheck/job/user_cleanup_checker.rb
|
72
|
+
detected Sidekiq workers, creating recheck/worker/
|
73
|
+
app/workers/refresh.rb -> recheck/worker/refresh_checker.rb
|
74
|
+
|
75
|
+
|
76
|
+
# if you're not using Rails, run:
|
77
|
+
|
78
|
+
$ bundle exec recheck setup
|
79
|
+
[you'll get shorter but pretty similar output]
|
80
|
+
|
81
|
+
Run `git add --all` and `git commit` to record a baseline because you'll probably edit them in a minute.
|
82
|
+
|
83
|
+
**You should immediately run these default checks to start finding bad data.**
|
84
|
+
|
85
|
+
|
86
|
+
## Run Your Checks
|
87
|
+
|
88
|
+
Keep in mind: This runs against _production_ and will usually run full table scans.
|
89
|
+
If you have a huge amount of data this could be a lot of I/O.
|
90
|
+
If you're large enough to have an OLAP/data warehouse, consult with your data team about running against that instead of your OLTP.
|
91
|
+
|
92
|
+
Run your checks:
|
93
|
+
|
94
|
+
$ bundle exec recheck
|
95
|
+
CommentChecker ... 2,442 pass 0 fail
|
96
|
+
StoryChecker .. 1,196 pass 0 fail
|
97
|
+
UserChecker ..x. 3,501 pass 3 fail
|
98
|
+
Completed in 28 seconds
|
99
|
+
|
100
|
+
Each `.` is a set of 1,000 records passing, each `x` is a set with at least one failure.
|
101
|
+
The exit code is `0` when all checks pass,
|
102
|
+
`1` when any checks fail, or
|
103
|
+
`2` when any checks error out (takes precedence).
|
104
|
+
|
105
|
+
A failure looks like:
|
106
|
+
|
107
|
+
$ bundle exec recheck recheck/model/user_checker.rb
|
108
|
+
UserChecker ...x. 3,501 pass, 3 fail
|
109
|
+
|
110
|
+
Failures:
|
111
|
+
UserLoginChecker#check_users_are_synced_to_ldap recheck/model/user_checker.rb:46
|
112
|
+
2342
|
113
|
+
UserLoginChecker#Bug1422 recheck/model/user_checker.rb:105
|
114
|
+
1755
|
115
|
+
2342
|
116
|
+
|
117
|
+
By default `recheck` only prints to the command line, but you can write `Reporter`s to notify teams by email/slack/issue tracker in regular use.
|
118
|
+
|
119
|
+
You can run subsets of checks by filename or line number:
|
120
|
+
|
121
|
+
$ recheck recheck/job
|
122
|
+
$ recheck recheck/job/user* recheck/doc_store/integration_checker.rb
|
123
|
+
$ recheck recheck/model/user_checker.rb
|
124
|
+
$ recheck recheck/model/user_checker.rb:46
|
125
|
+
|
126
|
+
When you have a lot of data and checks take more than a few minutes to run, Recheck will recommend changing strategies,
|
127
|
+
for example to check all recent records but sample randomly from older data that's less likely to have new errors.
|
128
|
+
The schedulers and strategies appropriate for millions of records and gigabytes of data are available in [Recheck Pro](https://recheck.dev/pro), along with a nice web interface.
|
129
|
+
|
130
|
+
|
131
|
+
## Write Checks
|
132
|
+
|
133
|
+
A `Checker` is a class that groups queries and related checks, a `check` is an individual method that checks a single record.
|
134
|
+
Group your checks by query, team, or purpose.
|
135
|
+
The runner only looks for methods named `query` and `check_`, so you can use delegation, modules, and inheritance (as long as inheritance eventually reaches `Recheck::Checker::Base`) as you like to organize your checks.
|
136
|
+
|
137
|
+
|
138
|
+
Here's a short example:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
class UserContactChecker < Recheck::Checker::Base
|
142
|
+
# Query for records to check:
|
143
|
+
def query
|
144
|
+
# Watching for Bug #556, which left some users without shipping/contact info
|
145
|
+
# if the user edited their profile while the daily sync job was running.
|
146
|
+
User.where(email: nil)
|
147
|
+
.left_outer_joins(:mailing_addresses, :phone_numbers)
|
148
|
+
.where(mailing_addresses: { id: nil })
|
149
|
+
.where(phone_numbers: { id: nil })
|
150
|
+
.distinct
|
151
|
+
end
|
152
|
+
|
153
|
+
# The simplest possible check would be to consider every queried record bad.
|
154
|
+
# This is standard when you're checking for a particular, well-defined bug.
|
155
|
+
def check_bad_data_exists(_)= false
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
159
|
+
Here's a longer example, showing the 4 hooks available:
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
# recheck/models/user_logins_checker.rb
|
163
|
+
# Checkers must inherit from Recheck::Checker::Base to be registered to run.
|
164
|
+
class UserLoginsChecker < Recheck::Checker::Base
|
165
|
+
|
166
|
+
# Hook 1: initialize (optional)
|
167
|
+
# Runs once to prepare a shared resource for the checks to use:
|
168
|
+
def intitialize
|
169
|
+
@ldap = Net::LDAP.new({ host: "example.com", port: 389, auth: LDAP_CREDENTIALS })
|
170
|
+
end
|
171
|
+
|
172
|
+
# Hook 2: query* (required)
|
173
|
+
# Your query might be very simple, like checking all records.
|
174
|
+
# You can have multiple query methods; all records are run against all checks.
|
175
|
+
# You can return any Enumerable.
|
176
|
+
def query_all
|
177
|
+
User.all.include(:avatar).find_each
|
178
|
+
end
|
179
|
+
|
180
|
+
# Hook 3: check* (optional)
|
181
|
+
# Each check inspects a single record, the name must start with "check".
|
182
|
+
#
|
183
|
+
# While it would be nice to always be able to query out bad data,
|
184
|
+
# sometimes it's easier to express "bad" in code, or you have to
|
185
|
+
# integrate with other data sources.
|
186
|
+
#
|
187
|
+
# A check is a function that receives a single record and returns
|
188
|
+
# false or nil for a failing record; anything else is a pass.
|
189
|
+
def check_users_are_synced_to_ldap(user)
|
190
|
+
# ldap syncs every minute so pass very recently changed users:
|
191
|
+
return true if user.updated_at >= 1.minute.ago
|
192
|
+
|
193
|
+
count = @ldap.search({
|
194
|
+
base: "dc=example, dc=com",
|
195
|
+
filter: Net::LDAP::Filter.eq("mail", User.email),
|
196
|
+
return_result: false
|
197
|
+
}).size
|
198
|
+
|
199
|
+
# user appears in ldap exactly once, right?
|
200
|
+
return count == 1
|
201
|
+
end
|
202
|
+
|
203
|
+
# You can define many checks for your records:
|
204
|
+
def check_user_has_avatar_on_s3(user)
|
205
|
+
# ...
|
206
|
+
end
|
207
|
+
|
208
|
+
# That's all you need to implement a checker, but you can have any other
|
209
|
+
# methods or attributes you want. This is mostly useful for metadata for
|
210
|
+
# Reporters, so remember this method for the next section.
|
211
|
+
def team= :security
|
212
|
+
end
|
213
|
+
|
214
|
+
Some tips for writing checks:
|
215
|
+
|
216
|
+
* Checkers are cheap. Don't be shy about splitting up your checkers by team or function.
|
217
|
+
Recheck looks for any file `recheck/**/*_checker.rb` or you can give any path on the command line.
|
218
|
+
* Generally you want checks to avoid side effects because you can't control their scheduling,
|
219
|
+
but if you can automatically fix up your data, go for it.
|
220
|
+
Recheck is a pragmatic tool for keeping your data healthy.
|
221
|
+
* It's great to include detailed comments with links in your checkers so that when they alert
|
222
|
+
to give a running start on context for the people dealing with the alert.
|
223
|
+
Maybe a [runbook](https://www.pagerduty.com/resources/learn/what-is-a-runbook/)?
|
224
|
+
|
225
|
+
|
226
|
+
## Reporters
|
227
|
+
|
228
|
+
Reporters are how you turn failing checks into emails, bug tracker tickets, or any other useful notification or report.
|
229
|
+
You can notify different teams however they most "enjoy" hearing about bad data.
|
230
|
+
|
231
|
+
When you run your check suite you can name reporters to use:
|
232
|
+
|
233
|
+
recheck run --reporter Json recheck/validation/user.rb | jq -R -r "fromjson?"
|
234
|
+
{
|
235
|
+
"UserValidationChecker": {
|
236
|
+
"check_no_invalid_records_found": {
|
237
|
+
"counts": {
|
238
|
+
"counts": {
|
239
|
+
"pass": 0,
|
240
|
+
"fail": 0,
|
241
|
+
"exception": 0,
|
242
|
+
"blanket": 0,
|
243
|
+
"no_query_methods": 0,
|
244
|
+
"no_queries": 0,
|
245
|
+
"no_check_methods": 0,
|
246
|
+
"no_checks": 0
|
247
|
+
},
|
248
|
+
"queries": 0
|
249
|
+
},
|
250
|
+
"fail": [],
|
251
|
+
"exception": []
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
Notice this doesn't show the usual terminal output?
|
257
|
+
That's printed by `Recheck::Reporter::Default`, which recheck only includes if you don't name any reporters in your command.
|
258
|
+
|
259
|
+
When you `recheck run`, you can give the full namespace to a class like `--reporter Recheck::Reporter::Json` but it searches in `Recheck::Reporter` for the convenience of saying `--reporter Json`.
|
260
|
+
|
261
|
+
Reporters are even easier to write than checker classes:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
# recheck/reporter/email_team_reporter.rb
|
265
|
+
# Checkers must inherit from Recheck::Reporter::Base to be registered as available.
|
266
|
+
class EmailTeamReporter < Recheck::Reporter::Base
|
267
|
+
# Optional: appears in `recheck reporters`.
|
268
|
+
def self.help
|
269
|
+
end
|
270
|
+
|
271
|
+
# Required: receives the arg from the command line.
|
272
|
+
# raise ArgumentError for any problem with arg
|
273
|
+
def initialize(arg:)
|
274
|
+
@team_lookup = TeamLookupService.new(api_key: arg)
|
275
|
+
rescue InvalidApiKey
|
276
|
+
raise ArgumentError, "API key not accepted for team lookup"
|
277
|
+
end
|
278
|
+
|
279
|
+
# There are four hooks, all optional:
|
280
|
+
# around_run: fires around the entire run
|
281
|
+
# around_query: fires around each query
|
282
|
+
# around_checker: fires around each checker
|
283
|
+
# around_check: fires for each call to a check_ of each record
|
284
|
+
|
285
|
+
# Important warning: all your hooks _must_ yield to run the next part of the suite.
|
286
|
+
|
287
|
+
def around_run(checkers:)
|
288
|
+
total_counts = yield
|
289
|
+
|
290
|
+
Email.new({
|
291
|
+
to: @team_lookup.find(:ops),
|
292
|
+
subject: "check run completed",
|
293
|
+
body: "results: #{total_counts.inspect}"
|
294
|
+
}).send_now!
|
295
|
+
end
|
296
|
+
|
297
|
+
# This Reporter doesn't need a around_checker or around_query,
|
298
|
+
# so it doesn't define them.
|
299
|
+
|
300
|
+
def around_check(checker:, query:, check:)
|
301
|
+
result = yield
|
302
|
+
|
303
|
+
if result.is_a? Recheck::Error
|
304
|
+
Email.new({
|
305
|
+
# Remember defining .team in the checker example above?
|
306
|
+
to: @team_lookup.find(checker.team),
|
307
|
+
subject: "failing check",
|
308
|
+
body: result.inspect
|
309
|
+
}).send_now!
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
```
|
314
|
+
|
315
|
+
To pass the API key as the reporter's arg:
|
316
|
+
|
317
|
+
bundle exec recheck --reporter EmailTeamReporter:api_key_123abc
|
318
|
+
|
319
|
+
A reporter takes a single string `arg` after a `:`, which is deliberately simple to avoid the creeping horror of shell parsing.
|
320
|
+
|
321
|
+
If you need to pass complex options or run from a job, you can script it:
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
require "recheck"
|
325
|
+
|
326
|
+
# load reporters and checkers from this project and elsewhere
|
327
|
+
Dir.glob([
|
328
|
+
"recheck/check/**/*.rb",
|
329
|
+
"/path/to/shared/checks/**/*.rb",
|
330
|
+
"recheck/reporter/**/*.rb"
|
331
|
+
]).each do |file|
|
332
|
+
require_relative file
|
333
|
+
end
|
334
|
+
|
335
|
+
# you can instantiate your checkers and reporters with additional config
|
336
|
+
Recheck::Runner.new(
|
337
|
+
checkers: [
|
338
|
+
UserChecker.new(role: :admin),
|
339
|
+
UserChecker.new(role: :customer_suport),
|
340
|
+
SecurityChecker.new
|
341
|
+
],
|
342
|
+
reporters: [
|
343
|
+
SlackReporter.new(channels: [:security, :ops].merge(ARGV.map(&:to_sym))
|
344
|
+
]
|
345
|
+
)
|
346
|
+
```
|
347
|
+
|
348
|
+
Run `recheck reporters` to list your loaded reporters.
|
349
|
+
|
350
|
+
Read [the reporters that ship with Recheck](lib/recheck/reporters.rb) for more ideas.
|
351
|
+
|
352
|
+
|
353
|
+
## Production
|
354
|
+
|
355
|
+
When you have your check suite and reporters, it's time to run them in production.
|
356
|
+
|
357
|
+
You could run `bundle exec recheck recheck/job/* recheck/model/user_checker.rb --reporter ... --reporter ...` and so on manually,
|
358
|
+
but Recheck's real value comes when you schedule it to run automatically.
|
359
|
+
Start with running all your checks daily and then specialize into running subsets more or less frequently as you gain confidence and build out a big suite.
|
360
|
+
|
361
|
+
|
362
|
+
Recheck is free for personal and commercial use,
|
363
|
+
but pretty much all non-trivial commercial systems would benefit by upgrading to [Recheck Pro](https://recheck.dev/pro).
|
364
|
+
It comes with an admin panel to track issues over time, silence flaky or low-priority checks, and more:
|
365
|
+
|
366
|
+
[admin screenshot TK]
|
367
|
+
|
368
|
+
The admin panel also handles running your checks continuously in the background.
|
369
|
+
|
370
|
+
Recheck Pro also includes sophisticated strategies to catch issues ASAP while minimizing database load.
|
371
|
+
For example, if you add the line `schedule Recheck::Pro::RecentlyUpdated`, it will:
|
372
|
+
|
373
|
+
- every minute, run checks against records edited in the last hour
|
374
|
+
- every hour, run checks against records edited in the last day
|
375
|
+
- every day, run checks against records edited in the last 30 days
|
376
|
+
- every day, run checks against 1% of records edited more than 30 days ago,
|
377
|
+
but back off and warn if the database is responding slowly
|
378
|
+
|
379
|
+
See the [full docs](https://recheck.dev/doc) for more.
|
380
|
+
|
381
|
+
|
382
|
+
## Contributing
|
383
|
+
|
384
|
+
Bug reports, feature requests, and pull requests are welcome on GitHub at: https://github.com/recheckdev/recheck
|
385
|
+
|
386
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
387
|
+
Then, run `rake test` to run the tests.
|
388
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
389
|
+
|
390
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
391
|
+
Please don't bump the version number in PRs; I'll handle releases.
|
392
|
+
|
393
|
+
|
394
|
+
## License
|
395
|
+
|
396
|
+
Recheck is an open core product.
|
397
|
+
See [license.md](https://github.com/recheckdev/recheck/blob/main/ruby/recheck/license.md) for terms of the freely available license.
|
398
|
+
|
399
|
+
The license for Recheck Pro can be found in [comm-license.md](https://github.com/recheckdev/recheck/blob/main/ruby/recheck/comm-license.md).
|
400
|
+
Purchase at [Recheck.dev](https://recheck.dev).
|
data/recheck.gemspec
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/recheck/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "recheck"
|
7
|
+
spec.version = Recheck::VERSION
|
8
|
+
spec.authors = ["Peter Bhat Harkins"]
|
9
|
+
spec.email = ["peter@recheck.coop"]
|
10
|
+
|
11
|
+
spec.summary = "Recheck your production data integrity"
|
12
|
+
spec.description = "Check on validations, background jobs, third-party integrations, state machines, and business rules"
|
13
|
+
spec.homepage = "https://recheck.dev"
|
14
|
+
spec.license = "LGPL-3.0"
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/recheckdev/recheck/ruby/recheck"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/recheckdev/recheck/ruby/recheck/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`jj file list .`.split.reject do |f|
|
24
|
+
(File.expand_path(f) == __FILE__) ||
|
25
|
+
f.start_with?(*%w[
|
26
|
+
.
|
27
|
+
bin/
|
28
|
+
build/
|
29
|
+
Gemfile
|
30
|
+
Rakefile
|
31
|
+
test/
|
32
|
+
])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
spec.bindir = "exe"
|
37
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
# runtime dependencies here
|
41
|
+
spec.add_dependency "resolv"
|
42
|
+
spec.add_dependency "whois", "~> 5.1"
|
43
|
+
spec.add_dependency "whois-parser"
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../recheck_helper'
|
2
|
+
|
3
|
+
class <%= class_name %>Checker < Recheck::Checker::Base
|
4
|
+
def query_all
|
5
|
+
<%= class_name %><%= pk_info.query_method %>
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_valid(record)
|
9
|
+
record.valid?
|
10
|
+
end
|
11
|
+
|
12
|
+
# Write more-specific checks for your model here.
|
13
|
+
#
|
14
|
+
# Best practice: If you can query() narrowly for bad data (like for a bug you
|
15
|
+
# are investigating or worry might recur), add a new Checker for it.
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative '<%= "../" * depth %>recheck_helper'
|
2
|
+
|
3
|
+
# Generated <%= Date.today.iso8601 %> for <%= model_root_filename %>
|
4
|
+
|
5
|
+
class <%= class_name %>ValidationChecker < Recheck::Checker::Base
|
6
|
+
<% queries.each do |query| %>
|
7
|
+
# <%= query.inspect -%>
|
8
|
+
<%
|
9
|
+
case query
|
10
|
+
when Placeholder %>
|
11
|
+
# <%= query.comment -%>
|
12
|
+
<%
|
13
|
+
when FunctionPlaceholder
|
14
|
+
%>
|
15
|
+
def <%= query.name %>
|
16
|
+
# <%= query.comment %>
|
17
|
+
end
|
18
|
+
<%
|
19
|
+
when Query
|
20
|
+
%><%= query.warning ? "# #{query.warning}" : "" %>
|
21
|
+
def <%= query.name %>
|
22
|
+
<%= query.comment ? "# #{query.comment}" : "" %>
|
23
|
+
<%= class_name %>.where(<%= query.or_clauses.first %>)<%= (query.or_clauses.drop(1).map {".or(#{class_name}.where(#{it}))"}).join("") %>.find_each
|
24
|
+
end
|
25
|
+
<%
|
26
|
+
end
|
27
|
+
end %>
|
28
|
+
|
29
|
+
# these queries only find records that don't pass validation so the check always fails
|
30
|
+
def check_no_invalid_records_found(_)
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Bhat Harkins
|
@@ -60,6 +60,8 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- changelog.md
|
64
|
+
- comm-license.md
|
63
65
|
- exe/recheck
|
64
66
|
- lib/recheck.rb
|
65
67
|
- lib/recheck/checkers.rb
|
@@ -69,17 +71,25 @@ files:
|
|
69
71
|
- lib/recheck/rails/railtie.rb
|
70
72
|
- lib/recheck/rails/setup.rb
|
71
73
|
- lib/recheck/rails/validation.rb
|
74
|
+
- lib/recheck/rails/version.rb
|
72
75
|
- lib/recheck/reporters.rb
|
73
76
|
- lib/recheck/results.rb
|
74
77
|
- lib/recheck/runner.rb
|
78
|
+
- lib/recheck/tasks/recheck_tasks.rake
|
75
79
|
- lib/recheck/vendor/optimist.rb
|
76
80
|
- lib/recheck/version.rb
|
81
|
+
- license.md
|
82
|
+
- readme.md
|
83
|
+
- recheck.gemspec
|
84
|
+
- template/active_record_model_check.rb.erb
|
85
|
+
- template/application_record_check.rb.erb
|
77
86
|
- template/recheck_helper.rb
|
78
87
|
- template/regression_checker_sample.rb
|
79
88
|
- template/reporter_sample.rb
|
80
89
|
- template/site/dns_checker.rb
|
81
90
|
- template/site/tls_checker.rb
|
82
91
|
- template/site/whois_checker.rb
|
92
|
+
- template/validation_checker.rb.erb
|
83
93
|
homepage: https://recheck.dev
|
84
94
|
licenses:
|
85
95
|
- LGPL-3.0
|
@@ -101,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
111
|
- !ruby/object:Gem::Version
|
102
112
|
version: '0'
|
103
113
|
requirements: []
|
104
|
-
rubygems_version: 3.6.
|
114
|
+
rubygems_version: 3.6.9
|
105
115
|
specification_version: 4
|
106
116
|
summary: Recheck your production data integrity
|
107
117
|
test_files: []
|