Skip to content

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

@itzmidinesh

Description

@itzmidinesh

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions