Code Monkey home page Code Monkey logo

Comments (12)

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

I'd like to give this a go, if still deemed valuable. I believe the proper syntax would be:

{elvis_style, no_macros, #{allowed_macros => ["EXCEPTION_1", "EXCEPTION_2"], ignore => [module_1, module_2]}}

In any case, it will surely bring up a lot of results in any given project, so either the ignore list will become huge (and every time you add a macro you have to allow it) or consumers will just disable the rule (unless you meant not having it enabled by default, which is also valid).

from elvis_core.

elbrujohalcon avatar elbrujohalcon commented on June 3, 2024

I would say "Go ahead, my brave fellow!!", but don't include the rule in the erl_files ruleset just yet.

Maybe… if people want to use this rule, but still have some macros… they can put the macros in an hrl file that's not checked with this rule… Not that I like that solution, just saying that it will exist 🙈

from elvis_core.

elbrujohalcon avatar elbrujohalcon commented on June 3, 2024

Oh, the rule will check for macro usage, not macro definition… 🤔 … In that case, my solution doesn't work. 🤷

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

Yeah, seems feasible. I'll preemptively assign it to me.

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

There's a chance this'll eventually use some of the code from #131, since the latter messes with macro identification (we will need the list of built-in macros somewhere, right?).

from elvis_core.

elbrujohalcon avatar elbrujohalcon commented on June 3, 2024

Like… here, you mean?

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

Like… here, you mean?

Yes. I'd like it to be available by code, but we can start with that 😄

from elvis_core.

elbrujohalcon avatar elbrujohalcon commented on June 3, 2024

Like this then… but exported 😢

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

Like this then… but exported 😢

That'd be sweet. Let me ask around.

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

For reference...

Something (undocumented) like this is also possible

1> {ok, Epp} = epp:open("**REDACTED**/rebar3_hex/src/rebar3_hex.erl", []).
{ok,<0.84.0>}
2> epp:macro_defs(Epp).                                                                      
[{{atom,'BASE_MODULE'},undefined},
 {{atom,'BASE_MODULE_STRING'},undefined},
 {{atom,'BEAM'},{none,[{atom,1,true}]}},
 {{atom,'FILE'},
  {none,[{string,1,
                 "**REDACTED**/rebar3_hex/src/rebar3_hex.erl"}]}},
 {{atom,'FUNCTION_ARITY'},undefined},
 {{atom,'FUNCTION_NAME'},undefined},
 {{atom,'LINE'},{none,[{integer,1,1}]}},
 {{atom,'MACHINE'},{none,[{atom,1,'BEAM'}]}},
 {{atom,'MODULE'},undefined},
 {{atom,'MODULE_STRING'},undefined},
 {{atom,'OTP_RELEASE'},{none,[{integer,1,21}]}}]

from elvis_core.

elbrujohalcon avatar elbrujohalcon commented on June 3, 2024

HA! That's super-hacky… I like it. It should go into katana-code

from elvis_core.

paulo-ferraz-oliveira avatar paulo-ferraz-oliveira commented on June 3, 2024

I've moved to implement this, thus the last change ("removed their assignment now").

from elvis_core.

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.