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

Revisit defaults for rules #234

Closed
paulo-ferraz-oliveira opened this issue Apr 26, 2022 · 7 comments · Fixed by #358
Closed

Revisit defaults for rules #234

paulo-ferraz-oliveira opened this issue Apr 26, 2022 · 7 comments · Fixed by #358
Milestone

Comments

@paulo-ferraz-oliveira
Copy link
Collaborator

operator_spaces and no_space: we might want more operators on these ones...

Other rules: are all the ones we want as defaults in the rulesets? (should we add this info to the Wiki, that certain rules aren't executed by default?)

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I've revisited elvis_project and found nothing to change.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I've revisited elvis_text_style and found nothing to change.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

paulo-ferraz-oliveira commented Sep 15, 2024

Proposals/stuff to discuss:

Rules Discussion
macro_names The default regex is [A-Z][A-Z_0-9]+. Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[A-Z]+(_[A-Z0-9]+)*$?
operator_spaces Should ! have white space to left/right? And what about ;? And {/}?
no_space Should . be part of the list (no space to left)? And what about ; (same - no space to left)? And : (on both sides)? What about { (this is probably tricky to get right!); And what about [/]? And #? And ?? And -?
function_naming_convention Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[a-z]+(_[a-z0-9]+)*$?
module_naming_convention Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[a-z]+(_[a-z0-9]+)*(_SUITE)?$?
no_debug_call Should we add io:put_chars/1,2?

@elbrujohalcon
Copy link
Member

elbrujohalcon commented Sep 16, 2024

My opinions…

Rules Discussion Brujo's take
macro_names The default regex is [A-Z][A-Z_0-9]+. Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[A-Z]+(_[A-Z0-9]+)*$? Yes!
operator_spaces Should ! have white space to left/right? And what about ;? And {/}? ! and / - Yes (L and R); ; - Depends if the author is using comma-first or comma-last… I would not make a rule about it, like we don't have a rule about ,; { and } - Same issue, it depends a lot on how the author wants to format its code, I would force any spacing on them
no_space Should . be part of the list (no space to left)? And what about ; (same - no space to left)? And : (on both sides)? What about { (this is probably tricky to get right!); And what about [/]? And #? And ?? And -? ., ;, {, [ and ] - Depends on formatting, as I said above. : (as long as we can differentiate it from ::) - yeah… I would avoid spaces around it. # and ? - does it even compile if they have a space to the right? (if so, yeah… they should not have a space after them). -… Don't we have a default to add spaces to both sides of it in the previous rule?
function_naming_convention Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[a-z]+(_[a-z0-9]+)*$? Yes
module_naming_convention Should we propose something that's closer to what's being discussed for atom_naming_convention, e.g. ^[a-z]+(_[a-z0-9]+)*(_SUITE)?$? Yes
no_debug_call Should we add io:put_chars/1,2? Yeah, why not?

So, my proposed changes would be:

Rules Proposal
macro_names Adjust the default regex to something like ^[A-Z]+(_[A-Z0-9]+)*$?
operator_spaces Add ! and / (L and R)
no_space Add : (no L nor R), as long as we can differentiate it from ::. Add # and ? (No space to the right), as long as the code compiles with spaces
function_naming_convention Adjust the default regex to something like ^[a-z]+(_[a-z0-9]+)*$?
module_naming_convention Adjust the default regex to something like ^[a-z]+(_[a-z0-9]+)*(_SUITE)?$?
no_debug_call Add io:put_chars/1,2

@paulo-ferraz-oliveira
Copy link
Collaborator Author

paulo-ferraz-oliveira commented Sep 16, 2024

  • macro_names: Ok
  • operator_spaces: Ok
  • no_space: Ok, but I don't see where . would ever be formatted by itself (?)
  • function_naming_convention: should it be ^[a-z](_?[a-z0-9]+)*$ instead? What's the difference between what we want here and for an atom name? Edit: I'll push this one as an initial proposal. I wanna check how current code/tests react.
  • module_naming_convention: whatever we decide on before (function_naming_convention) should be the same with (_SUITE)?$ at the end, correct? Edit: I'll push this one as an initial proposal. I wanna check how current code/tests react.
  • no_debug_call: Ok

@elbrujohalcon
Copy link
Member

  • no_space: here…
some_fun() ->
      some:function()
    , some:other_function()
    , …
    .

A very strict form of comma-first.

  • function_naming_convention: Yeah, it's the same atom_naming_convention, but atom_naming_convention allows for _SUITE at the end. That's all.
  • module_naming_convention: Yeah, it's the same as function_naming_convention, but atom_naming_convention allows for _SUITE at the end. That's all.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

module_naming_convention: Yeah, it's the same as function_naming_convention, but atom_naming_convention allows for _SUITE at the end. That's all.

It also allows for _SUITE, which is effectively the name of CT suites, but I got what you mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants