SlideShare a Scribd company logo
DISTRIBUTED
REFACTORING WITH
GRADLE LINT
Jon Schneider
Netflix Engineering Tools
@jon_k_schneider
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
NETFLIX IS KNOWN FOR
RAPID INNOVATION.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
WE WANT TO MINIMIZE DRAG FROM LATE
ADOPTERS.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
NETFLIX CULTURE IS
FREEDOM AND RESPONSIBILITY
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT
ALLOWS US TO
DISTRIBUTE
CHANGE.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THE UNUSED
DEPENDENCIES
RULE HELPS
MAINTAIN GOOD
DEPENDENCY
HYGIENE.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT SUPPORTS
SHIPPING METRICS TO
nebula.metrics
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
CREATING A MORE COMPLEX RULE
"All wars should be published to our
binary repository"
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
1: APPLY IMMEDIATELY AFTER THE WAR
PLUGIN
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') {
addBuildLintViolation('WARs must be published', call)
.insertAfter(call, "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
2: APPLY ONLY IF IT ISN'T ALREADY
APPLIED
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') bookmark('applyWar', call)
else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(bookmark('applyWar') && !bookmark('applyWarPublish')) {
addBuildLintViolation('WARs must be published', call)
.insertAfter(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
3: REPLACE THE WAR PLUGIN ENTIRELY
class AllWarsShouldBePublishedRule extends GradleLintRule {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
if(plugin == 'war') bookmark('applyWar', call)
else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(bookmark('applyWar') && !bookmark('applyWarPublish')) {
addBuildLintViolation('WARs must be published', call)
.replaceWith(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'")
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
4: BECOME GRADLE MODEL AWARE
class AllWarsShouldBePublishedRule extends GradleLintRule implements GradleModelAware {
@Override void visitApplyPlugin(MethodCallExpression call, String plugin) {
bookmark('lastApplyPlugin', call)
}
@Override protected void visitClassComplete(ClassNode node) {
if(project.plugins.hasPlugin(WarPlugin) &&
!project.plugins.hasPlugin('netflix.war-publish')) {
addBuildLintViolation('WARs must be published', call)
.insertAfter(
bookmark('lastApplyPlugin'),
"apply plugin: 'netflix.war-publish'"
)
}
}
}
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
GRADLE LINT IS OUR FIRST
DISTRIBUTED REFACTORING
TOOL.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THE EXPERIMENTAL LOCK PLUGIN IS
ANOTHER EXAMPLE.
github.com/nebula-plugins/lock-
experimental
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
WE WANT AN
EVENTUALLY CONSISTENT
MONOREPO
THROUGH
DISTRIBUTED REFACTORING.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
JAVA POWER ASSERT WAS THE
LEARNING GROUND.
github.com/jkschneider/java-power-assert
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
THANK YOU.
GITHUB.COM/NETFLIXGRADLESUMMIT/LINT

More Related Content

Similar to Distributed Refactoring with Gradle Lint

Open Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core SummitOpen Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core Summit
Ido Green
 
Thinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and XamarinThinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and Xamarin
Rod Hemphill
 
L19 Local
L19 LocalL19 Local
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit Applications
US-Ignite
 
L20 Personalised World
L20 Personalised WorldL20 Personalised World
L20 Personalised World
Ólafur Andri Ragnarsson
 
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
Gaël Blondelle
 
Green house software
Green house softwareGreen house software
Green house software
Vinod Pol
 
Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?
José Luis Núñez Díaz
 
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim KadlecDevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon
 
L Migrator Pres
L Migrator PresL Migrator Pres
L Migrator Pres
Brian Loomis
 
Ceph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community UpdateCeph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community Update
Ceph Community
 
Ceph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community UpdateCeph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community Update
Danielle Womboldt
 
Hyperledger Fabric in a Nutshell
Hyperledger Fabric in a NutshellHyperledger Fabric in a Nutshell
Hyperledger Fabric in a Nutshell
Daniel Chan
 
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Renato Cruz
 
BigchainDB and Beyond
BigchainDB and BeyondBigchainDB and Beyond
BigchainDB and Beyond
Dimitri De Jonghe
 
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con ConfluentIoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
mimacom
 
Observability
ObservabilityObservability
Observability
Ebru Cucen Çüçen
 
Observability
ObservabilityObservability
Observability
Ebru Cucen Çüçen
 
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Chad Curry
 
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
Priyanka Aash
 

Similar to Distributed Refactoring with Gradle Lint (20)

Open Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core SummitOpen Source & DevOps Market trends - Open Core Summit
Open Source & DevOps Market trends - Open Core Summit
 
Thinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and XamarinThinxtra, Sigfox and Xamarin
Thinxtra, Sigfox and Xamarin
 
L19 Local
L19 LocalL19 Local
L19 Local
 
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit Applications
 
L20 Personalised World
L20 Personalised WorldL20 Personalised World
L20 Personalised World
 
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
2019.02 Eclipse Foundation and Eclipse IoT presentation at Eclipse IoT Day Gr...
 
Green house software
Green house softwareGreen house software
Green house software
 
Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?Growing impact and future potential of blockchain for telcos: A Game Changer?
Growing impact and future potential of blockchain for telcos: A Game Changer?
 
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim KadlecDevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
DevSecCon London 2017: Their-problems-are-your-problems-devseccon by Tim Kadlec
 
L Migrator Pres
L Migrator PresL Migrator Pres
L Migrator Pres
 
Ceph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community UpdateCeph Day Beijing - Ceph Community Update
Ceph Day Beijing - Ceph Community Update
 
Ceph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community UpdateCeph Day Beijing- Ceph Community Update
Ceph Day Beijing- Ceph Community Update
 
Hyperledger Fabric in a Nutshell
Hyperledger Fabric in a NutshellHyperledger Fabric in a Nutshell
Hyperledger Fabric in a Nutshell
 
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
Perspectives of Telecommunications in CALA - ECI Telecom - 20/10/2016
 
BigchainDB and Beyond
BigchainDB and BeyondBigchainDB and Beyond
BigchainDB and Beyond
 
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con ConfluentIoT, arquitectura de solución y cómo enriquecerlo con Confluent
IoT, arquitectura de solución y cómo enriquecerlo con Confluent
 
Observability
ObservabilityObservability
Observability
 
Observability
ObservabilityObservability
Observability
 
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
Getting Smart About Smart Homes - MLS Tech Fair - 10.06.16
 
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
YOU'D BETTER SECURE YOUR BLE DEVICES OR WE'LL KICK YOUR BUTTS !
 

Recently uploaded

CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
ramrag33
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 

Recently uploaded (20)

CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 

Distributed Refactoring with Gradle Lint

  • 1. DISTRIBUTED REFACTORING WITH GRADLE LINT Jon Schneider Netflix Engineering Tools @jon_k_schneider GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 3. NETFLIX IS KNOWN FOR RAPID INNOVATION. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 4. WE WANT TO MINIMIZE DRAG FROM LATE ADOPTERS. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 5. NETFLIX CULTURE IS FREEDOM AND RESPONSIBILITY GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 6. GRADLE LINT ALLOWS US TO DISTRIBUTE CHANGE. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 7. THE UNUSED DEPENDENCIES RULE HELPS MAINTAIN GOOD DEPENDENCY HYGIENE. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 8. GRADLE LINT SUPPORTS SHIPPING METRICS TO nebula.metrics GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 9. CREATING A MORE COMPLEX RULE "All wars should be published to our binary repository" GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 10. 1: APPLY IMMEDIATELY AFTER THE WAR PLUGIN class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') { addBuildLintViolation('WARs must be published', call) .insertAfter(call, "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 11. 2: APPLY ONLY IF IT ISN'T ALREADY APPLIED class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') bookmark('applyWar', call) else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call) } @Override protected void visitClassComplete(ClassNode node) { if(bookmark('applyWar') && !bookmark('applyWarPublish')) { addBuildLintViolation('WARs must be published', call) .insertAfter(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 12. 3: REPLACE THE WAR PLUGIN ENTIRELY class AllWarsShouldBePublishedRule extends GradleLintRule { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { if(plugin == 'war') bookmark('applyWar', call) else if(plugin == 'netflix.war-publish') bookmark('applyWarPublish', call) } @Override protected void visitClassComplete(ClassNode node) { if(bookmark('applyWar') && !bookmark('applyWarPublish')) { addBuildLintViolation('WARs must be published', call) .replaceWith(bookmark('applyWar'), "apply plugin: 'netflix.war-publish'") } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 13. 4: BECOME GRADLE MODEL AWARE class AllWarsShouldBePublishedRule extends GradleLintRule implements GradleModelAware { @Override void visitApplyPlugin(MethodCallExpression call, String plugin) { bookmark('lastApplyPlugin', call) } @Override protected void visitClassComplete(ClassNode node) { if(project.plugins.hasPlugin(WarPlugin) && !project.plugins.hasPlugin('netflix.war-publish')) { addBuildLintViolation('WARs must be published', call) .insertAfter( bookmark('lastApplyPlugin'), "apply plugin: 'netflix.war-publish'" ) } } } GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 14. GRADLE LINT IS OUR FIRST DISTRIBUTED REFACTORING TOOL. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 15. THE EXPERIMENTAL LOCK PLUGIN IS ANOTHER EXAMPLE. github.com/nebula-plugins/lock- experimental GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 16. WE WANT AN EVENTUALLY CONSISTENT MONOREPO THROUGH DISTRIBUTED REFACTORING. GITHUB.COM/NETFLIXGRADLESUMMIT/LINT
  • 17. JAVA POWER ASSERT WAS THE LEARNING GROUND. github.com/jkschneider/java-power-assert GITHUB.COM/NETFLIXGRADLESUMMIT/LINT