Skip to content

scripts: support local check for developers #113

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

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Conversation

WangJialei-A
Copy link
Contributor

support #20

scripts/tidy.sh Outdated
fi ;
done

wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -O run-clang-tidy.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we cache result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Menooker
I'm not sure it is ok to place code from llvm in our public repository

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kurapov-peter @ZhennanQin What do you think if we copy .clang-tidy to our repo?

Copy link
Contributor

@AndreyPavlenko AndreyPavlenko May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not download if already exists:

[ -f run-clang-tidy.py ] || wget ...
[ -f .clang-tidy ] || wget ... 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kurapov-peter @ZhennanQin What do you think if we copy .clang-tidy to our repo?

sure, @leshikus please take a look

scripts/tidy.sh Outdated
done

wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -O run-clang-tidy.py
wget https://raw.githubusercontent.com/llvm/llvm-project/main/mlir/.clang-tidy -O .clang-tidy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can copy this file to our repo? Just like .clang_format?

scripts/tidy.sh Outdated
fi ;
done

wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -O run-clang-tidy.py
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not download if already exists:

[ -f run-clang-tidy.py ] || wget ...
[ -f .clang-tidy ] || wget ... 

@WangJialei-A WangJialei-A force-pushed the wangjial/local_tidy branch from 0312f51 to 5674ca0 Compare May 31, 2024 06:14
@WangJialei-A WangJialei-A changed the title scripts: support local tidy for developers scripts: support local check for developers May 31, 2024
@WangJialei-A WangJialei-A force-pushed the wangjial/local_tidy branch from 5674ca0 to 9ff54ca Compare May 31, 2024 06:16
@WangJialei-A WangJialei-A force-pushed the wangjial/local_tidy branch from 9ff54ca to 04275ba Compare May 31, 2024 07:19
@kurapov-peter kurapov-peter requested a review from leshikus May 31, 2024 11:17

for f in $(find ./include -name Makefile); do
targets=$(make -f $f help |grep IncGen);
if [[ $? -eq 0 ]]; then
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [[ $? -eq 0 ]]; then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bash if command checks the command exit code by default, the code above is like the check if mybool == true

please use either if cmd or cmd && some_command

@@ -0,0 +1,111 @@
#! /bin/bash
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#! /bin/bash
#! /bin/bash
set -e

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's usually better to use explicit set -e in case someone uses bash script to launch the script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about set -e? I think, it's very useful for error checking.

-DLLVM_EXTERNAL_LIT=$(which lit)

for f in $(find ./include -name Makefile); do
targets=$(make -f $f help |grep IncGen);
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
targets=$(make -f $f help |grep IncGen);
if targets=$(make -f $f help |grep IncGen); then

@WangJialei-A WangJialei-A requested a review from Yun-Fly June 5, 2024 01:27
Copy link

@AshburnLee AshburnLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WangJialei-A WangJialei-A merged commit eb43c64 into main Jun 13, 2024
4 checks passed
@WangJialei-A WangJialei-A deleted the wangjial/local_tidy branch June 13, 2024 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants