From 71fe3a6dee4a3b1c20d51970ce8f52752f4d48b3 Mon Sep 17 00:00:00 2001 From: Ro Savage Date: Fri, 27 Sep 2019 16:15:48 +1000 Subject: [PATCH 1/4] Remove "mint green" from color (#1764) The list of colors are all single words except for "mint green". As mint green is a pretty obscure color and doesn't fit with the format of every other color being a single word. I purpose we remove this color for consistency. --- lib/locales/en/color.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/locales/en/color.yml b/lib/locales/en/color.yml index b3bc2ba00c..c2b7c8b9bf 100644 --- a/lib/locales/en/color.yml +++ b/lib/locales/en/color.yml @@ -1,4 +1,4 @@ en: faker: color: - name: [red, green, blue, yellow, purple, mint green, teal, white, black, orange, pink, grey, maroon, violet, turquoise, tan, sky blue, salmon, plum, orchid, olive, magenta, lime, ivory, indigo, gold, fuchsia, cyan, azure, lavender, silver] + name: [red, green, blue, yellow, purple, teal, white, black, orange, pink, grey, maroon, violet, turquoise, tan, sky blue, salmon, plum, orchid, olive, magenta, lime, ivory, indigo, gold, fuchsia, cyan, azure, lavender, silver] From a7cdf1272ad5fb59221836d4ba5ffb9776c89d7b Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Sun, 29 Sep 2019 14:31:14 -0600 Subject: [PATCH 2/4] Add YARD docs for Faker::Restaurant. (#1768) This also makes the restaurant class methods explicit so they can be documented. --- lib/faker/default/restaurant.rb | 56 +++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/lib/faker/default/restaurant.rb b/lib/faker/default/restaurant.rb index cec0b5459e..b4512a2c98 100644 --- a/lib/faker/default/restaurant.rb +++ b/lib/faker/default/restaurant.rb @@ -4,8 +4,60 @@ module Faker class Restaurant < Base flexible :restaurant - def self.name - bothify(parse('restaurant.name')) + class << self + ## + # Produces the name of a restaurant. + # + # @return [String] + # + # @example + # Faker::Restaurant.name #=> "Curry King" + # + # @faker.version 1.9.2 + def name + bothify(parse('restaurant.name')) + end + + ## + # Produces a type of restaurant. + # + # @return [String] + # + # @example + # Faker::Restaurant.type #=> "Comfort Food" + # + # @faker.version 1.9.2 + def type + fetch('restaurant.type') + end + + ## + # Produces a description of a restaurant. + # + # @return [String] + # + # @example + # Faker::Restaurant.description + # #=> "We are committed to using the finest ingredients in our recipes. No food leaves our kitchen that we ourselves would not eat." + # + # @faker.version 1.9.2 + def description + fetch('restaurant.description') + end + + ## + # Produces a review for a restaurant. + # + # @return [String] + # + # @example + # Faker::Restaurant.review + # #=> "Brand new. Great design. Odd to hear pop music in a Mexican establishment. Music is a bit loud. It should be background." + # + # @faker.version 1.9.2 + def review + fetch('restaurant.review') + end end end end From 404c9fdd8a510c9bd55dbc5c6f4260811108e86a Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Sun, 29 Sep 2019 14:32:07 -0600 Subject: [PATCH 3/4] Fix two incorrect flexible method calls. (#1767) --- lib/faker/default/chuck_norris.rb | 2 +- lib/faker/games/zelda.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/faker/default/chuck_norris.rb b/lib/faker/default/chuck_norris.rb index 91aa2adcdd..48f2f83bc1 100644 --- a/lib/faker/default/chuck_norris.rb +++ b/lib/faker/default/chuck_norris.rb @@ -2,7 +2,7 @@ module Faker class ChuckNorris < Base - flexible :name + flexible :chuck_norris class << self # from: https://github.com/jenkinsci/chucknorris-plugin/blob/master/src/main/java/hudson/plugins/chucknorris/FactGenerator.java diff --git a/lib/faker/games/zelda.rb b/lib/faker/games/zelda.rb index 28795f5057..352ed8ad47 100644 --- a/lib/faker/games/zelda.rb +++ b/lib/faker/games/zelda.rb @@ -3,7 +3,7 @@ module Faker class Games class Zelda < Base - flexible :space + flexible :zelda class << self ## # Produces the name of a Legend of Zelda game. From b428f2ad98bcefd3b55a54a37512a3c1366fddea Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Sun, 29 Sep 2019 17:09:58 -0600 Subject: [PATCH 4/4] Fix some rubocop comments that were showing up in YARD docs. (#1771) * Fix some rubocop comments that were showing up in YARD docs. * Fix the Rubocop command in Faker::Avatar as well. --- lib/faker/default/app.rb | 3 ++- lib/faker/default/avatar.rb | 3 ++- lib/faker/default/internet.rb | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/faker/default/app.rb b/lib/faker/default/app.rb index 6cf3baf947..be131cf82f 100644 --- a/lib/faker/default/app.rb +++ b/lib/faker/default/app.rb @@ -42,6 +42,8 @@ def author parse('app.author') end + # rubocop:disable Metrics/ParameterLists + ## # Produces a String representing a semantic version identifier. # @@ -60,7 +62,6 @@ def author # Faker::App.semantic_version(patch: 5..6) #=> "7.2.6" # # @faker.version 1.4.3 - # rubocop:disable Metrics/ParameterLists def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9) # rubocop:enable Metrics/ParameterLists warn_for_deprecated_arguments do |keywords| diff --git a/lib/faker/default/avatar.rb b/lib/faker/default/avatar.rb index 1699e5a802..c191e7bd02 100644 --- a/lib/faker/default/avatar.rb +++ b/lib/faker/default/avatar.rb @@ -6,6 +6,8 @@ class << self # @private SUPPORTED_FORMATS = %w[png jpg bmp].freeze + # rubocop:disable Metrics/ParameterLists + ## # Produces a URL for an avatar from robohash.org # @@ -36,7 +38,6 @@ class << self # #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1" # # @faker.version 1.4.3 - # rubocop:disable Metrics/ParameterLists def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_set = NOT_GIVEN, legacy_bgset = NOT_GIVEN, slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil) # rubocop:enable Metrics/ParameterLists warn_for_deprecated_arguments do |keywords| diff --git a/lib/faker/default/internet.rb b/lib/faker/default/internet.rb index 8ac771e9fa..1aa520e837 100644 --- a/lib/faker/default/internet.rb +++ b/lib/faker/default/internet.rb @@ -73,6 +73,8 @@ def username(legacy_specifier = NOT_GIVEN, legacy_separators = NOT_GIVEN, specif end end + # rubocop:disable Metrics/ParameterLists + ## # Produces a randomized string of characters suitable for passwords # @@ -95,8 +97,8 @@ def username(legacy_specifier = NOT_GIVEN, legacy_separators = NOT_GIVEN, specif # Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true, special_characters: true) #=> "*%NkOnJsH4" # # @faker.version 2.1.3 - # rubocop:disable Metrics/ParameterLists def password(legacy_min_length = NOT_GIVEN, legacy_max_length = NOT_GIVEN, legacy_mix_case = NOT_GIVEN, legacy_special_characters = NOT_GIVEN, min_length: 8, max_length: 16, mix_case: true, special_characters: false) + # rubocop:enable Metrics/ParameterLists warn_for_deprecated_arguments do |keywords| keywords << :min_length if legacy_min_length != NOT_GIVEN keywords << :max_length if legacy_max_length != NOT_GIVEN @@ -239,6 +241,7 @@ def ip_v6_cidr "#{ip_v6_address}/#{rand(1..127)}" end + # rubocop:disable Metrics/ParameterLists def url(legacy_host = NOT_GIVEN, legacy_path = NOT_GIVEN, legacy_scheme = NOT_GIVEN, host: domain_name, path: "/#{username}", scheme: 'http') # rubocop:enable Metrics/ParameterLists warn_for_deprecated_arguments do |keywords|