elixirs / elixirs/faker

Warnings Related to Single-Quoted Strings and Deprecated Match Patterns

Open
#573 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Elixir
Stars
1.2k
Forks
261
Avg merge
2d 16h
Merged PRs (30d)
13

Description

### 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:
```elixir
@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](https://github.com/user-attachments/assets/9e68fb37-c23d-4afe-8b1c-b7248447d7d7)

### 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!

Contributor guide

Open the contributing guide

Research direction

Review the listed occurrences in lib/faker.ex, lib/faker/address.ex, lib/faker/lorem.ex, and lib/faker/pizza.ex. Start by running mix test and compiling with Elixir 1.17.2 to distinguish the reported warnings from the existing eight test failures. Done means the deprecated syntax warnings are gone and the relevant test suite still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.