Skip to content

Commit 079e87d

Browse files
Bump rubocop to v1.85.0 (#3220)
* Bump rubocop to v1.85.0 * Autocorrect offenses * Reorder Style rules alphabetically * Skip this rule for specific files These files are scripts/test files that make sense to have all classes being defined together. * Pin public_suffix to satisfy ruby 3.1 dependencies * Pin json-schema to satisfy ruby 3.1 dependencies
1 parent ae24592 commit 079e87d

File tree

6 files changed

+43
-21
lines changed

6 files changed

+43
-21
lines changed

.rubocop.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ Style/EvalWithLocation:
7777
Exclude:
7878
- 'lib/faker/default/json.rb'
7979

80-
Style/FormatStringToken:
81-
Description: This cop checks for a consistent style for named format string tokens.
82-
Enabled: false
83-
84-
Style/FrozenStringLiteralComment:
85-
Description: Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0.
86-
8780
Style/For:
8881
Description: Checks use of for or each in multiline loops.
8982
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-for-loops
@@ -93,9 +86,32 @@ Style/For:
9386
- for
9487
- each
9588

89+
Style/FormatStringToken:
90+
Description: This cop checks for a consistent style for named format string tokens.
91+
Enabled: false
92+
93+
Style/FrozenStringLiteralComment:
94+
Description: Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0.
95+
96+
Style/IfUnlessModifier:
97+
Description: Checks for `if` and `unless` statements that would fit on one line if written as modifier `if`/`unless`. The cop also checks for modifier `if`/`unless` lines that exceed the maximum line length.
98+
Enabled: false
99+
100+
Style/MultipleComparison:
101+
Description: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
102+
Enabled: false
103+
96104
Style/NumericLiteralPrefix:
97105
Enabled: false
98106

107+
Style/OneClassPerFile:
108+
Description: Checks that each source file defines at most one top-level class or module.
109+
Exclude:
110+
- 'script/txt2html'
111+
- 'test/helpers/test_faker_deprecator.rb'
112+
- 'test/test_faker.rb'
113+
- 'test/test_flexible.rb'
114+
99115
Style/RegexpLiteral:
100116
Description: Use / or %r around regular expressions.
101117
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-r
@@ -106,11 +122,3 @@ Style/RegexpLiteral:
106122
- percent_r
107123
- mixed
108124
AllowInnerSlashes: false
109-
110-
Style/IfUnlessModifier:
111-
Description: Checks for `if` and `unless` statements that would fit on one line if written as modifier `if`/`unless`. The cop also checks for modifier `if`/`unless` lines that exceed the maximum line length.
112-
Enabled: false
113-
114-
Style/MultipleComparison:
115-
Description: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
116-
Enabled: false

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ gem 'yard', '0.9.38'
2020

2121
# TODO: remove when Ruby 3.1 is no longer supported
2222
gem 'erb', '~> 4.0.4'
23+
gem 'json-schema', '~> 5.2.2'
24+
gem 'public_suffix', '~> 6.0.2'
2325

2426
group :benchmark do
2527
gem 'benchmark'

Gemfile.lock

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ PATH
77
GEM
88
remote: https://rubygems.org/
99
specs:
10+
addressable (2.8.9)
11+
public_suffix (>= 2.0.2, < 8.0)
1012
ast (2.4.3)
1113
benchmark (0.5.0)
1214
benchmark-ips (2.14.0)
15+
bigdecimal (3.3.1)
1316
cgi (0.5.1)
1417
coderay (1.1.3)
1518
concurrent-ruby (1.3.6)
@@ -26,8 +29,13 @@ GEM
2629
rdoc (>= 4.0.0)
2730
reline (>= 0.4.2)
2831
json (2.18.1)
32+
json-schema (5.2.2)
33+
addressable (~> 2.8)
34+
bigdecimal (~> 3.1)
2935
language_server-protocol (3.17.0.5)
3036
lint_roller (1.1.0)
37+
mcp (0.8.0)
38+
json-schema (>= 4.1)
3139
method_source (1.1.0)
3240
minitest (5.27.0)
3341
parallel (1.27.0)
@@ -46,6 +54,7 @@ GEM
4654
psych (5.3.1)
4755
date
4856
stringio
57+
public_suffix (6.0.2)
4958
racc (1.8.1)
5059
rainbow (3.1.1)
5160
rake (13.3.1)
@@ -56,10 +65,11 @@ GEM
5665
regexp_parser (2.11.3)
5766
reline (0.6.3)
5867
io-console (~> 0.5)
59-
rubocop (1.84.2)
68+
rubocop (1.85.0)
6069
json (~> 2.3)
6170
language_server-protocol (~> 3.17.0.2)
6271
lint_roller (~> 1.1.0)
72+
mcp (~> 0.6)
6373
parallel (~> 1.10)
6474
parser (>= 3.3.0.2)
6575
rainbow (>= 2.2.2, < 4.0)
@@ -104,8 +114,10 @@ DEPENDENCIES
104114
erb (~> 4.0.4)
105115
faker!
106116
irb
117+
json-schema (~> 5.2.2)
107118
minitest (= 5.27.0)
108119
pry (= 0.16.0)
120+
public_suffix (~> 6.0.2)
109121
rake (= 13.3.1)
110122
rdoc
111123
rubocop

lib/faker/default/id_number.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def invalid_south_african_id_number
137137
Faker::Number.number(digits: 2),
138138
Faker::Number.between(from: 13, to: 99),
139139
Faker::Number.between(from: 32, to: 99)
140-
].map(&:to_s).join
140+
].join
141141

142142
id_number = [
143143
invalid_date_of_birth,

test/test_es_locale.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
require_relative 'test_helper'
44

5-
LoadedEsYaml = %w[en es].each_with_object({}) do |locale, h|
6-
h[locale] = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']
5+
LoadedEsYaml = %w[en es].to_h do |locale|
6+
[locale, YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']]
77
end
88

99
class TestEsLocale < Test::Unit::TestCase

test/test_locale.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
require_relative 'test_helper'
44

5-
LoadedYaml = %w[en en-BORK].each_with_object({}) do |locale, h|
6-
h[locale] = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']
5+
LoadedYaml = %w[en en-BORK].to_h do |locale|
6+
[locale, YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']]
77
end
88

99
class TestLocale < Test::Unit::TestCase

0 commit comments

Comments
 (0)