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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98fabe8553b31d2e305e72dfcbabef73e1480a2a76373ae444cabfdd1a0dd2d6
4
- data.tar.gz: e59b83219cf65ea30a506caefdb901476ae4c5a68f78cd5ad0ef618afbc3c2cd
3
+ metadata.gz: 6fe127b93b5b4fc49045b8e50afa3ad7283c62e1cbc94e644e7ca56f245d931e
4
+ data.tar.gz: b6d5f9c5ad6eae68439cc5aa1bd3bac928b990f6df6a3a2e1c1687dd9d8be8cc
5
5
  SHA512:
6
- metadata.gz: 40e2a38812bc30797479531581e0dfc87290384088ddb97ad9f8825650039745a812e480597c39ca6785866a64b110eadc19480cc20f14e9f1c5a9e8afc4ed70
7
- data.tar.gz: f307c18b84f97fb365d77c0cd8779120021202caf6325cb6b094703459de90c7b4219b8eb74d242383147af3086ae6338fe5a17f16ecee654e5975e41f7e6375
6
+ metadata.gz: dfc8a9afb128e2231d46206d34e41e29ea59cc28c0f7d25215b764454d42da2cb4f49bcbd717bb165f87c588a929915a091d64bfa6f48e02e47845fa2eb92796
7
+ data.tar.gz: 310d47e5ebe089f5bce8d9f2ea6e72cb02229786a21fe9ffee452a7e98c738971ff0a00c314cacf784410ff899d54de877979b69d6b7c7e7b33257c765a7c35b
data/.circleci/config.yml CHANGED
@@ -35,6 +35,9 @@ workflows:
35
35
  - rake_default:
36
36
  name: Ruby 2.6
37
37
  image: circleci/ruby:2.6
38
+ - rake_default:
39
+ name: Ruby 2.7
40
+ image: circleci/ruby:2.7
38
41
  - rake_default:
39
42
  name: Ruby HEAD
40
43
  image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
data/.rubocop.yml CHANGED
@@ -62,6 +62,9 @@ Lint/UselessAccessModifier:
62
62
  Lint/BooleanSymbol:
63
63
  Enabled: false
64
64
 
65
+ Metrics/AbcSize:
66
+ Max: 20
67
+
65
68
  Metrics/BlockLength:
66
69
  Exclude:
67
70
  - 'Rakefile'
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
- Metrics/LineLength:
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.4.0'
13
- gem 'yard', '~> 0.9'
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.receiver.source
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Faker
5
- VERSION = '0.2.0'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -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.2.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: 2019-09-04 00:00:00.000000000 Z
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.0.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
@@ -1,4 +0,0 @@
1
- example_id | status | run_time |
2
- --------------------------------- | ------ | --------------- |
3
- ./spec/rubocop/faker_spec.rb[1:1] | passed | 0.00103 seconds |
4
- ./spec/rubocop/faker_spec.rb[1:2] | failed | 0.0248 seconds |
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.0.pre.1