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

Fix: Credo issue with Multi Alias syntax on creating a new project #213

Open
bterone opened this issue May 26, 2022 · 0 comments
Open

Fix: Credo issue with Multi Alias syntax on creating a new project #213

bterone opened this issue May 26, 2022 · 0 comments
Assignees

Comments

@bterone
Copy link
Contributor

bterone commented May 26, 2022

Issue

Whenever we create a new project with the elixir template, there are more files with the single alias syntax.

Specifically in the conn_case, data_case, and project_name_web files

import Ecto.Changeset 
import Ecto.Query

We cannot manually convert them into multi-alias syntax as in the conn_case and project_name_web files use quote do and scope different aliases over multiple functions.
Credo will treat the project as using only single alias and raise false positives when we use mutli alias syntax

We mostly create a workaround for this by ignoring the offending files that aren't fixable and fixing files that can be (like data_case)

Solution

When applying the Credo addon, edit the credo config to ignore the offending files and fix data_case manually

Expected

Can use Multi Alias syntax in a newly created Elixir project with the template without raising credo error.

Steps to reproduce

  1. Create a new Elixir Project using the template
  2. Add one Multi-line alias syntax (e.g. import Ecto.{Changeset, Query}
  3. Run credo or mix codebase and observe error
@bterone bterone self-assigned this May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant