SlideShare a Scribd company logo
Scala
Iulian Dragos
Overview
• Static checker tool
• Based on type-checked ASTs
• Easy to use and write rules
Goals
• Unify existing approaches in one platform
• Easy to write rules
• Easy to use other people’s rules
• Reasonable performance
• Good integrations
Abide
• Rules are decoupled from the tool
• rule packages
• project-specific rules
• Integrates with Sbt
• planned: Maven, Eclipse
Examples
• Core package
• Unused members
• Vars that are never re-assigned
• Renamed arguments with defaults
• Akka
• sender method called inside future
Architecture
Abide
abide-plugin
scalac
core rules
extra rules
project-specific
...
Use
addSbtPlugin("com.typesafe" % "sbt-abide" % "0.1.0")
libraryDependencies += "com.typesafe" %% "abide-core" % “0.1.0” % "abide"
libraryDependencies += "com.typesafe" %% "abide-extra" % “0.1.0” % "abide"
Project(...).dependsOn(rules % "abide")
Anatomy
Traversers
• Fused: one-pass for all rules
• Optimised: rules are filtered on what they match
Directives
• Shared context between rules
• compiler universe
• user-defined mix-ins
Rules
val step = {
case varDef @ q"$mods var $name : $tpt = $value" =>
nok(varDef.symbol, Warning(varDef))
case q"$rcv = $expr" =>
ok(rcv.symbol)
}
quasi-quote
state helpers
Replace `var` with `val`
Rules
• partial function Tree => Unit
• collect keys that can do one transition
• nok (not ok)
• ok (stable state)
Rules
• existential rules (what we’ve seen)
• scoping rules
• helpers to maintain nesting
• enter (no need for removing, handled by the library)
• path rules
• like scoping, but richer state checks
Coding a rule
For example..
Mutation inside iteration
• Let’s forbid mutating the underlying collection while
iterating
for (x <- xs)
xs -= x xs map { x => xs -= x }
ys foreach { case (k, v) =>
ys remove 1
}
for (p <- icodes; x <- xs) {
icodes -= p._1
xs remove x
}
Simplifying assumptions
• purely syntactical matching (no points-to analysis)
• name-based
xs map { x => xs -= x }
Let’s code
Future
Next
• SupressWarning support
• Integrations: maven and IDEs
• More rules
Contribute!
• The value is in rules
• Contribute to scala/scala-abide
• ..or write your own rule package
Acknowledgements
Nicolas Voirol (@samarion) did all the work during
his internship at Typesafe Switzerland
Thank you

More Related Content

PPTX
SQL Provider
PPTX
Search and analyze your data with elasticsearch
PPTX
Scala elegant and exotic part 1
PDF
Scala.js - yet another what..?
PPTX
Scala.js for large and complex frontend apps
PDF
libAttachSQL, The Next-Generation C Connector For MySQL
PPTX
Elasticsearch Arcihtecture & What's New in Version 5
PPTX
Slick – the modern way to access your Data
SQL Provider
Search and analyze your data with elasticsearch
Scala elegant and exotic part 1
Scala.js - yet another what..?
Scala.js for large and complex frontend apps
libAttachSQL, The Next-Generation C Connector For MySQL
Elasticsearch Arcihtecture & What's New in Version 5
Slick – the modern way to access your Data

What's hot (20)

PPTX
ElasticSearch for data mining
PDF
HandlerSocket
ODP
Introduction to Scala JS
PPTX
Dev nexus 2017
PPTX
ELK - Stack - Munich .net UG
PPTX
Devnexus 2018
PPTX
BigData, NoSQL & ElasticSearch
ODP
Elastic search
PDF
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
PPTX
Spark real world use cases and optimizations
PPSX
Contributing code to cassandra
PDF
Elastic Search
PDF
Elasticsearch and Spark
PPTX
Elasticsearch { "Meetup" : "talk" }
PPTX
Alberto Paro - Hands on Scala.js
PPTX
Introduction to ELK
PPTX
Intro to elasticsearch
PPTX
MongoDB
PPTX
Real Time search using Spark and Elasticsearch
PDF
Scaling SolrCloud to a Large Number of Collections: Presented by Shalin Shekh...
ElasticSearch for data mining
HandlerSocket
Introduction to Scala JS
Dev nexus 2017
ELK - Stack - Munich .net UG
Devnexus 2018
BigData, NoSQL & ElasticSearch
Elastic search
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Spark real world use cases and optimizations
Contributing code to cassandra
Elastic Search
Elasticsearch and Spark
Elasticsearch { "Meetup" : "talk" }
Alberto Paro - Hands on Scala.js
Introduction to ELK
Intro to elasticsearch
MongoDB
Real Time search using Spark and Elasticsearch
Scaling SolrCloud to a Large Number of Collections: Presented by Shalin Shekh...
Ad

Viewers also liked (15)

PDF
Relational Databases are Evolving To Support New Data Capabilities
 
PDF
Your Code is Wrong
PDF
Puppet at Google
PPTX
PDF
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
PDF
The Need for Async @ ScalaWorld
PDF
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
PPTX
Purely Functional Data Structures in Scala
PDF
Monadic Java
PDF
NewSQL overview, Feb 2015
PDF
The Newest in Session Types
PPT
Scala Days San Francisco
PDF
Espresso: LinkedIn's Distributed Data Serving Platform (Paper)
PDF
Functional Programming Patterns (BuildStuff '14)
PDF
Concurrency: The Good, The Bad and The Ugly
Relational Databases are Evolving To Support New Data Capabilities
 
Your Code is Wrong
Puppet at Google
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
The Need for Async @ ScalaWorld
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
Purely Functional Data Structures in Scala
Monadic Java
NewSQL overview, Feb 2015
The Newest in Session Types
Scala Days San Francisco
Espresso: LinkedIn's Distributed Data Serving Platform (Paper)
Functional Programming Patterns (BuildStuff '14)
Concurrency: The Good, The Bad and The Ugly
Ad

Similar to Scala Abide: A lint tool for Scala (20)

PDF
pull requests I sent to scala/scala (ny-scala 2019)
PDF
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
PDF
Introduction to Galaxy and RNA-Seq
PPTX
Cassandra
PPTX
L6.sp17.pptx
PPTX
Indic threads pune12-typesafe stack software development on the jvm
PDF
Typesafe stack - Scala, Akka and Play
PDF
Play Framework and Activator
PPTX
Scala, Play 2.0 & Cloud Foundry
PPTX
Testing in Scala by Adform research
PPTX
Testing in Scala. Adform Research
PPTX
mongodb-aggregation-may-2012
PDF
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
PDF
Lecture 5 JSTL, custom tags, maven
PPTX
Composable Futures with Akka 2.0
KEY
Adding Riak to your NoSQL Bag of Tricks
PDF
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
PDF
Data Structures in Java and Introduction to Collection Framework
KEY
DjangoCon 2010 Scaling Disqus
PDF
pull requests I sent to scala/scala (ny-scala 2019)
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Introduction to Galaxy and RNA-Seq
Cassandra
L6.sp17.pptx
Indic threads pune12-typesafe stack software development on the jvm
Typesafe stack - Scala, Akka and Play
Play Framework and Activator
Scala, Play 2.0 & Cloud Foundry
Testing in Scala by Adform research
Testing in Scala. Adform Research
mongodb-aggregation-may-2012
NOSQL Meets Relational - The MySQL Ecosystem Gains More Flexibility
Lecture 5 JSTL, custom tags, maven
Composable Futures with Akka 2.0
Adding Riak to your NoSQL Bag of Tricks
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
Data Structures in Java and Introduction to Collection Framework
DjangoCon 2010 Scaling Disqus

Recently uploaded (20)

PPTX
Services offered by Dynamic Solutions in Pakistan
PDF
Comprehensive Salesforce Implementation Services.pdf
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PPTX
Audio Editing and it's techniques in computer graphics.pptx
PDF
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
PPTX
10 Hidden App Development Costs That Can Sink Your Startup.pptx
PDF
Rise With SAP partner in Mumbai.........
PPTX
Presentation of Computer CLASS 2 .pptx
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
PDF
Become an Agentblazer Champion Challenge
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PDF
Winning Business in a Slowing Economy, How CPQ helps Manufacturers Protect Ma...
PPT
Overview of Oracle Receivables Process.ppt
PDF
Build Multi-agent using Agent Development Kit
PDF
Exploring AI Agents in Process Industries
Services offered by Dynamic Solutions in Pakistan
Comprehensive Salesforce Implementation Services.pdf
Why Use Open Source Reporting Tools for Business Intelligence.pdf
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Audio Editing and it's techniques in computer graphics.pptx
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
10 Hidden App Development Costs That Can Sink Your Startup.pptx
Rise With SAP partner in Mumbai.........
Presentation of Computer CLASS 2 .pptx
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Become an Agentblazer Champion Challenge
The Five Best AI Cover Tools in 2025.docx
Solar Panel Installation Guide – Step By Step Process 2025.pdf
A REACT POMODORO TIMER WEB APPLICATION.pdf
Materi-Enum-and-Record-Data-Type (1).pptx
Winning Business in a Slowing Economy, How CPQ helps Manufacturers Protect Ma...
Overview of Oracle Receivables Process.ppt
Build Multi-agent using Agent Development Kit
Exploring AI Agents in Process Industries

Scala Abide: A lint tool for Scala