This document provides an overview of Abide, a static checker tool for Scala based on type-checked ASTs. It has the goals of unifying existing rule-based approaches, making it easy to write and use rules, and providing reasonable performance and good integrations. Rules are decoupled from the tool and can come from core, extra, or project-specific packages. The document gives examples of core rules and rules for Akka and describes Abide's architecture, use, anatomy including traversers, directives, and how rules are coded. It encourages contributing rules to help the value of the tool.
3. Goals
• Unify existing approaches in one platform
• Easy to write rules
• Easy to use other people’s rules
• Reasonable performance
• Good integrations
4. Abide
• Rules are decoupled from the tool
• rule packages
• project-specific rules
• Integrates with Sbt
• planned: Maven, Eclipse
5. Examples
• Core package
• Unused members
• Vars that are never re-assigned
• Renamed arguments with defaults
• Akka
• sender method called inside future
11. 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`
12. Rules
• partial function Tree => Unit
• collect keys that can do one transition
• nok (not ok)
• ok (stable state)
13. 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