Skip to content
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

Merged
merged 9 commits into from
Jul 16, 2017
Merged

Conversation

lauraannwilliams
Copy link
Contributor

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:

  • USAGE.md docs
  • CHANGELOG.md

Copy link
Contributor

@tobyhinloopen tobyhinloopen left a 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

@doc """
Returns a size string
"""
@spec combo() :: Strint.t
Copy link
Contributor

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

@doc """
Returns a size string
"""
@spec size() :: Strint.t
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strint.t is here

@doc """
Returns a inches string
"""
@spec inches() :: Strint.t
Copy link
Contributor

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]}]}}
Copy link
Contributor

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?

Copy link
Contributor Author

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 :)

Copy link
Member

@igas igas May 11, 2017

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.

Copy link
Contributor Author

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 :)

@doc """
Converts a list to a string, with "and" before the last item
"""
@spec add_and(list) :: [char]
Copy link
Contributor

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?

@doc """
Returns a specified number of toppings as a string, with an "and" before the last topping
"""
@spec toppings_and(integer) :: [char]
Copy link
Contributor

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?

@tobyhinloopen
Copy link
Contributor

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 Pokemon, Beer and Superhero. I highly doubt anyone actually uses these, while they do add extra code to maintain.

I'm curious to know how @igas feels about adding more "fun" Faker data.

@lauraannwilliams
Copy link
Contributor Author

lauraannwilliams commented May 8, 2017

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.

Copy link
Contributor

@tobyhinloopen tobyhinloopen left a 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.

@doc """
Returns a combo string
"""
@spec combo() :: Strint.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another Strint

@doc """
Returns an inches string
"""
@spec inches() :: Strint.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another Strint

Copy link
Contributor

@tobyhinloopen tobyhinloopen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lauraannwilliams
Copy link
Contributor Author

Thanks :)

@igas
Copy link
Member

igas commented May 11, 2017

@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][]
Copy link
Member

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"]
Copy link
Member

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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change => to # =>

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})
Copy link
Member

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 ?

Copy link
Contributor

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

Returns a list with a random number of pizzas (in between the specified
range)
If no range is specified it defaults to 2..5
"""
Copy link
Member

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.

Copy link
Contributor Author

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

@jessejanderson
Copy link

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. ;)

@lauraannwilliams
Copy link
Contributor Author

Please let me know if there's anything else you need from me :)

@igas
Copy link
Member

igas commented May 21, 2017

Hi @lauraannwilliams it looks great. Only thing unrelated to your code I want to discuss with you and @tobyhinloopen. We added to_sentence/1 which is awesome and generic, what do you think if we move it to Faker.Util or Faker to use everywhere. So we can drop toppings_sentence/1 in this case. And use this new function directly in pizza/1.

@tobyhinloopen
Copy link
Contributor

@lauraannwilliams
Copy link
Contributor Author

Sounds good to me.

@igas
Copy link
Member

igas commented Jun 27, 2017

I think all looks good, except toppings_sentence and to_sentence. As discussed earlier it'll be to many APIs, if we'll start adding it to every function that return list, I think it should be on consumer level through Util, and the ones that here already using it should also go through Util. So lets drop this 2 and merge it.

@lauraannwilliams
Copy link
Contributor Author

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.

@igas
Copy link
Member

igas commented Jul 1, 2017

Thank you @lauraannwilliams

@lauraannwilliams
Copy link
Contributor Author

Updates complete :)

@lauraannwilliams
Copy link
Contributor Author

I see this is failing a credo check, i'll update this week.

@igas
Copy link
Member

igas commented Jul 12, 2017

@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.

@igas igas merged commit 1740cf2 into elixirs:master Jul 16, 2017
@igas
Copy link
Member

igas commented Jul 16, 2017

❤️ 💚 💙 💛 💜

@lauraannwilliams
Copy link
Contributor Author

yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants