SlideShare a Scribd company logo
Semi Automatic
 Code Review
    Richard Huang
      @flyerhzm
About Me
Work for GREE
• OpenFeint platform
OpenSource
• create rails_best_practices gem
• build railsbp.com website
• @flyerhzm, @railsbp
Develop


Deploy              Review



    Merge          QA
Manual work
   easy to introduce bugs

Automation
   simple, accurate, less buggy
Develop


Deploy    Manually Coding      Review
         Automatic Unit Test



    Merge                QA
Develop


Deploy   Totally Manual    Review



    Merge                 QA
Develop


Deploy Automatic Script Test Review
           Manually Verify



     Merge                   QA
Develop


Deploy    Automatic by Git      Review
         Manually fix conflicts



    Merge                 QA
Develop


Deploy   Automatic by    Review
          Capistrano



    Merge               QA
Develop

              Could
Deploy      automate?    Review



    Merge               QA
What to Review?
Follow coding guidelines      Performant

 Better coding syntax          Scalable

Remove unused methods


   Easy, and code          Important, but depends
becomes maintainable           on experience
What to Review?

 Follow coding guides
                        What if we can
 Better coding syntax    review these
                        automatically?
Remove unused methods
What to Review?

                       Performance
 And focus on this
more important stuff
                         Scalable
How?

rails_best_practices gem
• analyze source code
• give developers suggestions to refactor
Examples



    app/controllers/posts_controller.rb:5 -
              use scope access
Examples


     app/controllers/posts_controller.rb:2 -
       use model association (for @post)
Examples

     app/views/shared/_head.html.erb:16 -
      use query attribute (@user.login?)
Integration
Guard
• https://github.com/logankoester/guard-
   rails_best_practices
Jenkins
• http://developer.aiming-inc.com/ci/rails-
   bestpractices-in-jenkins/
Internal system
Code Review Service?
Online Service

railsbp.com
• automatically review
• collaborate with co-workers
• track history
• configure what to review
Report               Push Code


             Notify
Railsbp                 Github
           Check out
            Analyze
github hooks
Extend
https://github.com/railsbp/rails_best_practices/wiki/
          How-to-write-your-own-check-list
“Use Try” Checker Plugin
author ? author.name : nil => author.try(:name)
Open Sourced

rails_best_practices gem
• https://github.com/railsbp/rails_best_practices
railsbp.com
• https://github.com/railsbp/railsbp.com
Demo
https://vimeo.com/40976161
Thanks
flyerhzm@gmail.com
    @flyerhzm

More Related Content

What's hot

Wax on, wax off
Wax on, wax offWax on, wax off
Wax on, wax off
Bol.com Techlab
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
Anton Shapin
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
toddbr
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - Basics
Knoldus Inc.
 
Open Source based API Functional and Performance Testing
Open Source based API Functional and Performance TestingOpen Source based API Functional and Performance Testing
Open Source based API Functional and Performance Testing
Nordic APIs
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
Luís Barros Nóbrega
 
Api testing
Api testingApi testing
Api testing
HamzaMajid13
 
Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...
Anton Shapin
 
API Testing with Open Source Code and Cucumber
API Testing with Open Source Code and CucumberAPI Testing with Open Source Code and Cucumber
API Testing with Open Source Code and Cucumber
SmartBear
 
Streamlining API with Swagger.io
Streamlining API with Swagger.ioStreamlining API with Swagger.io
Streamlining API with Swagger.io
Victor Augusteo
 
From manual to automation
From manual to automationFrom manual to automation
From manual to automation
Anton Shapin
 
Design & Prototype an API
Design & Prototype an APIDesign & Prototype an API
Design & Prototype an API
Postman
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
Sauce Labs
 
API Testing
API TestingAPI Testing
API Testing
Bikash Sharma
 
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
Android Continuous Integration and Automation - Enrique Lopez Manas, SixtAndroid Continuous Integration and Automation - Enrique Lopez Manas, Sixt
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
DroidConTLV
 
Super powered API testing
Super powered API testing Super powered API testing
Super powered API testing
postmanclient
 
Trust Your Pipeline - Automatically Testing and End-to-End Java Application
Trust Your Pipeline - Automatically Testing and End-to-End Java ApplicationTrust Your Pipeline - Automatically Testing and End-to-End Java Application
Trust Your Pipeline - Automatically Testing and End-to-End Java Application
Elias Nogueira
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
Elias Nogueira
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
Postman
 
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
Sauce Labs
 

What's hot (20)

Wax on, wax off
Wax on, wax offWax on, wax off
Wax on, wax off
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - Basics
 
Open Source based API Functional and Performance Testing
Open Source based API Functional and Performance TestingOpen Source based API Functional and Performance Testing
Open Source based API Functional and Performance Testing
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Api testing
Api testingApi testing
Api testing
 
Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...
 
API Testing with Open Source Code and Cucumber
API Testing with Open Source Code and CucumberAPI Testing with Open Source Code and Cucumber
API Testing with Open Source Code and Cucumber
 
Streamlining API with Swagger.io
Streamlining API with Swagger.ioStreamlining API with Swagger.io
Streamlining API with Swagger.io
 
From manual to automation
From manual to automationFrom manual to automation
From manual to automation
 
Design & Prototype an API
Design & Prototype an APIDesign & Prototype an API
Design & Prototype an API
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
API Testing
API TestingAPI Testing
API Testing
 
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
Android Continuous Integration and Automation - Enrique Lopez Manas, SixtAndroid Continuous Integration and Automation - Enrique Lopez Manas, Sixt
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
 
Super powered API testing
Super powered API testing Super powered API testing
Super powered API testing
 
Trust Your Pipeline - Automatically Testing and End-to-End Java Application
Trust Your Pipeline - Automatically Testing and End-to-End Java ApplicationTrust Your Pipeline - Automatically Testing and End-to-End Java Application
Trust Your Pipeline - Automatically Testing and End-to-End Java Application
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
 
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
POST/CON 2019 Workshop: Testing, Automated Testing, and Reporting APIs with P...
 
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
10x Test Coverage, Less Drama: Shift Left Functional & Performance Testing
 

Similar to Semi Automatic Code Review

Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
ssuser9e7c64
 
Automated perf optimization - html5 dev conf
Automated perf optimization - html5 dev confAutomated perf optimization - html5 dev conf
Automated perf optimization - html5 dev conf
Matthew Lancaster
 
Ruby on Rails Plugins - Rich Collins
Ruby on Rails Plugins - Rich CollinsRuby on Rails Plugins - Rich Collins
Ruby on Rails Plugins - Rich Collins
Rich Collins
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
Paul Gower
 
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan KuštInfinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
Gowthami Buddi
 
2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview
Arnaud Héritier
 
Quality assurance of large c++ projects
Quality assurance of large c++ projectsQuality assurance of large c++ projects
Quality assurance of large c++ projects
corehard_by
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenches
Michael Medin
 
Developer-friendly SAST in DevOps Pipeline.pptx
Developer-friendly SAST in DevOps Pipeline.pptxDeveloper-friendly SAST in DevOps Pipeline.pptx
Developer-friendly SAST in DevOps Pipeline.pptx
SamSbp
 
Rails project code review
Rails project code reviewRails project code review
Rails project code reviewRichard Huang
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
Abhijeet Vaikar
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
Sauce Labs
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
Paul Gower
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019
Karim Fanadka
 
Solving micro-services and one site problem
Solving micro-services and one site problemSolving micro-services and one site problem
Solving micro-services and one site problem
aragavan
 
Merging Security with DevOps - An AppSec Perspective
Merging Security with DevOps - An AppSec PerspectiveMerging Security with DevOps - An AppSec Perspective
Merging Security with DevOps - An AppSec Perspective
Abhay Bhargav
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Vadym Kazulkin
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
hemasubbu08
 
Web Automation Testing for developers?
Web Automation Testing for developers?Web Automation Testing for developers?
Web Automation Testing for developers?
Victor Kushchenko
 

Similar to Semi Automatic Code Review (20)

Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Automated perf optimization - html5 dev conf
Automated perf optimization - html5 dev confAutomated perf optimization - html5 dev conf
Automated perf optimization - html5 dev conf
 
Ruby on Rails Plugins - Rich Collins
Ruby on Rails Plugins - Rich CollinsRuby on Rails Plugins - Rich Collins
Ruby on Rails Plugins - Rich Collins
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan KuštInfinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
 
2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview
 
Quality assurance of large c++ projects
Quality assurance of large c++ projectsQuality assurance of large c++ projects
Quality assurance of large c++ projects
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenches
 
Developer-friendly SAST in DevOps Pipeline.pptx
Developer-friendly SAST in DevOps Pipeline.pptxDeveloper-friendly SAST in DevOps Pipeline.pptx
Developer-friendly SAST in DevOps Pipeline.pptx
 
Rails project code review
Rails project code reviewRails project code review
Rails project code review
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Modern software testing and processes 2019
Modern software testing and processes 2019Modern software testing and processes 2019
Modern software testing and processes 2019
 
Solving micro-services and one site problem
Solving micro-services and one site problemSolving micro-services and one site problem
Solving micro-services and one site problem
 
Merging Security with DevOps - An AppSec Perspective
Merging Security with DevOps - An AppSec PerspectiveMerging Security with DevOps - An AppSec Perspective
Merging Security with DevOps - An AppSec Perspective
 
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
Github Copilot vs Amazon CodeWhisperer for Java developers at JCON 2023
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
 
Web Automation Testing for developers?
Web Automation Testing for developers?Web Automation Testing for developers?
Web Automation Testing for developers?
 

More from Richard Huang

rails_best practices_rubykaigi
rails_best practices_rubykaigirails_best practices_rubykaigi
rails_best practices_rubykaigi
Richard Huang
 
使用Rails best practices做代码审查
使用Rails best practices做代码审查使用Rails best practices做代码审查
使用Rails best practices做代码审查Richard Huang
 
Rails bestpractices.com
Rails bestpractices.comRails bestpractices.com
Rails bestpractices.com
Richard Huang
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
Richard Huang
 
Css sprite best practices
Css sprite best practicesCss sprite best practices
Css sprite best practices
Richard Huang
 
Static Code Analysis For Ruby
Static Code Analysis For RubyStatic Code Analysis For Ruby
Static Code Analysis For Ruby
Richard Huang
 
Email Contacts For Invitation
Email Contacts For InvitationEmail Contacts For Invitation
Email Contacts For InvitationRichard Huang
 

More from Richard Huang (7)

rails_best practices_rubykaigi
rails_best practices_rubykaigirails_best practices_rubykaigi
rails_best practices_rubykaigi
 
使用Rails best practices做代码审查
使用Rails best practices做代码审查使用Rails best practices做代码审查
使用Rails best practices做代码审查
 
Rails bestpractices.com
Rails bestpractices.comRails bestpractices.com
Rails bestpractices.com
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
 
Css sprite best practices
Css sprite best practicesCss sprite best practices
Css sprite best practices
 
Static Code Analysis For Ruby
Static Code Analysis For RubyStatic Code Analysis For Ruby
Static Code Analysis For Ruby
 
Email Contacts For Invitation
Email Contacts For InvitationEmail Contacts For Invitation
Email Contacts For Invitation
 

Recently uploaded

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 

Semi Automatic Code Review

Editor's Notes

  1. \n
  2. \n
  3. This is our development lifecycle for each sprint, we implement new features or fix bugs, we ask other engineers to do code review, qa will verify our changes, then we merge it into release branch, and finally deploy to production server. I think most teams using rails have a similar development lifecycle like this.\n
  4. In the development lifecycle, some processes can be automatic, some have to be done manually. Manual works are alway easy to introduce bugs into your product, while automation makes things simple, more accurate and less buggy, so we try do processes automatically as much as possible.\n
  5. In our development process, we write codes manually, but sometimes automatically generate code, we also wrote a lot of unit test and integration test code to run tests automatically.\n
  6. In code review process, we have to do it manually, sometimes sitting together, face to face review, sometimes just sending a code compare link and leave comments on github.\n
  7. In qa process, we have a continuous integration server to guarantee all unit tests and integration tests are green, we have scripts to do regression tests. Besides these, we also manually verify the product.\n
  8. In merge process, we use the version control system, git, to automatically merge feature branch into release branch.  Only when conflicts occurred, do we need to manually fix them.\n
  9. In the deploy process, thanks to Capistrano, we can release new features almost 100 percent automatically.\n
  10. As you seen, we have more or less automation in every process except code review, code review is very important that it can catch most bugs and potential performance issues, but code review really depends on engineers, e.g. if engineers are familiar with ruby and rails, they will suggest opportunities to use a lot of rails built-in helper methods, and if engineers have strong knowledge with database and http protocol, they will point out where you can optimize db queries or add cache layer. But could we partially automate code review process? Of course yes.\n
  11. Let's see what we review in general. It contains 2 parts, the first part is easy, its goal is to make code more readable and maintainable, like following the team's coding guideline, using better coding syntax and removing unused methods. The other is more important but complicated, like reviewing whether code is performant and scalable, it depends on programming experience, you will see senior engineers and team leaders spend more time on this part when they do code review.\n
  12. What if we could review the first part automatically?\n
  13. So engineers can focus on the more important stuff when doing code reviews.\n\n
  14. I have built the rails_best_practices gem over the last 2 years, I created it for analyzing source code of rails projects, giving developers some suggestions to improve their code quality.\n
  15. For example, in the edit action on top, the code reads a post from the database, then verifies the privilege by checking if the current user is the user of the post, rails_best_practices will tell you there is a bad smell in posts_controller line 5, it suggests you use scope access to simplify the logic to the bottom code, read the post from current_user's posts, if the post does not belong to current user, then a NotFoundError will be raised.\n
  16. A similar example, in the top code, before creating a new post, it assigns the user_id from current_user. The rails_best_practices gem will tell you that you should use scope association like the  bottom code does, creating a post with current_user.posts will automatically set the user_id.\n
  17. This is an example of a suggestion to use rails built-in helper, the code on the top reads user's login attribute then checks if it is present, rails_best_practices gem will suggest that you use the query attribute, by directly calling login? on user. \n\n
  18. I saw more and more developers begin to use the rails_best_practices gem, someone integrated it into guard, running rails_best_practices frequently in development, and someone integrated it into jenkins, running rails_best_practices on their continuous integration server. I also saw a team building an internal system based on rails_best_practices to score their developers' code.\n
  19. There was a chance that our team decided to pay down technical debt, you know we have a large rails codebase, started in early 2009, there are a lot of unused classes, unused methods, dead routes and old ugly code. Then I used the gem to refactor and cleanup our codebase, but rails_best_practices gem generates the local analysis result in terminal, I found it's not easy to share the analysis result with the team, and I need to contact the author of the code which you want to refactor, and discuss with them to see if the code is safe to be removed. Then an idea jumped into my mind - why not build an online code review service based on the gem?\n
  20. So I built the web service railsbp.com early this year, just like travis-ci for continuous integration service, railsbp.com provides an online code quality check service. Every time you push to github, the code check service will be executed automatically. You can easily share the analysis with your team collaborators. ralsbp.com keeps every analysis result, so you can track the history to see if your code quality is improving or not. You can also configure what to review, e.g. if you don't care about using query attributes, you can disable that checker on railsbp.com.\n
  21. Now I built railsbp.com integrated with github, first you need to register your github repository on railsbp.com, every time you push code to github, github will notify railsbp, railsbp will check out your source code, analyze your code quality, then generate an analysis for your commits. You and your collaborators can all view the report, then refactor the bad smells according to the report.\n
  22. There is a railsbp service hook on your github repository admin page, after you register a repository on railsbp.com, you will be assigned a token, set the token on github hook page and activate this hook, then railsbp can receive the notification from github, check out and analyze your source code.\n
  23. This is an analysis report page, it tells you the current commit id and commit message, lists all code smells in your repository, for each code smell it tells you the filename, line number, warning message, which commit and who introduced this code smell. The highlight line indicates this bad smell is introduced by the current commit. You can click the warning message, and it will bring you to a page which gives you a suggestion how to refactor the bad smell, and you can click the filename, it will bring you to the github file page, if you want, you can fix the bad smell directly on github. So before you ask a senior engineer to do code review for you, you can review it on railsbp.com by yourself, it helps you improve the code quality and also saves other engineers' time.\n
  24. This is the history tracking page, the visual chart shows how many code smells in your repository historically, so you can easily figure out if your code quality is improving, there is also a table that lists each analysis result, clicking any item will bring you to the detail analysis report page.\n
  25. It is also configurable, I understand that not all checkers in the gem are suitable for all rails projects, some rails teams may have different idea of rails best practices, so, you can configure what checkers should be activated, and turn off other checkers as you like. Here are parts of configurations, you can select any checker that you think is suitable to your team, and you can change the parameters of some checkers for your team.\n
  26. You can also add or remove collaborators, to grant them privilege to configure your repository on railsbp.com. And for simplicity, you can synchronize your collaborators from github.\n\n
  27. So far the gem may not be strong enough to find out all of the code smells, probably there are some code guidelines in your team that the gem can't analyze, but don't be depressed, the gem provides a way to extend it for your team by writing plugins.\n
  28. Here I will give you an example how to write the plugin, as you know, rails provides a convenient helper method try, calling try on nil object always returns nil. I want to check the rails project to find all code that is doing the same thing as the try method, so that I can replace the manual code by using the try method. Let's build a use try checker plugin.\n
  29. This is the test file for the use try checker plugin, it's easy to read, if I use author ? author.name : nil, or use author.nil? ? nil : author.name, then I should use author.try(:name) instead, the gem should tell me the filename, line number, warning message with use try on author, right? And for other code, there should be no such bad smell detected. Every time you write a plugin for rails_best_practices gem, be sure you write such test code first.\n\n
  30. This is the use try checker plugin implementation code, I recommend you to read the documentation of ripper in ruby 1.9 first, it's a library to convert ruby source code to syntax tree. Here we only check ifop node in all files, it checks for the 2 cases we have written in the test code. As you can see, writing a code checker plugin is not too difficult. You can write plugins according to your team's coding guidelines, so it keeps your codebase good quality all the time.\n\n
  31. \n
  32. \n
  33. \n