SlideShare a Scribd company logo
1 of 52
Download to read offline
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 1/52
Assisted Code Review with
source{d} Lookout
Vadim Markovtsev
Machine Learning for
Large Scale Code Analysis
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 2/52
Plan
Origins
What is Lookout?
SDK
From scratch: typo correction
1.
2.
3.
4.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 3/52
Origins
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 4/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 5/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 6/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 7/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 8/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 9/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 10/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 11/52
Many efforts
target boring
stuff
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 12/52
Boring means
automatable
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 13/52
Automatable
≠ unattended
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 14/52
When to help?
While you type = IDE
While you check = CI
While you review = PR
Periodically, asynchronously = cron
•
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 15/52
IDE
Instant feedback
Rich information
Rich UI
Instant feedback
Many different IDEs and languages
+
+
+
–
–
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 16/52
CI
Part of the workflow
More time to run
No UI
Must not be wrong
Longer feedback loop
+
+
–
–
–
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 17/52
PR reviews
Part of the workflow
More time to run
UI
Should not be wrong
Longer feedback loop
+
+
+
–
–
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 18/52
cron
Plenty of time to run
Outside of the workflow
No UI
Longest feedback loop
+
–
–
–
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 19/52
Comparison
∈∈ workflow UI Feedback Rich info FP requirements
IDE ✓ ✓✓ instant ✓ low
CI ✓ ✗ minutes ✗ 0
PR ✓ ✓ minutes ✗ lowest
cron ✗ ✗ hours ✗ low
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 20/52
When to help?
While you type = IDE
While you check = CI
While you review = PR ←
Periodically, asynchronously
•
•
→
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 21/52
Welcome to the Codacy Blog
Insights for software builders
Subscribe
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 22/52
What is
Lookout?
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 23/52
Goals
Assisted code review platform
Tight git/GitHub integration
Analyzed language agnostic
Implementation language agnostic
Batteries included
•
•
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 24/52
Architecture
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 25/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 26/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 27/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 28/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 29/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 30/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 31/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 32/52
Push event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 33/52
PR event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 34/52
PR event
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 35/52
docs.sourced.tech/lookout
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 36/52
SDK
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 37/52
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 38/52
src-d/lookout-sdk
Single source of gRPC definitions
Low-level API: Go, Python
Low-level examples
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 39/52
src-d/lookout-sdk-ml
High-level Python API
Stateful analyzers
Integrated with source{d} ml ecosystem
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 40/52
Rule of
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 41/52
High-level API
class MyAnalyzer(Analyzer):
@classmethod
def train(cls, ...) -> AnalyzerModel:
# ...
def analyze(self, ...) -> [Comment]:
# do something with self.model
01.
02.
03.
04.
05.06.
07.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 42/52
Train
@with_uasts_and_contents
def train(cls,
ptr: ReferencePointer,
config: Dict[str, Any],
data_service: DataService,
files: Iterable[File]
) -> AnalyzerModel:
01.
02.
03.
04.
05.
06.
07.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 43/52
Analyze
@with_changed_uasts_and_contents
def analyze(self,
ptr_from: ReferencePointer,
ptr_to: ReferencePointer,
data_service: DataService,
changes: Iterable[Change]
) -> [Comment]:
01.
02.
03.
04.
05.
06.
07.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 44/52
Behind the scenes
gRPC servers and clients
Pooling and threading
Database of trained models
Caches
Logging
Metrics
•
•
•
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 45/52
Hands on
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 46/52
Objective
class Packfile:
Review
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 47/52
Objective
def read_packfile(...):
# ...
class Packfile:
Review
01.
02.
03.
04.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 48/52
Objective
def read_packfile(...):
# ...
class Packfle:
Review
01.
02.
03.
04.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 49/52
Steps
Install lookout-sdk-ml and autocorrect
Write typos.py
Fork a repo, create a PR
Generate a new GitHub Personal Access Token
Run our analyzer
1.
2.
3.
4.
5.
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 50/52
Summary
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 51/52
Summary
source{d} decided to build products for assisted code review
Lookout is a great platform for assisted code review
Writing new analyzers is easy and fun
•
•
•
2/4/2019 Assisted Code Review with source{d} Lookout
http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 52/52
Thank you
 src-d/lookout
 src-d/lookout-sdk-ml
 blog.sourced.tech
 medium.com/sourcedtech
 go.sourced.tech/newsletter
 sourcedtech
 vadimlearning bit.ly/2H8U5ra

More Related Content

What's hot

Open Source In Enterprises Apache2009 Beijing Jack Cai
Open Source In Enterprises Apache2009 Beijing Jack CaiOpen Source In Enterprises Apache2009 Beijing Jack Cai
Open Source In Enterprises Apache2009 Beijing Jack Cai
OpenSourceCamp
 

What's hot (7)

Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Flutter vs React Native | Edureka
Flutter vs React Native | EdurekaFlutter vs React Native | Edureka
Flutter vs React Native | Edureka
 
Breizhcamp: Créer un bot, pas si simple. Faisons le point.
Breizhcamp: Créer un bot, pas si simple. Faisons le point.Breizhcamp: Créer un bot, pas si simple. Faisons le point.
Breizhcamp: Créer un bot, pas si simple. Faisons le point.
 
Flutter festival ppt
Flutter festival ppt Flutter festival ppt
Flutter festival ppt
 
Open Source In Enterprises Apache2009 Beijing Jack Cai
Open Source In Enterprises Apache2009 Beijing Jack CaiOpen Source In Enterprises Apache2009 Beijing Jack Cai
Open Source In Enterprises Apache2009 Beijing Jack Cai
 
DEEP: a user success story
DEEP: a user success storyDEEP: a user success story
DEEP: a user success story
 
Introduction to License Compliance and My research (D. German)
Introduction to License Compliance and My research (D. German)Introduction to License Compliance and My research (D. German)
Introduction to License Compliance and My research (D. German)
 

Similar to Assisted code review with source{d} lookout

Similar to Assisted code review with source{d} lookout (20)

Spring Projects Infrastructure
Spring Projects InfrastructureSpring Projects Infrastructure
Spring Projects Infrastructure
 
Spring Projects Infrastructure
Spring Projects InfrastructureSpring Projects Infrastructure
Spring Projects Infrastructure
 
NetDevOps Development Environments
NetDevOps Development EnvironmentsNetDevOps Development Environments
NetDevOps Development Environments
 
DevNet Associate : Python introduction
DevNet Associate : Python introductionDevNet Associate : Python introduction
DevNet Associate : Python introduction
 
CloudNativeAalborg2023_Jan.pdf
CloudNativeAalborg2023_Jan.pdfCloudNativeAalborg2023_Jan.pdf
CloudNativeAalborg2023_Jan.pdf
 
Easing IoT Development for Novice Programmers Through Code Recipes
Easing IoT Development for Novice Programmers Through Code RecipesEasing IoT Development for Novice Programmers Through Code Recipes
Easing IoT Development for Novice Programmers Through Code Recipes
 
The Software Developer’s Guide to Open Source Hardware
The Software Developer’s Guide to Open Source HardwareThe Software Developer’s Guide to Open Source Hardware
The Software Developer’s Guide to Open Source Hardware
 
Open Developer Platform: What Is It and Why Should I Care? Maurizio Pillitu
Open Developer Platform: What Is It and Why Should I Care? Maurizio PillituOpen Developer Platform: What Is It and Why Should I Care? Maurizio Pillitu
Open Developer Platform: What Is It and Why Should I Care? Maurizio Pillitu
 
Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808
Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808
Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
 
Enterprise DevOps Series: Using VS Code & Zowe
Enterprise DevOps Series: Using VS Code & ZoweEnterprise DevOps Series: Using VS Code & Zowe
Enterprise DevOps Series: Using VS Code & Zowe
 
Golang skills pre-session
Golang skills pre-sessionGolang skills pre-session
Golang skills pre-session
 
C language in our world 2019
C language in our world 2019C language in our world 2019
C language in our world 2019
 
CI/CD with OCP
CI/CD with OCPCI/CD with OCP
CI/CD with OCP
 
Crossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approachCrossing the low-code and pro-code chasm: a platform approach
Crossing the low-code and pro-code chasm: a platform approach
 
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...INTERFACE, by apidays  - Crossing the low-code and pro-code chasm: a platform...
INTERFACE, by apidays - Crossing the low-code and pro-code chasm: a platform...
 
Digital Fabrication Studio v.0.2: Version Control System: Files
Digital Fabrication Studio v.0.2: Version Control System: FilesDigital Fabrication Studio v.0.2: Version Control System: Files
Digital Fabrication Studio v.0.2: Version Control System: Files
 
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScriptENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
 
DWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHubDWX 2022 - DevSecOps mit GitHub
DWX 2022 - DevSecOps mit GitHub
 
What's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyond
 

More from source{d}

Deduplication on large amounts of code
Deduplication on large amounts of codeDeduplication on large amounts of code
Deduplication on large amounts of code
source{d}
 

More from source{d} (15)

Overton, Apple Flavored ML
Overton, Apple Flavored MLOverton, Apple Flavored ML
Overton, Apple Flavored ML
 
Unlocking Engineering Observability with advanced IT analytics
Unlocking Engineering Observability with advanced IT analyticsUnlocking Engineering Observability with advanced IT analytics
Unlocking Engineering Observability with advanced IT analytics
 
What's new in the latest source{d} releases!
What's new in the latest source{d} releases!What's new in the latest source{d} releases!
What's new in the latest source{d} releases!
 
Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...
 
Gitbase, SQL interface to Git repositories
Gitbase, SQL interface to Git repositoriesGitbase, SQL interface to Git repositories
Gitbase, SQL interface to Git repositories
 
Deduplication on large amounts of code
Deduplication on large amounts of codeDeduplication on large amounts of code
Deduplication on large amounts of code
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetup
 
Inextricably linked reproducibility and productivity in data science and ai ...
Inextricably linked reproducibility and productivity in data science and ai  ...Inextricably linked reproducibility and productivity in data science and ai  ...
Inextricably linked reproducibility and productivity in data science and ai ...
 
source{d} Engine - your code as data
source{d} Engine - your code as datasource{d} Engine - your code as data
source{d} Engine - your code as data
 
Introduction to the source{d} Stack
Introduction to the source{d} Stack Introduction to the source{d} Stack
Introduction to the source{d} Stack
 
source{d} Engine: Exploring git repos with SQL
source{d} Engine: Exploring git repos with SQLsource{d} Engine: Exploring git repos with SQL
source{d} Engine: Exploring git repos with SQL
 
Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout
 
Machine learning on Go Code
Machine learning on Go CodeMachine learning on Go Code
Machine learning on Go Code
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
Machine learning on source code
Machine learning on source codeMachine learning on source code
Machine learning on source code
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Assisted code review with source{d} lookout

  • 1. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 1/52 Assisted Code Review with source{d} Lookout Vadim Markovtsev Machine Learning for Large Scale Code Analysis
  • 2. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 2/52 Plan Origins What is Lookout? SDK From scratch: typo correction 1. 2. 3. 4.
  • 3. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 3/52 Origins
  • 4. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 4/52
  • 5. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 5/52
  • 6. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 6/52
  • 7. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 7/52
  • 8. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 8/52
  • 9. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 9/52
  • 10. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 10/52
  • 11. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 11/52 Many efforts target boring stuff
  • 12. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 12/52 Boring means automatable
  • 13. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 13/52 Automatable ≠ unattended
  • 14. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 14/52 When to help? While you type = IDE While you check = CI While you review = PR Periodically, asynchronously = cron • • • •
  • 15. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 15/52 IDE Instant feedback Rich information Rich UI Instant feedback Many different IDEs and languages + + + – –
  • 16. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 16/52 CI Part of the workflow More time to run No UI Must not be wrong Longer feedback loop + + – – –
  • 17. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 17/52 PR reviews Part of the workflow More time to run UI Should not be wrong Longer feedback loop + + + – –
  • 18. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 18/52 cron Plenty of time to run Outside of the workflow No UI Longest feedback loop + – – –
  • 19. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 19/52 Comparison ∈∈ workflow UI Feedback Rich info FP requirements IDE ✓ ✓✓ instant ✓ low CI ✓ ✗ minutes ✗ 0 PR ✓ ✓ minutes ✗ lowest cron ✗ ✗ hours ✗ low
  • 20. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 20/52 When to help? While you type = IDE While you check = CI While you review = PR ← Periodically, asynchronously • • → •
  • 21. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 21/52 Welcome to the Codacy Blog Insights for software builders Subscribe
  • 22. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 22/52 What is Lookout?
  • 23. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 23/52 Goals Assisted code review platform Tight git/GitHub integration Analyzed language agnostic Implementation language agnostic Batteries included • • • • •
  • 24. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 24/52 Architecture
  • 25. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 25/52 Push event
  • 26. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 26/52 Push event
  • 27. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 27/52 Push event
  • 28. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 28/52 Push event
  • 29. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 29/52 Push event
  • 30. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 30/52 Push event
  • 31. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 31/52
  • 32. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 32/52 Push event
  • 33. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 33/52 PR event
  • 34. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 34/52 PR event
  • 35. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 35/52 docs.sourced.tech/lookout
  • 36. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 36/52 SDK
  • 37. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 37/52
  • 38. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 38/52 src-d/lookout-sdk Single source of gRPC definitions Low-level API: Go, Python Low-level examples • • •
  • 39. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 39/52 src-d/lookout-sdk-ml High-level Python API Stateful analyzers Integrated with source{d} ml ecosystem • • •
  • 40. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 40/52 Rule of
  • 41. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 41/52 High-level API class MyAnalyzer(Analyzer): @classmethod def train(cls, ...) -> AnalyzerModel: # ... def analyze(self, ...) -> [Comment]: # do something with self.model 01. 02. 03. 04. 05.06. 07.
  • 42. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 42/52 Train @with_uasts_and_contents def train(cls, ptr: ReferencePointer, config: Dict[str, Any], data_service: DataService, files: Iterable[File] ) -> AnalyzerModel: 01. 02. 03. 04. 05. 06. 07.
  • 43. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 43/52 Analyze @with_changed_uasts_and_contents def analyze(self, ptr_from: ReferencePointer, ptr_to: ReferencePointer, data_service: DataService, changes: Iterable[Change] ) -> [Comment]: 01. 02. 03. 04. 05. 06. 07.
  • 44. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 44/52 Behind the scenes gRPC servers and clients Pooling and threading Database of trained models Caches Logging Metrics • • • • • •
  • 45. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 45/52 Hands on
  • 46. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 46/52 Objective class Packfile: Review
  • 47. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 47/52 Objective def read_packfile(...): # ... class Packfile: Review 01. 02. 03. 04.
  • 48. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 48/52 Objective def read_packfile(...): # ... class Packfle: Review 01. 02. 03. 04.
  • 49. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 49/52 Steps Install lookout-sdk-ml and autocorrect Write typos.py Fork a repo, create a PR Generate a new GitHub Personal Access Token Run our analyzer 1. 2. 3. 4. 5.
  • 50. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 50/52 Summary
  • 51. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 51/52 Summary source{d} decided to build products for assisted code review Lookout is a great platform for assisted code review Writing new analyzers is easy and fun • • •
  • 52. 2/4/2019 Assisted Code Review with source{d} Lookout http://vmarkovtsev.github.io/mloncode-meetup-2019-webinar/ 52/52 Thank you  src-d/lookout  src-d/lookout-sdk-ml  blog.sourced.tech  medium.com/sourcedtech  go.sourced.tech/newsletter  sourcedtech  vadimlearning bit.ly/2H8U5ra