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
Add formatting targets to the makefile #173
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I get clang-today and clang-format?
Makefile
Outdated
@@ -87,6 +87,13 @@ mypy: regen-metaparser | |||
black: | |||
black pegen tatsu test scripts | |||
|
|||
format-pegen: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference in naming style for this target from ‘black’ somehow bothers me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I rename black
to format-python
and format-pegen
to format-c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
Not a heavy MacOS user but after a bit of research seems that:
brew install llvm
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" To be honest, the original reason I didn't initially commit this to the makefile is that I find these tools a bit heavyweight and I am not an expert with them so I will understand if we end deciding to use only |
Maybe we should only use |
It seems that only
Agreed, will update the PR soon. |
I'm not adamant about braces everywhere, despite what PEP 7 says. Maybe you can have a separate rule that runs clang-tidy but which isn't depended on by Separately, maybe we can run |
@pablogsal Thanks for doing this!
I agree, that this is the way to go, since |
Were you going to finish this? |
Add one target that allows to format pegen/pegen.c (requires clang-format and clang-tidy) available on the system and another target that formats everything (Python and C files).
I have rebased and addressed the feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments explaining how to install clang-format and clang-tidy? I now know it's brew install clang-format
for the former, so a single line would suffice there, but the other is more complicated, right?
(Oh, add "On Mac" to those comments...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
As requested by @lysnikolaou , add one target that allows formatting pegen/pegen.c (requires
clang-format and clang-tidy) available on the system and another target
that formats everything (Python and C files).
Feel free to suggest tweaks to the C file or if you want additional files to be formatted.