rubocop-faker 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +1 -5
- data/CHANGELOG.md +8 -0
- data/Gemfile +5 -2
- data/lib/rubocop/cop/faker/deprecated_arguments.rb +12 -1
- data/lib/rubocop/faker/version.rb +1 -1
- data/tasks/cops_documentation.rake +0 -2
- metadata +3 -5
- data/.rspec_status +0 -4
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fe127b93b5b4fc49045b8e50afa3ad7283c62e1cbc94e644e7ca56f245d931e
|
4
|
+
data.tar.gz: b6d5f9c5ad6eae68439cc5aa1bd3bac928b990f6df6a3a2e1c1687dd9d8be8cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc8a9afb128e2231d46206d34e41e29ea59cc28c0f7d25215b764454d42da2cb4f49bcbd717bb165f87c588a929915a091d64bfa6f48e02e47845fa2eb92796
|
7
|
+
data.tar.gz: 310d47e5ebe089f5bce8d9f2ea6e72cb02229786a21fe9ffee452a7e98c738971ff0a00c314cacf784410ff899d54de877979b69d6b7c7e7b33257c765a7c35b
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -6,10 +6,6 @@
|
|
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
|
-
# Offense count: 2
|
10
|
-
Metrics/AbcSize:
|
11
|
-
Max: 17
|
12
|
-
|
13
9
|
# Offense count: 5
|
14
10
|
# Configuration parameters: CountComments, ExcludedMethods.
|
15
11
|
Metrics/MethodLength:
|
@@ -19,5 +15,5 @@ Metrics/MethodLength:
|
|
19
15
|
# Cop supports --auto-correct.
|
20
16
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
21
17
|
# URISchemes: http, https
|
22
|
-
|
18
|
+
Layout/LineLength:
|
23
19
|
Max: 87
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
+
# Change log
|
2
|
+
|
1
3
|
## master (unreleased)
|
2
4
|
|
5
|
+
## 1.0.0 (2019-03-14)
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* [#3](https://github.com/koic/rubocop-faker/issues/3): Make `Faker/DeprecatedArguments` aware of `Faker::Base.unique`. ([@koic][])
|
10
|
+
|
3
11
|
## 0.2.0 (2019-09-04)
|
4
12
|
|
5
13
|
### Bug fixes
|
data/Gemfile
CHANGED
@@ -9,5 +9,8 @@ gemspec
|
|
9
9
|
gem 'rake'
|
10
10
|
gem 'rspec'
|
11
11
|
gem 'rubocop', github: 'rubocop-hq/rubocop'
|
12
|
-
gem 'rubocop-performance', '~> 1.
|
13
|
-
|
12
|
+
gem 'rubocop-performance', '~> 1.5.0'
|
13
|
+
# Workaround for YARD 0.9.20 or lower.
|
14
|
+
# It specifies `github` until the release that includes the following changes:
|
15
|
+
# https://github.com/lsegal/yard/pull/1290
|
16
|
+
gem 'yard', github: 'lsegal/yard', ref: '10a2e5b'
|
@@ -28,6 +28,9 @@ module RuboCop
|
|
28
28
|
class_name = faker_class_name(node)
|
29
29
|
|
30
30
|
return unless (methods = argument_keywords[class_name])
|
31
|
+
|
32
|
+
node = node.parent if unique_generator_method?(node)
|
33
|
+
|
31
34
|
return unless (keywords = methods[node.method_name.to_s])
|
32
35
|
|
33
36
|
node.arguments.each_with_index do |argument, index|
|
@@ -56,6 +59,10 @@ module RuboCop
|
|
56
59
|
|
57
60
|
private
|
58
61
|
|
62
|
+
def unique_generator_method?(node)
|
63
|
+
node.method?(:unique) && node.arguments.size.zero?
|
64
|
+
end
|
65
|
+
|
59
66
|
def format_message(keyword:, arg:, index:, class_name:, method_name:)
|
60
67
|
i = case index
|
61
68
|
when 0 then '1st'
|
@@ -92,7 +99,11 @@ module RuboCop
|
|
92
99
|
end
|
93
100
|
|
94
101
|
def faker_class_name(node)
|
95
|
-
node.
|
102
|
+
if node.children.first.send_type? && node.children.first.method?(:unique)
|
103
|
+
node.children.first.receiver.source
|
104
|
+
else
|
105
|
+
node.receiver.source
|
106
|
+
end
|
96
107
|
end
|
97
108
|
|
98
109
|
def arguments_range(node)
|
@@ -197,7 +197,6 @@ task generate_cops_documentation: :yard_for_generate_documentation do
|
|
197
197
|
cops_body(config, cop, description, examples_object, pars)
|
198
198
|
end
|
199
199
|
|
200
|
-
# rubocop:disable Metrics/AbcSize
|
201
200
|
def table_of_content_for_department(cops, department)
|
202
201
|
selected_cops = cops_of_department(cops, department.to_sym).select do |cop|
|
203
202
|
cop.to_s.start_with?('RuboCop::Cop::Faker')
|
@@ -214,7 +213,6 @@ task generate_cops_documentation: :yard_for_generate_documentation do
|
|
214
213
|
|
215
214
|
content
|
216
215
|
end
|
217
|
-
# rubocop:enable Metrics/AbcSize
|
218
216
|
|
219
217
|
def print_table_of_contents(cops)
|
220
218
|
path = "#{Dir.pwd}/manual/cops.md"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-faker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi ITO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -34,10 +34,8 @@ files:
|
|
34
34
|
- ".circleci/config.yml"
|
35
35
|
- ".gitignore"
|
36
36
|
- ".rspec"
|
37
|
-
- ".rspec_status"
|
38
37
|
- ".rubocop.yml"
|
39
38
|
- ".rubocop_todo.yml"
|
40
|
-
- ".travis.yml"
|
41
39
|
- CHANGELOG.md
|
42
40
|
- Gemfile
|
43
41
|
- LICENSE.txt
|
@@ -76,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
74
|
- !ruby/object:Gem::Version
|
77
75
|
version: '0'
|
78
76
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.1.2
|
80
78
|
signing_key:
|
81
79
|
specification_version: 4
|
82
80
|
summary: A RuboCop extension for Faker.
|
data/.rspec_status
DELETED