Skip to content

Deprecate Faker::Placeholdit in favor of Faker::LoremFlickr.image#3274

Open
augustocbx wants to merge 1 commit into
faker-ruby:mainfrom
augustocbx:fix/3055-deprecate-placeholdit
Open

Deprecate Faker::Placeholdit in favor of Faker::LoremFlickr.image#3274
augustocbx wants to merge 1 commit into
faker-ruby:mainfrom
augustocbx:fix/3055-deprecate-placeholdit

Conversation

@augustocbx

Copy link
Copy Markdown

Motivation / Background

Fixes #3055

The via.placeholder.com service no longer resolves (ERR_NAME_NOT_RESOLVED), so every URL generated by Faker::Placeholdit is broken. In the issue discussion, @stefannibrasil asked for this generator to be deprecated — consistent with the project's decision to move away from generators that rely on external services (#2852) — rather than repointing it at another third-party host.

This PR deprecates Faker::Placeholdit#image using Gem::Deprecate, following the process documented in CONTRIBUTING.md and the precedent from #2733 (free_email/safe_email). The generator keeps working and returns the same values, so this is fully backward compatible — it just warns and recommends Faker::LoremFlickr.image, the maintained replacement.

Additional information

Console output after the change:

$ bundle exec rake console
irb(main):001> Faker::Placeholdit.image(size: '50x50', format: 'jpg')
NOTE: Faker::Placeholdit.image is deprecated; use Faker::LoremFlickr.image instead. It will be removed on or after 2026-12.
Faker::Placeholdit.image called from (irb):1.
=> "https://via.placeholder.com/50x50.jpg"

Changes:

  • lib/faker/default/placeholdit.rb: extend Gem::Deprecate + deprecate :image, 'Faker::LoremFlickr.image', 2026, 12 (date mirrors the ~6-month horizon used in Generate safe email and domain_name by default (RFC 2606) #2733; happy to adjust it to match your release plans)
  • test/faker/default/test_placeholdit.rb: regression test asserting the deprecation warning is emitted (verified it fails without the deprecate call); existing tests silence the warning via Gem::Deprecate.skip in setup/teardown to keep test output clean
  • doc/default/placeholdit.md: deprecation notice pointing to Faker::LoremFlickr

Test results: bundle exec rake → 2180 tests, 297308 assertions, 0 failures, 0 errors; RuboCop: 576 files inspected, no offenses detected.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • 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]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

🤖 Generated with Claude Code

The via.placeholder.com service no longer resolves, so the URLs
generated by Faker::Placeholdit are broken. Per maintainer guidance in
the issue and the project's decision to move away from generators that
rely on external services (faker-ruby#2852), deprecate the generator instead of
pointing it at another third-party host, so it can be removed in a
future release.

Faker::Placeholdit.image keeps working and returns the same values; it
now emits a deprecation warning recommending Faker::LoremFlickr.image.

[Fix faker-ruby#3055]
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.

broken links for placeholdit

1 participant