SlideShare una empresa de Scribd logo
1 de 89
Descargar para leer sin conexión
All change lists must be
reviewed. Period.
“Review your code like a Googler”
2013 Dariusz Łuksza
Dariusz Łuksza, CollabNet
dariusz@luksza.org
@dluksza
2013 Dariusz Łuksza
Are you Git?
pre-requirements
First rule of Code Review:
2013 Dariusz Łuksza
Your code is not your wife...
pre-requirements
First rule of Code Review
and OpenSource:
2013 Dariusz Łuksza
Your code is not your wife...
pre-requirements
2013 Dariusz Łuksza
Your code is not your wife...
you can share it!
pre-requirements
First rule of Code Review
and OpenSource:
2013 Dariusz Łuksza
I'm here for
You!
2013 Dariusz Łuksza
Next ~47min.
● Code Review & Types
● Post-commit vs pre-commit
● The Gerrit
● EGit + Mylyn Review Gerrit Connector
● Command line→
● Code Review Tips
● Gerrit++
● Q&A
Code reviews with Gerrit
by Mateusz Szczap
@ Marmolana 14:50
2013 Dariusz Łuksza
Code Review
post-commit review
(formal code review)
2013 Dariusz Łuksza
post-commit review
(formal code review)
2013 Dariusz Łuksza
2013 Dariusz Łuksza
Flickr: markcph
post-commit review
(formal code review)
2013 Dariusz Łuksza
Flickr: markcph
post-commit review
(formal code review)
Coffee, absolute
must have during
formal code
reviews
2013 Dariusz Łuksza
Flickr: sebastian_bergmann
post-commit review
(formal code review)
2013 Dariusz Łuksza
Flickr: bike
post-commit review
(formal code review)
2013 Dariusz Łuksza
review on request
(post- or pre-commit)
2013 Dariusz Łuksza
review on request
(post- or pre-commit)
90 min
later
OK, so where
I was before...
Hi Jeff, could you
review my changes
before I submit
I need a review...
OK, lets go!
Can I interrupt you
for a moment?You already
interrupted me...
Sure you can,
what is it?
this loop iterates
over… mhm... and then
it brakes...
if (req != null) {
for (i = 0; …
if (...) break;
...
I finished my task and need final
code review... would you like
to look on it?
emmmm … OK...
153 min
later
9 min
later
finally I can get
back to my task...
… and then...
2013 Dariusz Łuksza
asynchronous review
with Gerrit
(pre-commit)
2013 Dariusz Łuksza
Gerrit Code Review
this loop iterates
over… mhm... and then
it brakes...
if (req != null) {
for (i = 0; …
if (...) break;
...
found it!! HAHAHA
OK, so now,
commit and
push for review!
… step into...
step over...
… step over...
step over...
It's time to check others
review requests
I'm invincible!!
Great! There are requests
from Tom, Sara and Jim...
let me see...
post-commit
vs.
pre-commit
2013 Dariusz Łuksza
Flickr: bike
2013 Dariusz Łuksza
post-commit vs. pre-commit
Flickr: sriram
VS.
2013 Dariusz Łuksza
The Gerrit
The Gerrit
● Created for Android OpenSource project
● Designed to bring Google's code review feeling to
Android community
● Pure Java based
● Has vibrant community
● Used in many OpenSource project's and Enterprise
companies
● Can be used as regular Git server without code review
● Supports branch based permissions
● It is getting more and more extend-able
2013 Dariusz Łuksza
2013 Dariusz Łuksza
Who uses Gerrit?
2013 Dariusz Łuksza
let's play with
Gerrit
Demo Time!
Preconditions:
– You are joining new team with already existing
project
– Somebody already creates yours account in LDAP
– You already generated yours SSH key
– Already have Eclipse Kepler with EGit and Mylyn
Gerrit connector installed
2013 Dariusz Łuksza
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Meet Fred
First login into Gerrit
2013 Dariusz Łuksza
First login into Gerrit
2013 Dariusz Łuksza
fred
Insert yours
credentials here
First login into Gerrit
2013 Dariusz Łuksza
First login into Gerrit
2013 Dariusz Łuksza
fred
Yours SSH public
key goes here,
remember to
click 'Add'
First login into Gerrit
2013 Dariusz Łuksza
First login into Gerrit
2013 Dariusz Łuksza
fred
Finally, click
'Continue'
First login into Gerrit
2013 Dariusz Łuksza
First login into Gerrit
2013 Dariusz Łuksza
fred
You are logged in
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Add task
repository
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
If you don't have
Gerrit connector on
the list, use 'Install
More Connectors'
button
Select Gerrit and
click 'Next'
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Provide server
data
Validate before
save
Finally, click
'Finish' to save
new connection
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Of course I would like to create query for
this connector
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Name the query
For our simple use case
'All open changes' will
be enough
Configure Mylyn Connector
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
After successful configuration you will see
task repository and query in proper
Eclipse views
Cloning project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Because in git
repository there is no
Eclipse
configuration file (like
eg. .project) we need
to import it as
'general project'
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Now we can import nested Maven projects
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Clone project from Gerrit
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Create new feature branch
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Create new feature branch
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Change something in
repository
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Remember to
check generation of
'Change-Id' tag
Leave this line as it is,
EGit will generate
'Change-Id' for you
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Now push yours
changes to Gerrit
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Provide name of
branch to which
change should
be merged after
successful
review
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Create first change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
After some time
you will see
yours change
on list of open
changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Meet Roman
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Double click on
file will open a
compare view
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
You can provide
comments directly
for each code line
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
As you see Jenkins
already have an
opinion about this
change
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
You can publish yours
comments using 'Publish
Comments...' button
Review change
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Now you can provide
yours vote and comment
for this change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Switch back to Fred
View incoming comments
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
You will be
informed about
new comments
on yours reviews
Abandon change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
If you push something by
accident you can always
abandon such change
Abandon change
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Pushing multiple changes
Push multiple commits
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Create two or more
commits in a row
and use standard EGit
'Push to Gerrit...' flow
Push multiple commits
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Gerrit will create separate
review requests for each
commit
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Switch to Roman
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Of course you will see
two open changes, let's
review last one!
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Jenkins already verified
this change, so let's
merge it!
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Last step is to push
'Submit' button
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Change was submitted,
but it is not merged
because it's parent change
is still under review. It will
be automatically merged
after parent will be
accepted
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Let's review
second
change
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Let's review
second
change
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Of course it was merged
successfully
Review connected changes
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Of course it was also merged
successfully
Wat is going
with previously
submitted
change?
2013 Dariusz Łuksza2013 Dariusz Łuksza
roman
Roman goes to Bahama
(continue other's work)
Continue other's work
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
All changes are stored
in Gerrit, you can
fetch each patch set
version when ever
you want to
Continue other's work
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Provide meaningful
branch name and
click 'Finish'
Continue other's work
2013 Dariusz Łuksza2013 Dariusz Łuksza
fred
Done, you have
Roman's changes
locally and can
continue his work
Code Review Tips
● Be constructive, don't hate, always propose or point to
solution
● Don't take comments personally, they are only about
code and how you can improve, code and your skills
● Code review is like refactoring of code that you have
written long time ago … you need to understand
author's intention
● It's like TDD, review code before it hit main repository.
This will guarantee the best application quality
● Do code review on daily basis … remember when you
are not reviewing other's code then application is not
progressing
2013 Dariusz Łuksza
2013 Dariusz Łuksza
Dariusz Łuksza, CollabNet
dariusz@luksza.org
@dluksza
“Review your code like a Googler”
Q&A
2013 Dariusz Łuksza
BTW. Don't forget about DevCrowd
conference in Szczecin in 2014. More
info you can found at:
http://devcrowd.pl

Más contenido relacionado

Más de Dariusz Łuksza

Guiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landGuiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landDariusz Łuksza
 
Gerrit Code Review - The Introduction
Gerrit Code Review - The IntroductionGerrit Code Review - The Introduction
Gerrit Code Review - The IntroductionDariusz Łuksza
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript PluginsDariusz Łuksza
 
Eclipse of idleness and focus on current task (rev. 2)
Eclipse of idleness and focus on current task (rev. 2)Eclipse of idleness and focus on current task (rev. 2)
Eclipse of idleness and focus on current task (rev. 2)Dariusz Łuksza
 

Más de Dariusz Łuksza (6)

Guiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landGuiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise land
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Put more eyes on code
Put more eyes on codePut more eyes on code
Put more eyes on code
 
Gerrit Code Review - The Introduction
Gerrit Code Review - The IntroductionGerrit Code Review - The Introduction
Gerrit Code Review - The Introduction
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript Plugins
 
Eclipse of idleness and focus on current task (rev. 2)
Eclipse of idleness and focus on current task (rev. 2)Eclipse of idleness and focus on current task (rev. 2)
Eclipse of idleness and focus on current task (rev. 2)
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Review your code like a Googler