Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ Style/EvalWithLocation:
Exclude:
- 'lib/faker/default/json.rb'

Style/FormatStringToken:
Description: This cop checks for a consistent style for named format string tokens.
Enabled: false

Style/FrozenStringLiteralComment:
Description: Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0.

Style/For:
Description: Checks use of for or each in multiline loops.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-for-loops
Expand All @@ -93,9 +86,32 @@ Style/For:
- for
- each

Style/FormatStringToken:
Description: This cop checks for a consistent style for named format string tokens.
Enabled: false

Style/FrozenStringLiteralComment:
Description: Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0.

Style/IfUnlessModifier:
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.
Enabled: false

Style/MultipleComparison:
Description: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
Enabled: false

Style/NumericLiteralPrefix:
Enabled: false

Style/OneClassPerFile:
Description: Checks that each source file defines at most one top-level class or module.
Exclude:
- 'script/txt2html'
- 'test/helpers/test_faker_deprecator.rb'
- 'test/test_faker.rb'
- 'test/test_flexible.rb'

Style/RegexpLiteral:
Description: Use / or %r around regular expressions.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-r
Expand All @@ -106,11 +122,3 @@ Style/RegexpLiteral:
- percent_r
- mixed
AllowInnerSlashes: false

Style/IfUnlessModifier:
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.
Enabled: false

Style/MultipleComparison:
Description: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
Enabled: false
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ gem 'yard', '0.9.38'

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

group :benchmark do
gem 'benchmark'
Expand Down
14 changes: 13 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.9)
public_suffix (>= 2.0.2, < 8.0)
ast (2.4.3)
benchmark (0.5.0)
benchmark-ips (2.14.0)
bigdecimal (3.3.1)
cgi (0.5.1)
coderay (1.1.3)
concurrent-ruby (1.3.6)
Expand All @@ -26,8 +29,13 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.18.1)
json-schema (5.2.2)
addressable (~> 2.8)
bigdecimal (~> 3.1)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
mcp (0.8.0)
json-schema (>= 4.1)
method_source (1.1.0)
minitest (5.27.0)
parallel (1.27.0)
Expand All @@ -46,6 +54,7 @@ GEM
psych (5.3.1)
date
stringio
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
Expand All @@ -56,10 +65,11 @@ GEM
regexp_parser (2.11.3)
reline (0.6.3)
io-console (~> 0.5)
rubocop (1.84.2)
rubocop (1.85.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
mcp (~> 0.6)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
Expand Down Expand Up @@ -104,8 +114,10 @@ DEPENDENCIES
erb (~> 4.0.4)
faker!
irb
json-schema (~> 5.2.2)
minitest (= 5.27.0)
pry (= 0.16.0)
public_suffix (~> 6.0.2)
rake (= 13.3.1)
rdoc
rubocop
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/default/id_number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def invalid_south_african_id_number
Faker::Number.number(digits: 2),
Faker::Number.between(from: 13, to: 99),
Faker::Number.between(from: 32, to: 99)
].map(&:to_s).join
].join

id_number = [
invalid_date_of_birth,
Expand Down
4 changes: 2 additions & 2 deletions test/test_es_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require_relative 'test_helper'

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

class TestEsLocale < Test::Unit::TestCase
Expand Down
4 changes: 2 additions & 2 deletions test/test_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require_relative 'test_helper'

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

class TestLocale < Test::Unit::TestCase
Expand Down