Skip to content

Add mojo format instructions to testing patterns #2

@msaelices

Description

@msaelices

Summary

The mojo-best-practices/patterns/testing.md file is missing instructions on running mojo format before committing changes. Without this, contributors may commit unformatted code that causes linter failures in CI.

Proposed Change

Add a "Before Committing: Run the Formatter" section to testing.md (after the existing "Running Tests" section) with the following content:

## Before Committing: Run the Formatter

Always run `mojo format` before committing changes to ensure the linter passes in CI:

\`\`\`bash
# Format a single file
mojo format my_module.mojo

# Format all Mojo files in the current directory (recursive)
mojo format .

# Format a specific directory
mojo format src/
\`\`\`

> **Important:** `mojo format` enforces the official Mojo style (indentation, spacing, trailing commas, etc.). Committing unformatted code will cause linter failures in CI. Make this a habit before every commit, or configure your editor to run it on save.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions