際際滷

際際滷Share 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 (20)

Benoit Felten
Benoit FeltenBenoit Felten
Benoit Felten
Freedom to Connect
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
L19 Local
lafur Andri Ragnarsson
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit Applications
US-Ignite
Whitepaper DVB Native IP: The Gamechanger for Content Distribution
Whitepaper DVB Native IP: The Gamechanger for Content DistributionWhitepaper DVB Native IP: The Gamechanger for Content Distribution
Whitepaper DVB Native IP: The Gamechanger for Content Distribution
ST Engineering iDirect
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
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
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systemsSupercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Zilliz
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
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
Smart Gigabit Applications
Smart Gigabit ApplicationsSmart Gigabit Applications
Smart Gigabit Applications
US-Ignite
Whitepaper DVB Native IP: The Gamechanger for Content Distribution
Whitepaper DVB Native IP: The Gamechanger for Content DistributionWhitepaper DVB Native IP: The Gamechanger for Content Distribution
Whitepaper DVB Native IP: The Gamechanger for Content Distribution
ST Engineering iDirect
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
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
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systemsSupercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Supercharge Spark: Unleashing Big Data Potential with Milvus for RAG systems
Zilliz
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

Recently uploaded (20)

UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptxUHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
ariomthermal2031
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
UHV UNIT-5    IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...UHV UNIT-5    IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
ariomthermal2031
Crude-Oil-System for oil and gas industry
Crude-Oil-System for oil and gas industryCrude-Oil-System for oil and gas industry
Crude-Oil-System for oil and gas industry
Okeke Livinus
Cecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra - Specializes In Medical TechnologyCecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra
Requirements Engineering for Secure Software
Requirements Engineering for Secure SoftwareRequirements Engineering for Secure Software
Requirements Engineering for Secure Software
Dr Sarika Jadhav
NBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II ComparisonNBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II Comparison
Dr INBAMALAR T M
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 / HIFLUX Co., Ltd.
DBMS Nested & Sub Queries Set operations
DBMS Nested & Sub Queries Set operationsDBMS Nested & Sub Queries Set operations
DBMS Nested & Sub Queries Set operations
Sreedhar Chowdam
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario
Lecture 16 - 17 - NonTraditional Machining Presentation.ppt
Lecture 16 - 17 - NonTraditional Machining Presentation.pptLecture 16 - 17 - NonTraditional Machining Presentation.ppt
Lecture 16 - 17 - NonTraditional Machining Presentation.ppt
INSTITUTE OF ENGINEERING /BKC
Software security: Security a Software Issue
Software security: Security a Software IssueSoftware security: Security a Software Issue
Software security: Security a Software Issue
Dr Sarika Jadhav
CCNA_Product_OverviewCCNA_Productsa.pptx
CCNA_Product_OverviewCCNA_Productsa.pptxCCNA_Product_OverviewCCNA_Productsa.pptx
CCNA_Product_OverviewCCNA_Productsa.pptx
UdayakumarAllimuthu
pptforclass10kkkkkkkclasseee2eewsw10scienve
pptforclass10kkkkkkkclasseee2eewsw10scienvepptforclass10kkkkkkkclasseee2eewsw10scienve
pptforclass10kkkkkkkclasseee2eewsw10scienve
jeevasreemurali
Disruption channel in business model innovation topic
Disruption channel in business model innovation topicDisruption channel in business model innovation topic
Disruption channel in business model innovation topic
anandraj930873
Introduction to Forensic Research Digital Forensics
Introduction to Forensic Research Digital ForensicsIntroduction to Forensic Research Digital Forensics
Introduction to Forensic Research Digital Forensics
SaanviMisar
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION .pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION  .pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION  .pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION .pptx
ariomthermal2031
applicationof differential equation.pptx
applicationof differential equation.pptxapplicationof differential equation.pptx
applicationof differential equation.pptx
PPSTUDIES
DBMS Notes selection projection aggregate
DBMS Notes selection projection aggregateDBMS Notes selection projection aggregate
DBMS Notes selection projection aggregate
Sreedhar Chowdam
Data+Management+Masterclasssdfsdfsdfsd.pdf
Data+Management+Masterclasssdfsdfsdfsd.pdfData+Management+Masterclasssdfsdfsdfsd.pdf
Data+Management+Masterclasssdfsdfsdfsd.pdf
Nguy畛n H畉i
GRAPHS AND DISCONTINUITIES POWERPOINT.pptx
GRAPHS AND DISCONTINUITIES POWERPOINT.pptxGRAPHS AND DISCONTINUITIES POWERPOINT.pptx
GRAPHS AND DISCONTINUITIES POWERPOINT.pptx
ChrisPuyoc1
UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptxUHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
UHV unit-2UNIT - II HARMONY IN THE HUMAN BEING.pptx
ariomthermal2031
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
UHV UNIT-5    IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...UHV UNIT-5    IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON ...
ariomthermal2031
Crude-Oil-System for oil and gas industry
Crude-Oil-System for oil and gas industryCrude-Oil-System for oil and gas industry
Crude-Oil-System for oil and gas industry
Okeke Livinus
Cecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra - Specializes In Medical TechnologyCecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra - Specializes In Medical Technology
Cecille Seminario Marra
Requirements Engineering for Secure Software
Requirements Engineering for Secure SoftwareRequirements Engineering for Secure Software
Requirements Engineering for Secure Software
Dr Sarika Jadhav
NBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II ComparisonNBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II Comparison
Dr INBAMALAR T M
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 渚狩 豺企襦蠏 2025 (Lok Fitting Catalog 2025)
危 / HIFLUX Co., Ltd.
DBMS Nested & Sub Queries Set operations
DBMS Nested & Sub Queries Set operationsDBMS Nested & Sub Queries Set operations
DBMS Nested & Sub Queries Set operations
Sreedhar Chowdam
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario
Lecture 16 - 17 - NonTraditional Machining Presentation.ppt
Lecture 16 - 17 - NonTraditional Machining Presentation.pptLecture 16 - 17 - NonTraditional Machining Presentation.ppt
Lecture 16 - 17 - NonTraditional Machining Presentation.ppt
INSTITUTE OF ENGINEERING /BKC
Software security: Security a Software Issue
Software security: Security a Software IssueSoftware security: Security a Software Issue
Software security: Security a Software Issue
Dr Sarika Jadhav
CCNA_Product_OverviewCCNA_Productsa.pptx
CCNA_Product_OverviewCCNA_Productsa.pptxCCNA_Product_OverviewCCNA_Productsa.pptx
CCNA_Product_OverviewCCNA_Productsa.pptx
UdayakumarAllimuthu
pptforclass10kkkkkkkclasseee2eewsw10scienve
pptforclass10kkkkkkkclasseee2eewsw10scienvepptforclass10kkkkkkkclasseee2eewsw10scienve
pptforclass10kkkkkkkclasseee2eewsw10scienve
jeevasreemurali
Disruption channel in business model innovation topic
Disruption channel in business model innovation topicDisruption channel in business model innovation topic
Disruption channel in business model innovation topic
anandraj930873
Introduction to Forensic Research Digital Forensics
Introduction to Forensic Research Digital ForensicsIntroduction to Forensic Research Digital Forensics
Introduction to Forensic Research Digital Forensics
SaanviMisar
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION .pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION  .pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION  .pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION .pptx
ariomthermal2031
applicationof differential equation.pptx
applicationof differential equation.pptxapplicationof differential equation.pptx
applicationof differential equation.pptx
PPSTUDIES
DBMS Notes selection projection aggregate
DBMS Notes selection projection aggregateDBMS Notes selection projection aggregate
DBMS Notes selection projection aggregate
Sreedhar Chowdam
Data+Management+Masterclasssdfsdfsdfsd.pdf
Data+Management+Masterclasssdfsdfsdfsd.pdfData+Management+Masterclasssdfsdfsdfsd.pdf
Data+Management+Masterclasssdfsdfsdfsd.pdf
Nguy畛n H畉i
GRAPHS AND DISCONTINUITIES POWERPOINT.pptx
GRAPHS AND DISCONTINUITIES POWERPOINT.pptxGRAPHS AND DISCONTINUITIES POWERPOINT.pptx
GRAPHS AND DISCONTINUITIES POWERPOINT.pptx
ChrisPuyoc1

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