-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
methods to make fake pizza data #90
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments about the code changes
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns a size string | ||
""" | ||
@spec combo() :: Strint.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns a size string | ||
""" | ||
@spec size() :: Strint.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got what you were referring to for most of them, but not sure what the typo is here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strint.t
is here
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns a inches string | ||
""" | ||
@spec inches() :: Strint.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo
mix.lock
Outdated
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []}, | ||
"credo": {:hex, :credo, "0.7.3", "9827ab04002186af1aec014a811839a06f72aaae6cd5eed3919b248c8767dbf3", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]}, | ||
"earmark": {:hex, :earmark, "1.2.0", "bf1ce17aea43ab62f6943b97bd6e3dc032ce45d4f787504e3adf738e54b42f3a", [:mix], []}, | ||
"ex_doc": {:hex, :ex_doc, "0.15.1", "d5f9d588fd802152516fccfdb96d6073753f77314fcfee892b15b6724ca0d596", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this relevant to the PR? Why is this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume these were out of date on the repo. I can remove them if @igas requests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lauraannwilliams I don't think so, pls update your hex by running mix local.hex
and try to run it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize my hex was out of date. Thanks :)
lib/faker/pizza.ex
Outdated
@doc """ | ||
Converts a list to a string, with "and" before the last item | ||
""" | ||
@spec add_and(list) :: [char] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're returning a String.t
, right? Not a char list?
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns a specified number of toppings as a string, with an "and" before the last topping | ||
""" | ||
@spec toppings_and(integer) :: [char] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're returning a String.t
, right? Not a char list?
First of all, thank you for your PR. Who doesn't like Pizza, right? However, and I don't know how to say this without being some kind of party pooper: A couple of "fun" based Faker modules is fine, but I don't think we want to add too many. We already have I'm curious to know how @igas feels about adding more "fun" Faker data. |
I really appreciate you catching my various typos - I'll clean that up today. As for the "fun" aspect, I built this one because I had a real use case. I'm working on code for a decision making process. We use 'Pizza' related examples all the time because they're very accessible to new users. It lets them focus on the technology, instead of the data. Not that I mind 'Fun' aspects either. If you look at https://github.com/stympy/faker you'll see a lot of fun ones, that I would use - Like Star Wars, Game of Thrones, etc. If I'm populating a demo with 'fake' comments, it's nice to have usernames that make it clear it's sample data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a reasonable use-case to me. Left some additional comments about the Strint.t
typos.
Once the typos are fixed, its LGTM from me.
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns a combo string | ||
""" | ||
@spec combo() :: Strint.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another Strint
lib/faker/pizza.ex
Outdated
@doc """ | ||
Returns an inches string | ||
""" | ||
@spec inches() :: Strint.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another Strint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks :) |
@tobyhinloopen I don't mind fun modules, I think it's our responsibility to make it easier to add and maintain. In our projects we use quite a lot of fun names for different demo things. |
@@ -9,6 +9,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. | |||
## Unreleased | |||
|
|||
### Added | |||
* `Faker.Pizza` [@lauraannwilliams][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just label in markdown, you also need to add URL to your page at the end of changelog.
USAGE.md
Outdated
|
||
```elixir | ||
|
||
Faker.Pizza.pizzas(%Range{first: 2, last: 3}) => ["Medium Thai Chicken", "26\" with Eel and Salami", "Large with Squid, Duck, Meatballs, and Classic Tomato Sauce"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use 2..3
USAGE.md
Outdated
|
||
Faker.Pizza.pizzas(%Range{first: 2, last: 3}) => ["Medium Thai Chicken", "26\" with Eel and Salami", "Large with Squid, Duck, Meatballs, and Classic Tomato Sauce"] | ||
|
||
Faker.Pizza.pizzas(2) => ["30\" with Alfredo Sauce, Scallops, Lactose Free Cheese, and Cherry Tomatoes", "Family Deep Fried Pizza Double Dutch"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change =>
to # =>
lib/faker/pizza.ex
Outdated
If no range is specified it defaults to 2..5 | ||
""" | ||
@spec toppings_and(Range.t) :: String.t | ||
def toppings_and(range \\ %Range{first: 2, last: 5}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe call this one toppings
and current toppings
rename to list_of_toppings
. I'm not sure suffix and
looks good in function name. What do you think @tobyhinloopen ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toppings_sentence
combined with renaming add_and
to to_sentence
. Inspired by rails' to_sentence
lib/faker/pizza.ex
Outdated
Returns a list with a random number of pizzas (in between the specified | ||
range) | ||
If no range is specified it defaults to 2..5 | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, this documentation will be overridden by next one because function have the same arity, it's need to be rephrased and grouped into one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was emulating the style in the Lorem module. I've updated it to single documentation block
Some variety of "fun" modules are also nice to have when you need to generate something that there isn't a perfect match for. I needed "random event names" and ended up using some combo of the Superhero and Beer modules to get something that semi resembled an event name. ;) |
Please let me know if there's anything else you need from me :) |
Hi @lauraannwilliams it looks great. Only thing unrelated to your code I want to discuss with you and @tobyhinloopen. We added |
Sounds good to me. |
I think all looks good, except |
I was waiting for the other pull request, didn't realize you were waiting on me! I'll yank out the to_sentence this weekend. |
Thank you @lauraannwilliams |
Updates complete :) |
I see this is failing a credo check, i'll update this week. |
@lauraannwilliams it is actually me, master have similar problem. It would be awesome if you'll find the cause. I couldn't find the time to come back to this problem. If you, me or @tobyhinloopen will not find the cause of types issue, maybe we need to turn it off, or relax versions on CI. |
❤️ 💚 💙 💛 💜 |
yay! |
In addition to generating a fake pizza company (mostly drawn from Pop Culture), this will generate a variety of international toppings, combos, and styles.
I've updated: