exercism / elixir-analyzer

GNU Affero General Public License v3.0
30 stars 31 forks source link

`need-for-speed` exercise analyzer gives suggestion contradictory to exercise instructions #390

Closed nmingazov closed 11 months ago

nmingazov commented 11 months ago

So, part 4 of the exercise asks for following:

The functions default_color/0, red/0, cyan/0, and green/0 all come from the module IO.ANSI. You're planning to add support for other car colors, so you want to import the whole module. Unfortunately, the function color/1 from the module IO.ANSI conflicts with one of your local functions. Import the whole IO.ANSI module except that one function.

After adding import IO.ANSI, except: [color: 1] and submitting, I receive the following comment from the analyzer:

When importing functions from a module, it is good practice to import an explicit list, using the :only option

Isn't that contradictory to the original exercise here? I'd be glad to be wrong :)

dabaer commented 11 months ago

Do you have another import call that could be getting flagged?

nmingazov commented 11 months ago

I have only one with except. Overall, my whole solution looks like this:

  # Add missing aliases and imports here.
  alias NeedForSpeed.Race
  alias NeedForSpeed.RemoteControlCar, as: Car
  import IO
  import IO.ANSI, except: [color: 1]
  # Do not edit the code below.

https://exercism.org/tracks/elixir/exercises/need-for-speed/solutions/nmingazov

dabaer commented 11 months ago

You are also importing the entire IO module right above IO.ANSI

nmingazov commented 11 months ago

Excellent catch, changing to import IO, only: [puts: 1] solved the issue :) Thanks!