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

Warnings Related to Single-Quoted Strings and Deprecated Match Patterns #573

Open
itzmidinesh opened this issue Sep 21, 2024 · 0 comments
Open

Comments

@itzmidinesh
Copy link

itzmidinesh commented Sep 21, 2024

Description

While compiling files in Phoenix application that utilizes the Faker library, I'm encountering several warnings related to the usage of single-quoted strings and deprecated match patterns. These warnings may lead to confusion and potential issues in the future.

Warnings

  1. Single-Quoted Strings Warning:

    • Warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead.
      • Example:
        @alphabet 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
      • Occurrences:
        • lib/faker.ex:50
        • lib/faker/address.ex:6
        • lib/faker/lorem.ex:501
  2. Deprecated Match Patterns Warning:

    • Warning: first..last inside match is deprecated, you must always match on the step: first..last//var or first..last//_ if you want to ignore it.
      • Occurrences:
        • lib/faker/lorem.ex:299 (Faker.Lorem.characters/1)
        • lib/faker/lorem.ex:333 (Faker.Lorem.paragraph/1)
        • lib/faker/lorem.ex:363 (Faker.Lorem.paragraphs/1)
        • lib/faker/lorem.ex:397 (Faker.Lorem.sentence/1)
        • lib/faker/lorem.ex:454 (Faker.Lorem.sentences/1)
        • lib/faker/lorem.ex:488 (Faker.Lorem.words/1)
        • lib/faker/pizza.ex:50 (Faker.Pizza.pizzas/1)
        • lib/faker/pizza.ex:105 (Faker.Pizza.toppings/1)

Screenshot

image

Steps to Reproduce

  1. Add the Faker library to a Phoenix project.
  2. Compile the project.
  3. Observe the warnings in the output.

Suggested Fixes

  • Update all instances of single-quoted strings to double-quoted strings or use the ~c"" syntax where charlists are required.
  • Update deprecated match patterns to ensure they match on the step as required by the newer Elixir versions.

Environment

  • Elixir version: 1.17.2
  • Faker library version: 0.18.0

Note: I can take up this issue to fix it, but I am seeing 8 test failures while running mix test. Not sure if this is expected, so I don't know if it's OK to proceed.

Thank you for your attention to these issues!

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

No branches or pull requests

1 participant