-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[CodeStyle] add pre-commit hook remove-tabs
for python files
#46290
Merged
Merged
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6f1f5e0
[CodeStyle] add pre-commit hook `remove-tabs` for python files
SigureMo 4145030
exclude files from thirdparty and unittest required tabs
SigureMo 3ee8a15
empty commit, test=document_fix
SigureMo 91fbc2f
Merge branch 'develop' into tabs/config/py
SigureMo 469bd7c
empty commit, test=document_fix
SigureMo 1343f2d
Merge branch 'develop' into tabs/config/py
SigureMo 99775d4
remove W191 and E101 in .flake8
SigureMo 7df65ba
empty commit, test=document_fix
SigureMo c6ce328
exclude fluid/ in flake8 config
SigureMo f4807a0
add comment
SigureMo f694c03
empty commit, test=document_fix
SigureMo aef8fdf
remove E124 and F404
SigureMo 3b51a96
empty commit, test=document_fix
SigureMo 5da1589
Merge branch 'develop' into tabs/config/py
SigureMo b9825a5
add comment
SigureMo 02380df
add comment
SigureMo 2bf08b2
empty commit, test=document_fix
SigureMo ed17d0f
update regex
SigureMo 7d39482
empty commit, test=document_fix
SigureMo b98a5bf
fix glob
SigureMo 5d08226
empty commit, test=document_fix
SigureMo 9e87dc1
remove some error code
SigureMo daf98d8
empty commit, test=document_fix
SigureMo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
根据 #46288 (comment) 的讨论,目前 Flake8 忽略
python/paddle/fluid
整个目录,但需要单独保留python/paddle/fluid/tests
。Flake8 路径相关使用的是 glob 语法(见 https://en.wikipedia.org/wiki/Glob_(programming) ),glob 语法并不能很好地直接实现这样的需求,Stack Overflow 上也有很多问题说明了这一问题(如 https://stackoverflow.com/questions/20638040/glob-exclude-pattern )
这里先使用
./python/paddle/fluid/[!t]**
以排除所有./python/paddle/fluid/
下第一个字母不是t
的路径,这样的路径包含了tests/
子目录、transpiler/
子目录、trainer_desc.py
和trainer_factory.py
,因此实际上其余以transpiler/
、trainer_desc.py
和trainer_factory.py
也被「豁免」了。为了解决这一问题,使用额外一项排除掉这样的路径,这样通过两条 glob 实现了上述的需求。