This week’s featured GitHub project is an open source tool that allows developers write their own set of rules. NEAL, or Not Exactly a Linter, was developed by Uber and released into open source earlier this year. It is a language-agnostic tool diesnged to enable engineers to write custom syntax-based rules that can automate sections of the code review process.
“We needed a solution that enabled engineers to both quickly review code—regardless of language—and generate new rules,” the uber engineering team wrote in a blog post. “So, we decided to start from scratch and build our own. NEAL lets engineers write their own set of rules to cover any part of the codebase, taking the code review process one step closer to full automation.”
Uber uses the tool internally to improve the reliability of tests by checking for patterns which include concurrency primitives and asynchronous tests. The company also uses the tool to control the growth of its binary size. This avoids language features that result in extensive amounts of machine code, the team explained. In addition, NEAL enforces high-level restrictions on executable code to ensure that the newly incorporated plugins can be safely turned off.
NEAL can be extensible across three dimensions. The first dimension is language. According to the company, abstract syntax tree (AST) providers add support for languages by either a parser or by wrapping an existing parser.
“We decided to use AST-based linting (instead of traditional expression-based linting) because it facilitates the expression of more complex patterns, such as deeply nested structures and recursive patterns,” the team wrot. “This method is also less error-prone, since users do not have to account for meaningless text in the source code, like whitespaces, comments, and item order.”
The second dimension is formatting; reporters can add new formats for outputting violations.
The third dimension is rule creation; rules only define actions needed to be taken when specific patterns are encountered during code reviews.
Top 5 projects trending on GitHub this week
- Xin-Yue: This Chinese repository is an open letter between Zhibei Masters and Peking University Foreign Language Collection
- FoundationDB: Apple’s recently open source, distributed, transactional key-value store. Read more about it here!
- Dayjs: A date library alternative to Moment.js
- CSS Blocks: A component-oriented CSS authoring system that compiles to high performance stylesheets
- React in patterns: A free book that discusses design patterns and techniques for developing with React