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

Added Generator for International Phonetic Alphabet Characters #2777

Closed
wants to merge 4 commits into from

Conversation

Grifff17
Copy link

@Grifff17 Grifff17 commented Jun 7, 2023

Motivation / Background

This Pull Request has been created because I have added a new generator that generates characters in the International Phonetic Alphabet. It can generate vowels, consonants, or just general characters. I have followed the documentations guidelines.

Checklist

Before submitting the PR make sure the following are checked:

  • [ x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • [ x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [ x] Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • [ x] Tests and Rubocop are passing before submitting your proposed changes.

If you're proposing a new generator:

  • [x ] Open an issue first for discussion before you write any code. - link
  • [x ] Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • [ x] You've reviewed and followed the Documentation guidelines.

Copy link
Contributor

@jremes-foss jremes-foss left a comment

Choose a reason for hiding this comment

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

Few comments related to code quality. Also, please fix formatting in PR description. Thanks.

#
# @faker.version next
def vowel(amount: 1)
(1..amount).map{fetch('international_phonetic_alphabet.vowels')}.join
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix formatting here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Rubocop have an autocorrect method: rubocop -a $file_path.

- a
- ɶ
- ɑ
- ɒ
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add newline at the end of the file.

assert_match(/..../, @tester.character(amount: 4))
end

end
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add newline at the end of the file.

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

Thank you for this! Besides to what @jremes-foss has mentioned, I left some suggestions for this PR. Thanks!

module Faker
class InternationalPhoneticAlphabet < Base

class << self
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think of putting a limit for the amount? Without a limit here, the user can pass a really long number to the methods. An idea is to add a limit and raise an argument error if the user asks for an amount bigger than that. 1000 seems like a reasonable amount.

#
# @faker.version next
def vowel(amount: 1)
(1..amount).map{fetch('international_phonetic_alphabet.vowels')}.join
Copy link
Contributor

Choose a reason for hiding this comment

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

Rubocop have an autocorrect method: rubocop -a $file_path.


class TestFakerInternationalPhoneticAlphabet < Test::Unit::TestCase
def setup
@tester = Faker::InternationalPhoneticAlphabet
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test for when amount is 0 and a negative number?

@thdaraujo thdaraujo mentioned this pull request Sep 3, 2023
@stefannibrasil
Copy link
Contributor

hi @Grifff17 thank you for your contribution. In an effort to keep our work manageable, PRs that haven't had any activity for the past month will be closed. Feel free to reopen it when you're ready and address the comments here. Thanks!

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

Successfully merging this pull request may close these issues.

4 participants