-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Stylecheck script fails on MacOS #13492 #14348
Stylecheck script fails on MacOS #13492 #14348
Conversation
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
0a72b2d
to
25a9c4f
Compare
I believe these are valid style errors. '*'s should be left-aligned.
If so, can I change files above and change right aligned '*'s to left aligned in the same PR? |
Hey @hiroshitash! Thank you very much for your contribution! What is the MacOS version that youre using? I was just checking the current behavoir on my machine (running MacOS Ventura 13.4.1) and it seem to ship a GNU compatible However, your changes look good for me. But at least for me it looks like that these changes are not needed - at least from MacOS version 13.4.1 on. |
Hello @aarlt, Absolutely! I am running the same version of MacOS (Ventura 13.4.1) with
Although BSD grep says it's compatible with GNU grep, it gives an error with a command below (while GNU grep doesn't)
Please see the conversation here for more information. One question: With my modification, style check script still fails with legitimate style errors here. Should I modify right-aligned '*'s in the files? |
Yes please. Not really sure how these weren't caught by the script in the first place (or subsequently). Also, please rebase - I made slight changes to the check style script to have it fail when |
818e70d
to
6ea5e6c
Compare
Hi @aarlt @nikola-matic, I also made one additional change besides fixing right-aligned '*'s:
All tests passed, but please let me know if anything doesn't look right. |
6ea5e6c
to
1596af5
Compare
Hey @hiroshitashir! |
6ea5e6c
to
dc35f9b
Compare
- Install GNU grep on macOS with brew install grep - Use GNU grep with -E option - The following errors fixed. ``` $scripts/check_style.sh ggrep: warning: stray \ before / ggrep: warning: stray \ before / ggrep: warning: * at start of expression ggrep: warning: * at start of expression ``` Fixes [Stylecheck script fails on MacOS ethereum#13492](ethereum#13492)
dc35f9b
to
2820f98
Compare
Hello @aarlt, I just rebased my branch and all tests passing. Let me know if there is anything else I can do. |
if [ "$(uname)" == "Darwin" ]; then | ||
if ! command -v ggrep &> /dev/null | ||
then | ||
brew install grep # install GNU grep on macOS | ||
fi | ||
grepCommand="ggrep" | ||
else | ||
grepCommand="grep" | ||
fi |
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.
A style check script should absolutely not modify your system by installing new software. If it requires something and it's not available, it just fail.
We actually added a portable grep
helper recently, so please source common.sh
and use it:
Lines 317 to 326 in fbbac9c
function gnu_grep | |
{ | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
command_available ggrep --version | |
ggrep "$@" | |
else | |
command_available grep --version | |
grep "$@" | |
fi | |
} |
Thanks @cameel! You're right, like that it is much cleaner! Sorry for the confusion @hiroshitashir, but the proposed changes make a lot of sense. Let me know if you have any questions. |
I'll be closing this in lieu of our current work on introducing clang-format, which essentially do away with all of the portability issues (at least as far as the check_style script is concerned). |
brew install grep
The change was tested on macOS and Linux
Fixes #13492