standard-faker 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +57 -0
- data/config/base.yml +450 -0
- data/lib/standard/faker/load_rubocop_faker_without_the_monkey_patch.rb +23 -0
- data/lib/standard/faker/plugin.rb +64 -0
- data/lib/standard/faker/version.rb +7 -0
- data/lib/standard/faker.rb +4 -0
- data/lib/standard_faker.rb +1 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5f25adfef09b4354b979a12be0fd102d28729161c1c97ed1bb0aa089487ba27
|
4
|
+
data.tar.gz: 8db7ddb6cfe399ae89089dd5d474101fce6dfad3104c5562797a848389d8fabb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98346d31d275b8762c62c6404a46ad6b262694bc5cacdb2a820c4b4d379b133d4160d010ddaaa39590a28035c35536a970a3f66dc375c80490b145f950765406
|
7
|
+
data.tar.gz: 4661edccb69a596c1a1d38f9e1e41212c145513e96bf4e5d918ac66822d555c58e7d8cf5d7192f6e7796daa8e8b25655851e0aaf798c2f178c02330e06d81577
|
data/.DS_Store
ADDED
Binary file
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 shilin-anton
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Standard::Faker
|
2
|
+
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
4
|
+
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/standard/faker`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
+
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
+
|
17
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/standard-faker.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubocop-faker"
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.libs << "lib"
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
task :copy_rubocop_faker_entry_point_and_comment_out_monkey_patch do
|
14
|
+
puts Gem.loaded_specs.keys
|
15
|
+
gem_spec = Gem.loaded_specs["rubocop-faker"]
|
16
|
+
gem_require_path = Pathname.new(gem_spec.full_require_paths.first)
|
17
|
+
entry_point_contents = File.read(gem_require_path.join("rubocop-faker.rb"))
|
18
|
+
already_printed_load_path_veriable = false
|
19
|
+
entry_point_without_monkey_patch = entry_point_contents.split("\n").map { |line|
|
20
|
+
if line.include?("Inject.defaults!") || line.include?("faker/inject")
|
21
|
+
line.prepend("# ")
|
22
|
+
elsif line.include?("require_relative")
|
23
|
+
relative_path = line.match(/require_relative ['"](.*)['"]/)[1]
|
24
|
+
|
25
|
+
if !already_printed_load_path_veriable
|
26
|
+
already_printed_load_path_veriable = true
|
27
|
+
[
|
28
|
+
"require_path = Pathname.new(Gem.loaded_specs[\"rubocop-faker\"].full_require_paths.first)",
|
29
|
+
"require require_path.join(#{relative_path.inspect})"
|
30
|
+
]
|
31
|
+
else
|
32
|
+
"require require_path.join(#{relative_path.inspect})"
|
33
|
+
end
|
34
|
+
else
|
35
|
+
line
|
36
|
+
end
|
37
|
+
}.flatten.join("\n")
|
38
|
+
|
39
|
+
File.write "lib/standard/faker/load_rubocop_faker_without_the_monkey_patch.rb", <<~RUBY
|
40
|
+
# GENERATED FILE - DO NOT EDIT
|
41
|
+
#
|
42
|
+
# This file should look just like: https://github.com/koic/rubocop-faker/blob/master/lib/rubocop-faker.rb
|
43
|
+
# Except without the `Inject.defaults!` monkey patching.
|
44
|
+
#
|
45
|
+
# Because there are both necessary require statements and additional patching
|
46
|
+
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
47
|
+
# in rubocop-faker and keep it up to date.
|
48
|
+
#
|
49
|
+
# Last updated from #{gem_spec.name} v#{gem_spec.version}
|
50
|
+
|
51
|
+
#{entry_point_without_monkey_patch}
|
52
|
+
RUBY
|
53
|
+
end
|
54
|
+
|
55
|
+
require "standard/rake"
|
56
|
+
|
57
|
+
task default: %i[copy_rubocop_faker_entry_point_and_comment_out_monkey_patch standard:fix test]
|
data/config/base.yml
ADDED
@@ -0,0 +1,450 @@
|
|
1
|
+
# This is the default configuration file.
|
2
|
+
|
3
|
+
Faker/DeprecatedArguments:
|
4
|
+
Description: 'Checks that Faker arguments style is based on Faker 2.'
|
5
|
+
Enabled: true
|
6
|
+
VersionAdded: '0.1'
|
7
|
+
Reference: 'https://github.com/faker-ruby/faker/blob/master/CHANGELOG.md#v20-2019-31-07'
|
8
|
+
ArgumentKeywords:
|
9
|
+
#
|
10
|
+
# FakerClassName:
|
11
|
+
# method_name:
|
12
|
+
# - keyword_name_for_first_argument
|
13
|
+
# - keyword_name_for_second_argument
|
14
|
+
# - keyword_name_for_third_argument
|
15
|
+
#
|
16
|
+
Faker::Dune:
|
17
|
+
quote:
|
18
|
+
- character
|
19
|
+
saying:
|
20
|
+
- source
|
21
|
+
Faker::Books::Lovecraft:
|
22
|
+
fhtagn:
|
23
|
+
- number
|
24
|
+
sentence:
|
25
|
+
- word_count
|
26
|
+
- random_words_to_add
|
27
|
+
words:
|
28
|
+
- number
|
29
|
+
- spaces_allowed
|
30
|
+
sentences:
|
31
|
+
- number
|
32
|
+
paragraph:
|
33
|
+
- sentence_count
|
34
|
+
- random_sentences_to_add
|
35
|
+
paragraphs:
|
36
|
+
- number
|
37
|
+
paragraph_by_chars:
|
38
|
+
- characters
|
39
|
+
Faker::Address:
|
40
|
+
city:
|
41
|
+
- options
|
42
|
+
street_address:
|
43
|
+
- include_secondary
|
44
|
+
zip_code:
|
45
|
+
- state_abbreviation
|
46
|
+
country_by_code:
|
47
|
+
- code
|
48
|
+
country_name_to_code:
|
49
|
+
- name
|
50
|
+
Faker::Alphanumeric:
|
51
|
+
alpha:
|
52
|
+
- number
|
53
|
+
alphanumeric:
|
54
|
+
- number
|
55
|
+
Faker::App:
|
56
|
+
semantic_version:
|
57
|
+
- major
|
58
|
+
- minor
|
59
|
+
- patch
|
60
|
+
Faker::Avatar:
|
61
|
+
image:
|
62
|
+
- slug
|
63
|
+
- size
|
64
|
+
- format
|
65
|
+
- set
|
66
|
+
- bgset
|
67
|
+
Faker::Bank:
|
68
|
+
account_number:
|
69
|
+
- digits
|
70
|
+
iban:
|
71
|
+
- country_code
|
72
|
+
Faker::Boolean:
|
73
|
+
boolean:
|
74
|
+
- true_ratio
|
75
|
+
Faker::ChileRut:
|
76
|
+
rut:
|
77
|
+
- min_rut
|
78
|
+
- fixed
|
79
|
+
full_rut:
|
80
|
+
- min_rut
|
81
|
+
- fixed
|
82
|
+
Faker::Code:
|
83
|
+
isbn:
|
84
|
+
- base
|
85
|
+
ean:
|
86
|
+
- base
|
87
|
+
nric:
|
88
|
+
- min_age
|
89
|
+
- max_age
|
90
|
+
Faker::Commerce:
|
91
|
+
promotion_code:
|
92
|
+
- digits
|
93
|
+
department:
|
94
|
+
- max
|
95
|
+
- fixed_amount
|
96
|
+
price:
|
97
|
+
- range
|
98
|
+
- as_string
|
99
|
+
Faker::Company:
|
100
|
+
polish_register_of_national_economy:
|
101
|
+
- length
|
102
|
+
brazilian_company_number:
|
103
|
+
- formatted
|
104
|
+
Faker::CryptoCoin:
|
105
|
+
coin_name:
|
106
|
+
- coin
|
107
|
+
acronym:
|
108
|
+
- coin
|
109
|
+
url_logo:
|
110
|
+
- coin
|
111
|
+
Faker::Date:
|
112
|
+
between:
|
113
|
+
- from
|
114
|
+
- to
|
115
|
+
between_except:
|
116
|
+
- from
|
117
|
+
- to
|
118
|
+
- excepted
|
119
|
+
forward:
|
120
|
+
- days
|
121
|
+
backward:
|
122
|
+
- days
|
123
|
+
birthday:
|
124
|
+
- min_age
|
125
|
+
- max_age
|
126
|
+
Faker::Demographic:
|
127
|
+
height:
|
128
|
+
- unit
|
129
|
+
Faker::DrivingLicence:
|
130
|
+
british_driving_licence:
|
131
|
+
- last_name
|
132
|
+
- initials
|
133
|
+
- gender
|
134
|
+
- date_of_birth
|
135
|
+
Faker::File:
|
136
|
+
dir:
|
137
|
+
- segment_count
|
138
|
+
- root
|
139
|
+
- directory_separator
|
140
|
+
file_name:
|
141
|
+
- dir
|
142
|
+
- name
|
143
|
+
- ext
|
144
|
+
- directory_separator
|
145
|
+
Faker::Fillmurray:
|
146
|
+
image:
|
147
|
+
- grayscale
|
148
|
+
- width
|
149
|
+
- height
|
150
|
+
Faker::Finance:
|
151
|
+
vat_number:
|
152
|
+
- country
|
153
|
+
Faker::Hipster:
|
154
|
+
words:
|
155
|
+
- number
|
156
|
+
- supplemental
|
157
|
+
- spaces_allowed
|
158
|
+
sentence:
|
159
|
+
- word_count
|
160
|
+
- supplemental
|
161
|
+
- random_words_to_add
|
162
|
+
sentences:
|
163
|
+
- number
|
164
|
+
- supplemental
|
165
|
+
paragraph:
|
166
|
+
- sentence_count
|
167
|
+
- supplemental
|
168
|
+
- random_sentences_to_add
|
169
|
+
paragraphs:
|
170
|
+
- number
|
171
|
+
- supplemental
|
172
|
+
paragraph_by_chars:
|
173
|
+
- characters
|
174
|
+
- supplemental
|
175
|
+
Faker::IDNumber:
|
176
|
+
brazilian_citizen_number:
|
177
|
+
- formatted
|
178
|
+
brazilian_id:
|
179
|
+
- formatted
|
180
|
+
Faker::Internet:
|
181
|
+
email:
|
182
|
+
- name
|
183
|
+
- separators
|
184
|
+
free_email:
|
185
|
+
- name
|
186
|
+
safe_email:
|
187
|
+
- name
|
188
|
+
username:
|
189
|
+
- specifier
|
190
|
+
- separators
|
191
|
+
password:
|
192
|
+
- min_length
|
193
|
+
- max_length
|
194
|
+
- mix_case
|
195
|
+
- special_characters
|
196
|
+
domain_name:
|
197
|
+
- subdomain
|
198
|
+
fix_umlauts:
|
199
|
+
- string
|
200
|
+
mac_address:
|
201
|
+
- prefix
|
202
|
+
url:
|
203
|
+
- host
|
204
|
+
- path
|
205
|
+
- scheme
|
206
|
+
slug:
|
207
|
+
- words
|
208
|
+
- glue
|
209
|
+
user_agent:
|
210
|
+
- vendor
|
211
|
+
Faker::Invoice:
|
212
|
+
amount_between:
|
213
|
+
- from
|
214
|
+
- to
|
215
|
+
creditor_reference:
|
216
|
+
- ref
|
217
|
+
reference:
|
218
|
+
- ref
|
219
|
+
Faker::Json:
|
220
|
+
shallow_json:
|
221
|
+
- width
|
222
|
+
- options
|
223
|
+
add_depth_to_json:
|
224
|
+
- json
|
225
|
+
- width
|
226
|
+
- options
|
227
|
+
Faker::Lorem:
|
228
|
+
words:
|
229
|
+
- number
|
230
|
+
- supplemental
|
231
|
+
characters:
|
232
|
+
- number
|
233
|
+
sentence:
|
234
|
+
- word_count
|
235
|
+
- supplemental
|
236
|
+
- random_words_to_add
|
237
|
+
sentences:
|
238
|
+
- number
|
239
|
+
- supplemental
|
240
|
+
paragraph:
|
241
|
+
- sentence_count
|
242
|
+
- supplemental
|
243
|
+
- random_sentences_to_add
|
244
|
+
paragraphs:
|
245
|
+
- number
|
246
|
+
- supplemental
|
247
|
+
paragraph_by_chars:
|
248
|
+
- number
|
249
|
+
- supplemental
|
250
|
+
question:
|
251
|
+
- word_count
|
252
|
+
- supplemental
|
253
|
+
- random_words_to_add
|
254
|
+
questions:
|
255
|
+
- number
|
256
|
+
- supplemental
|
257
|
+
Faker::LoremFlickr:
|
258
|
+
image:
|
259
|
+
- size
|
260
|
+
- search_terms
|
261
|
+
- match_all
|
262
|
+
grayscale_image:
|
263
|
+
- size
|
264
|
+
- search_terms
|
265
|
+
- match_all
|
266
|
+
pixelated_image:
|
267
|
+
- size
|
268
|
+
- search_terms
|
269
|
+
- match_all
|
270
|
+
colorized_image:
|
271
|
+
- size
|
272
|
+
- color
|
273
|
+
- search_terms
|
274
|
+
- match_all
|
275
|
+
Faker::LoremPixel:
|
276
|
+
image:
|
277
|
+
- size
|
278
|
+
- is_gray
|
279
|
+
- category
|
280
|
+
- number
|
281
|
+
- text
|
282
|
+
- secure
|
283
|
+
Faker::Markdown:
|
284
|
+
sandwich:
|
285
|
+
- sentences
|
286
|
+
- repeat
|
287
|
+
Faker::Measurement:
|
288
|
+
height:
|
289
|
+
- amount
|
290
|
+
length:
|
291
|
+
- amount
|
292
|
+
volume:
|
293
|
+
- amount
|
294
|
+
weight:
|
295
|
+
- amount
|
296
|
+
metric_height:
|
297
|
+
- amount
|
298
|
+
metric_length:
|
299
|
+
- amount
|
300
|
+
metric_volume:
|
301
|
+
- amount
|
302
|
+
metric_weight:
|
303
|
+
- amount
|
304
|
+
Faker::Name:
|
305
|
+
initials:
|
306
|
+
- number
|
307
|
+
Faker::NationalHealthService:
|
308
|
+
check_digit:
|
309
|
+
- number
|
310
|
+
Faker::Number:
|
311
|
+
number:
|
312
|
+
- digits
|
313
|
+
leading_zero_number:
|
314
|
+
- digits
|
315
|
+
decimal_part:
|
316
|
+
- digits
|
317
|
+
decimal:
|
318
|
+
- l_digits
|
319
|
+
- r_digits
|
320
|
+
hexadecimal:
|
321
|
+
- digits
|
322
|
+
normal:
|
323
|
+
- mean
|
324
|
+
- standard_deviation
|
325
|
+
between:
|
326
|
+
- from
|
327
|
+
- to
|
328
|
+
within:
|
329
|
+
- range
|
330
|
+
positive:
|
331
|
+
- from
|
332
|
+
- to
|
333
|
+
negative:
|
334
|
+
- from
|
335
|
+
- to
|
336
|
+
Faker::Omniauth:
|
337
|
+
google:
|
338
|
+
- name
|
339
|
+
- email
|
340
|
+
- uid
|
341
|
+
facebook:
|
342
|
+
- name
|
343
|
+
- email
|
344
|
+
- username
|
345
|
+
- uid
|
346
|
+
twitter:
|
347
|
+
- name
|
348
|
+
- nickname
|
349
|
+
- uid
|
350
|
+
linkedin:
|
351
|
+
- name
|
352
|
+
- email
|
353
|
+
- uid
|
354
|
+
github:
|
355
|
+
- name
|
356
|
+
- email
|
357
|
+
- uid
|
358
|
+
Faker::PhoneNumber:
|
359
|
+
subscriber_number:
|
360
|
+
- length
|
361
|
+
Faker::Placeholdit:
|
362
|
+
image:
|
363
|
+
- size
|
364
|
+
- format
|
365
|
+
- background_color
|
366
|
+
- text_color
|
367
|
+
- text
|
368
|
+
Faker::Relationship:
|
369
|
+
familial:
|
370
|
+
- connection
|
371
|
+
Faker::Source:
|
372
|
+
hello_world:
|
373
|
+
- lang
|
374
|
+
print:
|
375
|
+
- str
|
376
|
+
- lang
|
377
|
+
print_1_to_10:
|
378
|
+
- lang
|
379
|
+
Faker::String:
|
380
|
+
random:
|
381
|
+
- length
|
382
|
+
Faker::Stripe:
|
383
|
+
valid_card:
|
384
|
+
- card_type
|
385
|
+
valid_token:
|
386
|
+
- card_type
|
387
|
+
invalid_card:
|
388
|
+
- card_error
|
389
|
+
ccv:
|
390
|
+
- card_type
|
391
|
+
Faker::Time:
|
392
|
+
between:
|
393
|
+
- from
|
394
|
+
- to
|
395
|
+
- format
|
396
|
+
between_dates:
|
397
|
+
- from
|
398
|
+
- to
|
399
|
+
- period
|
400
|
+
- format
|
401
|
+
forward:
|
402
|
+
- days
|
403
|
+
- period
|
404
|
+
- format
|
405
|
+
backward:
|
406
|
+
- days
|
407
|
+
- period
|
408
|
+
- format
|
409
|
+
Faker::Twitter:
|
410
|
+
user:
|
411
|
+
- include_status
|
412
|
+
- include_email
|
413
|
+
status:
|
414
|
+
- include_user
|
415
|
+
- include_photo
|
416
|
+
status_entities:
|
417
|
+
- include_photo
|
418
|
+
Faker::Types:
|
419
|
+
rb_string:
|
420
|
+
- words
|
421
|
+
rb_integer:
|
422
|
+
- from
|
423
|
+
- to
|
424
|
+
rb_hash:
|
425
|
+
- number
|
426
|
+
- type
|
427
|
+
complex_rb_hash:
|
428
|
+
- number
|
429
|
+
rb_array:
|
430
|
+
- len
|
431
|
+
Faker::Vehicle:
|
432
|
+
model:
|
433
|
+
- make_of_model
|
434
|
+
mileage:
|
435
|
+
- min
|
436
|
+
- max
|
437
|
+
license_plate:
|
438
|
+
- state_abbreviation
|
439
|
+
Faker::WorldCup:
|
440
|
+
group:
|
441
|
+
- group
|
442
|
+
roster:
|
443
|
+
- country
|
444
|
+
- type
|
445
|
+
Faker::Dota:
|
446
|
+
quote:
|
447
|
+
- hero
|
448
|
+
Faker::Movies::StarWars:
|
449
|
+
quote:
|
450
|
+
- character
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# GENERATED FILE - DO NOT EDIT
|
2
|
+
#
|
3
|
+
# This file should look just like: https://github.com/koic/rubocop-faker/blob/master/lib/rubocop-faker.rb
|
4
|
+
# Except without the `Inject.defaults!` monkey patching.
|
5
|
+
#
|
6
|
+
# Because there are both necessary require statements and additional patching
|
7
|
+
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
8
|
+
# in rubocop-faker and keep it up to date.
|
9
|
+
#
|
10
|
+
# Last updated from rubocop-faker v1.1.0
|
11
|
+
|
12
|
+
# frozen_string_literal: true
|
13
|
+
|
14
|
+
require "rubocop"
|
15
|
+
|
16
|
+
require_path = Pathname.new(Gem.loaded_specs["rubocop-faker"].full_require_paths.first)
|
17
|
+
require require_path.join("rubocop/faker")
|
18
|
+
require require_path.join("rubocop/faker/version")
|
19
|
+
# require_relative 'rubocop/faker/inject'
|
20
|
+
|
21
|
+
# RuboCop::Faker::Inject.defaults!
|
22
|
+
|
23
|
+
require require_path.join("rubocop/cop/faker_cops")
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Standard
|
4
|
+
module Faker
|
5
|
+
class Plugin < LintRoller::Plugin
|
6
|
+
def about
|
7
|
+
LintRoller::About.new(
|
8
|
+
name: "standard-faker",
|
9
|
+
version: VERSION,
|
10
|
+
homepage: "https://github.com/shilin-anton/standard-faker",
|
11
|
+
description: "Configuration for rubocop-faker rules"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def supported?(context)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def rules(context)
|
20
|
+
trick_rubocop_into_thinking_we_required_rubocop_faker!
|
21
|
+
|
22
|
+
LintRoller::Rules.new(
|
23
|
+
type: :object,
|
24
|
+
config_format: :rubocop,
|
25
|
+
value: YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# This is not fantastic.
|
32
|
+
#
|
33
|
+
# When you `require "rubocop-faker"`, it will not only load the cops,
|
34
|
+
# but it will also monkey-patch RuboCop's default_configuration, which is
|
35
|
+
# something that can't be undone for the lifetime of the process.
|
36
|
+
#
|
37
|
+
# See: https://github.com/koic/rubocop-faker/blob/master/lib/rubocop-faker.rb#L9
|
38
|
+
#
|
39
|
+
# As an alternative, standard-rspec loads the cops directly, and then
|
40
|
+
# simply tells the RuboCop config loader that it's been loaded. This is
|
41
|
+
# taking advantage of a private API of an `attr_reader` that probably wasn't
|
42
|
+
# meant to be mutated externally, but it's better than the `Inject` monkey
|
43
|
+
# patching that rubocop-rspec does (and many other RuboCop plugins do)
|
44
|
+
def trick_rubocop_into_thinking_we_required_rubocop_faker!
|
45
|
+
without_warnings do
|
46
|
+
require_relative "load_rubocop_faker_without_the_monkey_patch"
|
47
|
+
end
|
48
|
+
RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-faker")
|
49
|
+
end
|
50
|
+
|
51
|
+
# This is also not fantastic, but because loading RuboCop before loading
|
52
|
+
# ActiveSupport will result in RuboCop redefining a number of ActiveSupport
|
53
|
+
# methods like String#blank?, we need to suppress the warnings that are
|
54
|
+
# emitted when we load the cops.
|
55
|
+
def without_warnings(&blk)
|
56
|
+
original_verbose = $VERBOSE
|
57
|
+
$VERBOSE = nil
|
58
|
+
yield
|
59
|
+
ensure
|
60
|
+
$VERBOSE = original_verbose
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "standard/faker"
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: standard-faker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- shilin-anton
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lint_roller
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-faker
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- anton.d.shilin@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".DS_Store"
|
49
|
+
- ".standard.yml"
|
50
|
+
- CHANGELOG.md
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- config/base.yml
|
55
|
+
- lib/standard/faker.rb
|
56
|
+
- lib/standard/faker/load_rubocop_faker_without_the_monkey_patch.rb
|
57
|
+
- lib/standard/faker/plugin.rb
|
58
|
+
- lib/standard/faker/version.rb
|
59
|
+
- lib/standard_faker.rb
|
60
|
+
homepage: https://github.com/shilin-anton/standard-faker
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata:
|
64
|
+
homepage_uri: https://github.com/shilin-anton/standard-faker
|
65
|
+
source_code_uri: https://github.com/shilin-anton/standard-faker
|
66
|
+
changelog_uri: https://github.com/shilin-anton/standard-faker/blob/main/CHANGELOG.md
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.7.0
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.4.14
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: A Standard plugin that adds rubocop-faker specific rules to Standard.
|
86
|
+
test_files: []
|