How to write your own Solidity linter using Slang

Submit
nomic.foundation

How to write your own Solidity linter using Slang

AI summary of the linked article

This guide shows how to build a simple Solidity linter with Nomic Foundation's Slang, a Rust-based compiler API distributed in multiple languages and currently in alpha. The example reimplements the solhint avoid-tx-origin rule, which warns whenever tx.origin is used, in about 20 lines of code. The approach parses source into a concrete syntax tree with Parser.create("0.8.22") and uses Slang's tree query language to match a MemberAccessExpression with tx and origin, then reports each match's file, line and column, using 1-based indexing for output.

No comments yetWhat caught your eye? Start the discussion.