Giter VIP home page Giter VIP logo

Comments (7)

shtakai avatar shtakai commented on May 23, 2024 1

@akabiru Thank you. 😄
On Faker gem, each file of like Faker::ABCD extends Gem::Deprecate.
And if there are deprecate method, add deprecate method.

[faker] ag deprecate --ruby
lib/faker/name.rb
8:      extend Gem::Deprecate
59:      deprecate :title, 'Faker::Job.title', 2018, 9
60:      deprecate :job_titles, :none, 2018, 9

lib/faker/educator.rb
8:      extend Gem::Deprecate
19:      deprecate :course, :course_name, 2018, 10

I think it's available to pick up these methods. 😄

from faker-bot.

akabiru avatar akabiru commented on May 23, 2024 1

Awesome detective work @shtakai ! 🔍 Would you like to work on this issue? It'd be great of you would. 🙂

from faker-bot.

shtakai avatar shtakai commented on May 23, 2024 1

I implemented checking deprecation like as follows.

renderer.rb

    def leaf_args(method, const)
      [method.to_s].tap do |arr|
        if verbose?
          fake, deprecated = begin
            deprecate = const.respond_to?("_deprecated_#{method.to_s}".to_sym) ? ' ( WILL BE DEPRECATED )' : ''
            [const.public_send(method), deprecate]
          rescue ArgumentError
            ['N/A', '']
          end
          arr << crayon.dim.white("=> #{fake.to_s}#{deprecated}")
        end
      end
    end

The output is...

$ fakerbot list -v
:
:
Faker::Name
├── name=> Brett Metz
├── title=> Senior Legal Specialist ( WILL BE DEPRECATED )
├── _deprecated_title=> Legacy Advertising Assistant
└── _deprecated_job_titles=> ["Supervisor", "Associate", "Executive", "Liaison", "Officer",....]
:

But I am not sure how to track the name after deprecation.....

I'll clean code, refactor and make Pull Request. 😄

from faker-bot.

akabiru avatar akabiru commented on May 23, 2024 1

Nice one! This is a brilliant start. We can start with the ( WILL BE DEPRECATED ) message and figure out how to get the name after. 🥇 Looking forward to the PR. 😄

from faker-bot.

shtakai avatar shtakai commented on May 23, 2024

The location of testing is spec/integration/list_spec.rb line 27. 🍣 😢

alyson@HARDCORE ~/p/g/fakerbot> rspec ./spec/integration/list_spec.rb:27
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
Run options: include {:locations=>{"./spec/integration/list_spec.rb"=>[27]}}

`fakerbot list command
NOTE: Faker::Name.title is deprecated; use Faker::Job.title instead. It will be removed on or after 2018-09-01.
Faker::Name.title called from /Users/alyson/project/gems/fakerbot/lib/fakerbot/renderer.rb:60.
NOTE: Faker::Name.job_titles is deprecated with no replacement. It will be removed on or after 2018-09-01.
Faker::Name.job_titles called from /Users/alyson/project/gems/fakerbot/lib/fakerbot/renderer.rb:60.
  executes `fakerbot list -v` command successfully

Finished in 8.14 seconds (files took 5.44 seconds to load)
1 example, 0 failures

from faker-bot.

akabiru avatar akabiru commented on May 23, 2024

Thank you @shtakai! 🙂You're right, the deprecation warnings are triggered by the --verbose flag from calling methods with dep warnings https://github.com/akabiru/fakerbot/blob/master/lib/fakerbot/renderer.rb#L60

I think it'd be cool if we displayed the dep warnings in a more user friendly manner. E.g.

$ fakerbot list -v
Faker::SomeClass
├── a_method [deprecated use Faker::NewClass.a_method] => sample output

from faker-bot.

shtakai avatar shtakai commented on May 23, 2024

@akabiru Thank you 😄

from faker-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.