Skip to content

Add parentheses/bracket/brace balance checks to linter #88

@Jython1415

Description

@Jython1415

Summary

Add linter rules to validate balanced parentheses (), square brackets [], and curly braces {} in formulas.

Motivation

Commit c222245 introduced a syntax error (missing closing parenthesis) that passed linting but caused "Formula parse error" in Google Sheets. A balance check would have caught this immediately.

Requirements

  1. Check balance of all three bracket types: (), [], {}
  2. Handle string literals correctly - ignore brackets inside quoted strings
  3. Provide clear error messages with position information
  4. Run as part of existing linter workflow

Implementation Notes

  • Add new BalancedBracketsRule class to scripts/lint_formulas.py
  • Parse formula to identify string boundaries before checking balance
  • Consider using simple state machine or regex for string detection

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions