LogoLogo
  • About Thunderbird
  • Contributing to Thunderbird
    • Getting Started Contributing
    • Setting Up A Build Environment
    • Building Thunderbird
      • Windows Build Prerequisites
      • Linux Build Prerequisites
      • macOS Build Prerequisites
      • Artifact Builds
    • Codebase Overview
      • Account Configuration
      • Address Book
      • Chat Core
        • Notifications
        • Message Styles
        • Keyboard shortcuts
        • Chat Core Protocols
        • Contacts
      • Mail Front-End
    • Tutorials and Examples
      • Hello World Example
      • Thunderbird Live Development Videos
    • Fixing a Bug
      • Bug Triaging 101
        • Bug Status Classicification
        • Bug Types
        • Garbage Collection
        • Narrow the Scope
      • Using Mercurial Bookmarks
      • Using Mercurial Queues
      • Lint and Format Code
      • Using ESLint to Format Javascript Code
      • Try Server
      • Landing a Patch
      • Care and Feeding of the Tree
    • Testing
      • Running Tests
      • Adding Tests
      • Writing Mochitest Tests
  • Planning
    • Roadmap
    • Android Roadmap
    • Supported Standards
  • Add-on Development
    • Introduction
    • What's new?
      • Manifest Version 3
    • A "Hello World" Extension Tutorial
      • Using WebExtension APIs
      • Using a Background Page
      • Using Content Scripts
    • A Guide to Extensions
      • Supported Manifest Keys
      • Supported UI Elements
      • Supported WebExtension APIs
      • Thunderbird's WebExtension API Documentation
      • Thunderbird WebExtension Examples
      • Introducing Experiments
    • A Guide to Themes
    • Developer Community
    • Documentation & Resources
      • Tips and Tricks
    • Add-on Update Guides
      • Update for Thunderbird 128
      • Update for Thunderbird 115
        • Adapt to Changes in Thunderbird 103-115
      • Update for Thunderbird 102
        • Adapt to Changes in Thunderbird 92-102
      • Update for Thunderbird 91
        • Adapt to Changes in Thunderbird 79-91
      • Update for Thunderbird 78
        • Adapt to Changes in Thunderbird 69-78
      • Update for Thunderbird 68
        • Adapt to Changes in Thunderbird 61-68
      • How to convert legacy extensions?
        • Convert wrapped WebExtensions to modern WebExtensions
        • Convert legacy WebExtensions to modern WebExtensions
        • Convert legacy overlay extension to legacy WebExtension
        • Convert legacy bootstrapped extension to legacy WebExtension
  • Releases
    • Thunderbird Channels
    • Release Cadence
    • Uplifting Fixes
    • Feature Flags
    • Tracking Fixes for Releases
    • Contributing to Release Notes
Powered by GitBook
On this page
  • Running Linters Locally
  • Configuring Mozlint for Thunderbird
  • Suite code
  • Taskcluster

Was this helpful?

Edit on GitHub
Export as PDF
  1. Contributing to Thunderbird
  2. Fixing a Bug

Lint and Format Code

How to lint and format code.

PreviousUsing Mercurial QueuesNextUsing ESLint to Format Javascript Code

Last updated 3 years ago

Was this helpful?

Thunderbird's source code is linted and formatted using automated tools, which provides several benefits that include:

  • ensuring a consistent formatting style across the code base

  • preventing formatting issues from taking up developer time in code review

  • catching problems that might otherwise go unnoticed

  • making it easier for developers to write well-formatted code

Mozlint is a library that standardizes linter configuration and provides an interface for running all linters at once. It is run via mach and is run automatically by Taskcluster.

Running Linters Locally

You can run all the various linters in the tree using the mach commlint command. Simply pass in the directory or file you wish to lint (defaults to current working directory):

../mach commlint path/to/files

It works the same as regular mach lint, however it has Thunderbird configs pre-applied. If you're not familiar with using mach lint on Firefox code, see the Firefox documentation to get started.

Configuring Mozlint for Thunderbird

Suite code

The Mozlint configuration files in comm/tools/lint are written so that they can be shared with the Seamonkey project. Thunderbird developers may want to set MOZLINT_NO_SUITE=1 in their environment so mach commlint will not check comm/suite/. Taskcluster will also set MOZLINT_NO_SUITE when running lint checks.

Taskcluster

Several mozlint-based checks run automatically on Taskcluster, and more are being added. The Firefox documentation is a valuable resource if you're seeing errors on your try builds. If you are not sure how to run a check locally, the mach commands run by Taskcluster are in comm/taskcluster/ci/source-test/mozlint.yml.

Linting
Linting