NEAL, Uber’s Open Source Language-Agnostic Linting Platform

Tadeu Zagallo
6 min readbeginner
--
View Original

Overview

NEAL is Uber's open-source language-agnostic linting platform designed to automate code reviews by allowing engineers to create custom syntax-based rules. This article discusses the challenges faced in code reviews and how NEAL addresses these issues, enhancing productivity and code quality.

What You'll Learn

1

How to create custom linting rules for code reviews using NEAL

2

Why using Abstract Syntax Trees (AST) improves linting accuracy

3

How to automate code review processes with NEAL

Prerequisites & Requirements

  • Understanding of code review processes and linting concepts
  • Familiarity with GitHub for accessing NEAL's repository(optional)

Key Questions Answered

How does NEAL enhance the code review process at Uber?
NEAL automates parts of the code review process by allowing engineers to write custom syntax-based rules, which helps in identifying bugs and enforcing design patterns. This reduces the manual effort required in code reviews, thus improving developer productivity and code quality.
What are the main features of NEAL?
NEAL is designed to be extensible across three dimensions: language support through AST providers, customizable formatting for outputting violations, and flexible rule creation that defines actions based on specific code patterns. This makes it adaptable to various programming languages and coding standards.
What challenges did Uber face before implementing NEAL?
Uber's engineers faced challenges with overwhelming code diffs during reviews, which slowed down throughput and productivity. The geographical diversity of teams further exacerbated these issues, leading to lengthy turnaround times for code fixes.
When should NEAL be used in the development process?
NEAL should be used during the code review phase of development to automate the detection of specific patterns and enforce coding standards. This is particularly useful in large, multi-language codebases where manual reviews can be time-consuming and error-prone.

Technologies & Tools

Linting Platform
Neal
Used for automating code reviews and enforcing coding standards.
Programming Concept
Abstract Syntax Tree (ast)
Facilitates the expression of complex patterns in code.

Key Actionable Insights

1
Implement NEAL in your code review process to automate the detection of coding patterns and enforce best practices.
By using NEAL, teams can significantly reduce the manual effort involved in code reviews, allowing engineers to focus on more complex issues and improving overall code quality.
2
Utilize the AST capabilities of NEAL to create complex linting rules that can catch subtle bugs.
AST-based linting allows for more precise matching of code patterns, reducing false positives and improving the reliability of code reviews.
3
Encourage team members to contribute to NEAL by creating and sharing custom rules tailored to your codebase.
This collaborative approach not only enhances the linting capabilities of NEAL but also fosters a culture of shared ownership and continuous improvement in coding standards.

Common Pitfalls

1
Assuming NEAL will catch all bugs, including those called transitively.
NEAL only detects direct calls to functions from specific contexts, so developers must be aware of this limitation and implement additional conventions or annotations to cover indirect calls.

Related Concepts

Linting
Code Review Automation
Abstract Syntax Trees
Custom Syntax Rules