[Code Review Series] - Value Not Used [坑爹的代码] - 变量未使用

in #cn7 years ago (edited)

I thought it will be nice to share some code-review experience from time to time. A code-review is important and necessary for PR (Pull Requests) to merge to the development/release branch. But sometimes, a minimal 2 reviewers are not sufficient e.g. once, a PR with irrelevant change has been merged to development branch even with 2 reviewers 'Approved'. Later... these reviewers were 'punished' by bringing in donuts

The feeling when you care so much to not break something and then you find out later that the value is not used. PS: It is strange that the R# has not identified these as useless code.

工作中代码审核是非常重要的,我觉得有时候分享这些坑是件很有意义的事情。有一次,有一个PR(代码提交)被2个工程师成功审核了,但是之后发现那个PR带了一些不该带的改动,结果就是那两个评审被惩罚带些吃的(甜甜圈)给大家分享。

每次你都很小心,生怕把功能给改错了(即使有少量的单元测试,但是你还是不放心), 后来你发现,这代码绝B是个坑,浪费了你大好的时间,结果这变量声明了根本就没有用到..

很奇怪的是, 像 Resharper这样的代码质量工具竟然没有把无用的代码给标灰。。。

 Originally published at https://steemit.com Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts.

原创首发于 https://steemit.com 非常感谢阅读, 欢迎FOLLOW和Upvote @justyy  能激励我创作更多更好的内容.  

// 已同步到我的中文博客英文博客。 

 近期热贴 Recent Popular Posts 

Sort:  

i upvoted your post plz upvote me back !!

Congratulations @justyy! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the total payout received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

total payout received? so how much is that?

没看懂,看不懂。

我以前写代码时,那时候用类似editPlus,变量都是在用到时才声明,否则很容易出现声明了但却一直未用到的。后来的编辑器都自带了这种检查,好多了。

@justyy got you a $1.59 @minnowbooster upgoat, nice!
@justyy got you a $1.59 @minnowbooster upgoat, nice! (Image: pixabay.com)


Want a boost? Click here to read more!

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 58613.96
ETH 3153.58
USDT 1.00
SBD 2.43