Skip to content

CLI: Add format command for code formatting #21

@pdaxt

Description

@pdaxt

Summary

Add nova fmt command to format Nova source code.

Motivation

Consistent code formatting is essential for:

  • Readable codebases
  • Reduced bikeshedding in code reviews
  • AI-generated code that matches project style

Proposed Implementation

# Format a file
$ nova fmt src/main.nova

# Format and check (CI mode)
$ nova fmt --check src/

# Format with diff output
$ nova fmt --diff src/main.nova

Formatting Rules

  • 4-space indentation
  • 100 character line limit
  • Trailing newline
  • No trailing whitespace
  • Consistent brace style

Acceptance Criteria

  • nova fmt <file> formats in place
  • nova fmt --check returns non-zero on unformatted code
  • nova fmt --diff shows changes without applying
  • Handles all current syntax elements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions