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

[tools][clang-tidy] add skip file #56632

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Aug 24, 2023

PR types

Others

PR changes

Others

Description

跳过一些.gitignore里面的文件, 跳过编译目录, 跳过.cu后缀文件

检查数量从 2991 减少到 2220, 减少 771 个

测试的编译选项为

cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_GPU=ON \
-DWITH_TESTING=ON -DWITH_COVERAGE=ON \
-DWITH_PYTHON=ON -DPY_VERSION=3.8 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON 

相关链接:

@gouzil
Copy link
Member Author

gouzil commented Aug 24, 2023

@GreatV 帮忙检查一下

zhangbo9674
zhangbo9674 previously approved these changes Aug 24, 2023
@@ -93,6 +93,51 @@ def make_absolute(f, directory):
return os.path.normpath(os.path.join(directory, f))


def analysis_gitignore(path, filename=".gitignore"):
"""Analysis gitignore file and return ignore file list"""
f = open(path + "/" + filename, "r")
Copy link
Contributor

Choose a reason for hiding this comment

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

这里用 with open 会不会好一点

ignore_file_list = []
for line in lines:
# Blank row
if line == "\n":
Copy link
Contributor

Choose a reason for hiding this comment

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

windows 下会不会把LF替换成CRLF

Comment on lines 108 to 109
if "#" in line:
if line[0] != "#":
Copy link
Contributor

Choose a reason for hiding this comment

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

可不可以换成这样的写法

        line = line.strip()
        ...
        if line.startswith("#")

@GreatV
Copy link
Contributor

GreatV commented Aug 24, 2023

python ./tools/codestyle/clang-tidy.py -p=build -j=10 -clang-tidy-binary=clang-tidy -extra-arg=-Wno-unknown-warning-option -extra-arg=-Wno-pessimizing-move -extra-arg=-Wno-braced-scalar-init -extra-arg=-Wno-deprecated-copy -extra-arg=-Wno-dangling-gsl -extra-arg=-Wno-final-dtor-non-final-class -extra-arg=-Wno-implicit-int-float-conversion -extra-arg=-Wno-inconsistent-missing-override -extra-arg=-Wno-infinite-recursion -extra-arg=-Wno-mismatched-tags  -extra-arg=-Wno-self-assign -extra-arg=-Wno-sign-compare -extra-arg=-Wno-sometimes-uninitialized -extra-arg=-Wno-tautological-overlap-compare -extra-arg=-Wno-unused-const-variable -extra-arg=-Wno-unused-lambda-capture -extra-arg=-Wno-unused-private-field -extra-arg=-Wno-unused-value -extra-arg=-Wno-unused-variable  -extra-arg=-Wno-overloaded-virtual  -extra-arg=-Wno-defaulted-function-deleted  -extra-arg=-Wno-delete-non-abstract-non-virtual-dtor  -extra-arg=-Wno-return-type-c-linkage  > clang-tidy_v2.log  2>&1 

运行完还会有相关报错

Resource filename: /usr/local/lib/python3.11/dist-packages/clang_tidy/data/bin/clang-tidy 
clang-tidy -extra-arg=-Wno-unknown-warning-option -extra-arg=-Wno-pessimizing-move -extra-arg=-Wno-braced-scalar-init -extra-arg=-Wno-deprecated-copy -extra-arg=-Wno-dangling-gsl -extra-arg=-Wno-final-dtor-non-final-class -extra-arg=-Wno-implicit-int-float-conversion -extra-arg=-Wno-inconsistent-missing-override -extra-arg=-Wno-infinite-recursion -extra-arg=-Wno-mismatched-tags -extra-arg=-Wno-self-assign -extra-arg=-Wno-sign-compare -extra-arg=-Wno-sometimes-uninitialized -extra-arg=-Wno-tautological-overlap-compare -extra-arg=-Wno-unused-const-variable -extra-arg=-Wno-unused-lambda-capture -extra-arg=-Wno-unused-private-field -extra-arg=-Wno-unused-value -extra-arg=-Wno-unused-variable -extra-arg=-Wno-overloaded-virtual -extra-arg=-Wno-defaulted-function-deleted -extra-arg=-Wno-delete-non-abstract-non-virtual-dtor -extra-arg=-Wno-return-type-c-linkage -p=build /paddle/paddle/testing/paddle_gtest_main.cc
/paddle/third_party/eigen3/unsupported/Eigen/CXX11/../../../Eigen/Core:70:10: error: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>
         ^~~~~~~
Resource filename: /usr/local/lib/python3.11/dist-packages/clang_tidy/data/bin/clang-tidy 
clang-tidy -extra-arg=-Wno-unknown-warning-option -extra-arg=-Wno-pessimizing-move -extra-arg=-Wno-braced-scalar-init -extra-arg=-Wno-deprecated-copy -extra-arg=-Wno-dangling-gsl -extra-arg=-Wno-final-dtor-non-final-class -extra-arg=-Wno-implicit-int-float-conversion -extra-arg=-Wno-inconsistent-missing-override -extra-arg=-Wno-infinite-recursion -extra-arg=-Wno-mismatched-tags -extra-arg=-Wno-self-assign -extra-arg=-Wno-sign-compare -extra-arg=-Wno-sometimes-uninitialized -extra-arg=-Wno-tautological-overlap-compare -extra-arg=-Wno-unused-const-variable -extra-arg=-Wno-unused-lambda-capture -extra-arg=-Wno-unused-private-field -extra-arg=-Wno-unused-value -extra-arg=-Wno-unused-variable -extra-arg=-Wno-overloaded-virtual -extra-arg=-Wno-defaulted-function-deleted -extra-arg=-Wno-delete-non-abstract-non-virtual-dtor -extra-arg=-Wno-return-type-c-linkage -p=build /paddle/paddle/testing/paddle_gtest_main.cc
/paddle/third_party/eigen3/unsupported/Eigen/CXX11/../../../Eigen/Core:70:10: error: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>
Resource filename: /usr/local/lib/python3.11/dist-packages/clang_tidy/data/bin/clang-tidy 
clang-tidy -extra-arg=-Wno-unknown-warning-option -extra-arg=-Wno-pessimizing-move -extra-arg=-Wno-braced-scalar-init -extra-arg=-Wno-deprecated-copy -extra-arg=-Wno-dangling-gsl -extra-arg=-Wno-final-dtor-non-final-class -extra-arg=-Wno-implicit-int-float-conversion -extra-arg=-Wno-inconsistent-missing-override -extra-arg=-Wno-infinite-recursion -extra-arg=-Wno-mismatched-tags -extra-arg=-Wno-self-assign -extra-arg=-Wno-sign-compare -extra-arg=-Wno-sometimes-uninitialized -extra-arg=-Wno-tautological-overlap-compare -extra-arg=-Wno-unused-const-variable -extra-arg=-Wno-unused-lambda-capture -extra-arg=-Wno-unused-private-field -extra-arg=-Wno-unused-value -extra-arg=-Wno-unused-variable -extra-arg=-Wno-overloaded-virtual -extra-arg=-Wno-defaulted-function-deleted -extra-arg=-Wno-delete-non-abstract-non-virtual-dtor -extra-arg=-Wno-return-type-c-linkage -p=build /paddle/paddle/phi/kernels/funcs/segment_pooling.cu
error: no such file or directory: 'arch=compute_89,code=sm_89' [clang-diagnostic-error]
error: too many errors emitted, stopping now [clang-diagnostic-error]
error: unknown argument: '-forward-unknown-to-host-compiler' [clang-diagnostic-error]
error: unknown argument: '-gencode' [clang-diagnostic-error]
error: unsupported option '--expt-extended-lambda' [clang-diagnostic-error]
error: unsupported option '--expt-relaxed-constexpr' [clang-diagnostic-error]
/paddle/paddle/phi/kernels/funcs/gather.cu.h:60:7: error: cannot use 'throw' in __global__ function [clang-diagnostic-error]

@gouzil
Copy link
Member Author

gouzil commented Aug 24, 2023

运行完还会有相关报错

Done

@paddle-bot paddle-bot bot added the contributor External developers label Aug 24, 2023
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 25, 2023
@luotao1 luotao1 merged commit a8bb416 into PaddlePaddle:develop Aug 29, 2023
26 checks passed
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
* [clang-tidy]add skip

* fix compatibility

* fix
@gouzil gouzil deleted the clang_tidy_skip_file branch September 24, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants