GithubHelp home page GithubHelp logo

Comments (5)

rrrene avatar rrrene commented on August 15, 2024

Mmmh, I see your point and the defaults are pretty much up for debate at this moment!

But, just for the sake of discussion, what are the trade-offs of using aliases? I always thought the exact opposite, but am not sure why if I read it or just assumed ... So, what are the downsides?

from credo.

bbense avatar bbense commented on August 15, 2024

The problem is that you don't know where the function is coming from further down in the code. Your point about gathering dependencies is a good one. However, once that Alias statement scrolls off the screen that context is lost.

If you're using an editor that has good searching tools, I'll go to a specific section of code and never see the top of the module. So if I see

def twitter_mentions do
┃ TwitterAPI.search(...)
┃ end

I'm going to start looking for lib/twitter_api.ex as the next file to look in and not find it.
Also, if my editor is smart enough to include IEx.Autocomplete or inline function documentation
lookup, it won't find anything about TwitterAPI. Or heck even if I have an iex -S mix command
open in another window. h TwitterAPI gets me no where.

Now you could argue that eventually Elixir support in various tools will get good enough so all
the above scenerios will just work. But that's not today.

from credo.

rrrene avatar rrrene commented on August 15, 2024

Agreed. My idea for the "Software Design" category was that these are merely suggestions and less concering than issues from, for example, the "Warning" category.

To your point:

There is the concept of "issue priority" in Credo (note-to-self: I have to explain that in more detail in the README), where low priority issues are not shown in the standard report generated by mix credo. An example for such a low priority issue is MaxLineLength, because I found it superficially hard to constrain pattern matches in function signatures to 80 characters and so do Èlixir, Ecto, Plug, and many others.

I am mentioning this because this might be a solution akin to your mix credo --full suggestion: We could set the AliasUsage check to low priority, so it will not show by default. But you can show all issues including the low priority ones with a command-line switch (currently named --pedantic, will rename to --all-priorities in the next release to be more clear).

What do you think?

from credo.

bbense avatar bbense commented on August 15, 2024

That sounds great.

from credo.

rrrene avatar rrrene commented on August 15, 2024

v0.1.6 contains both changes we discussed here. Thx again! 👍

from credo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.