41
How We Automated Code Review Process

How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

How We Automated Code Review Process

Page 2: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

who?

@gozali https://github.com/gozali

[email protected]

Page 3: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Inaugurual Indonesian RubyConf Oct 6-7th https://ruby.id/cfp

Page 4: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

What is code review?

Page 5: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

https://s-media-cache-ak0.pinimg.com/originals/b8/e7/ca/b8e7cafa593d5358232553c744c47709.jpg

Page 6: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Code review is systematic examination of computer source code

https://en.wikipedia.org/wiki/Code_review

Page 7: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Patterns

Page 8: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Formal Inspections

https://en.wikipedia.org/wiki/Fagan_inspection

Page 9: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Formal Inspections

https://davidwalsh.name/code-review

Page 10: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Formal inspections is proven techniques but require large amounts of developer time

Page 11: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Over-the-shoulder

http://www.sheknows.com/entertainment/articles/827569/source-code-movie-review

Page 12: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Over-the-shoulder are easiest to implement but can’t be instantiated as a controlled process

Page 13: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Pair Programming

https://twitter.com/ArtofWarm/status/714880831206981632

Page 14: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Pair-programming has a lot of advantages but require large amounts of developer time

Page 15: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Tool-assisted

https://github.com/marketplace/category/code-review https://github.com/marketplace/category/code-quality

Page 16: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Tool-assisted strike a balance between time invested and ease of implementation

Page 17: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Rules

Page 18: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Reviewing code before or after deployment?

•Who should review the code? •Should the code reviews be

blocking? •How strict should the code reviews

be?

Page 19: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Reviewing code before or after deployment?

•Who should review the code? •Should the code reviews be

blocking? •How strict should the code reviews

be?

Page 20: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Reviewing code before or after deployment?

•Who should review the code? •Should the code reviews be

blocking? •How strict should the code reviews

be?

Page 21: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Reviewing code before or after deployment?

•Who should review the code? •Should the code reviews be

blocking? •How strict should the code reviews

be?

Page 22: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Automated Code Reviews? How can this work?

Page 23: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Code reviews are mostly about enforcing best practices, code style, and common security issues

Page 24: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Most of those issues can be found by static analysis and linting tools

Page 25: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Why Automated Code Reviews?

Page 26: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

1000 LoC - Looks fine 10 LoC - 9 issues

@mikhailgarber

Page 27: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Our Setup

Page 28: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

pull request

Page 29: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer
Page 30: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

webhook

pull request

Page 31: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer
Page 32: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

webhook invoke runner

reports

pull request

Page 33: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

sonar.projectBaseDir=$WORKSPACE/src/github.com/mataharimall/orders sonar.projectKey=microservices:orders sonar.sources=./ sonar.inclusions=**/*.go sonar.exclusions=vendor/** sonar.coverage.exclusions=vendor/** sonar.test.exclusions=vendor/** sonar.golint.reportPath=src/github.com/mataharimall/orders/report.xml sonar.analysis.mode=preview sonar.github.oauth=<oauth-token> sonar.github.repository=mataharimall/orders sonar.github.pullRequest=$ghprbPullId

Page 34: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer
Page 35: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

webhook

pull request status

invoke runner

reports

pull request

Page 36: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer
Page 37: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Conclusions & Future Work

Page 38: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Automation improve our code review process

•With code review improvement we improved our code quality

•Review the code not the developer

Page 39: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Automation improve our code review process

•With code review improvement we improved our code quality

•Review the code not the developer

Page 40: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

•Automation improve our code review process

•With code review improvement we improved our code quality

•Review the code not the developer

Page 41: How We Automated Code Review Process · •Automation improve our code review process •With code review improvement we improved our code quality •Review the code not the developer

Questions?