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

[CodeStyle][B015] replace pointless comparisons with appropriate statements #52126

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Mar 24, 2023

PR types

Bug fixes

PR changes

Others

Describe

都为bug已修复

官方建议:

B015: Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend assert or remove it.

是否可以引入本 rule:✅ 如上所述,可以引入
是否可引入自动修复:❌手动修复

Related links

@paddle-bot
Copy link

paddle-bot bot commented Mar 24, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Mar 24, 2023
@gouzil gouzil changed the title [CodeStyle][B015] Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend assert or remove it. [CodeStyle][B015] delete unused Mar 24, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

emmm,调研不仅包括 rule 本身,还需要考虑对于上下文的理解,这个 rule 本身引入是没问题的,因为确实发现了一些 bug,但是也应该考虑这些语句本身存在的意义,进而使用合适的方案去修复这些 bug

另外标题最好完整一点,delete unusedrename for 都很难从标题理解这个 PR 做了什么事情

@gouzil gouzil changed the title [CodeStyle][B015] delete unused [CodeStyle][B015] fix unused to assert Mar 25, 2023
@gouzil gouzil changed the title [CodeStyle][B015] fix unused to assert [CodeStyle][B015] Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend assert or remove it; fix unused to assert Mar 25, 2023
@SigureMo SigureMo changed the title [CodeStyle][B015] Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend assert or remove it; fix unused to assert [CodeStyle][B015] replace pointtless comparisons with appropriate statements Mar 25, 2023
@SigureMo SigureMo changed the title [CodeStyle][B015] replace pointtless comparisons with appropriate statements [CodeStyle][B015] replace pointless comparisons with appropriate statements Mar 25, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 3957007 into PaddlePaddle:develop Mar 28, 2023
@gouzil gouzil deleted the codeStyle-b015 branch May 15, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants