• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sql-formatter-org / sql-formatter / 27901335597
96%

Build:
DEFAULT BRANCH: master
Ran 21 Jun 2026 10:23AM UTC
Jobs 1
Files 88
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Jun 2026 10:23AM UTC coverage: 95.582% (+0.02%) from 95.56%
27901335597

push

github

web-flow
fix: keep spaces around - operator in dialects with dashed identifiers (#953)

With `denseOperators: true` on BigQuery, a subtraction like `a - b`
comes out as `a-b`. That's not just ugly: BigQuery allows dashes inside
identifiers, so the densed output re-parses as a single identifier
`a-b`, and `format(format(sql))` no longer matches `format(sql)`. `a -
foo(y)` is worse — it becomes `a-foo (y)`, turning the expression into
an identifier followed by a call.

The fix is to leave the `-` operator spaced in dialects that allow
dashed identifiers (currently just BigQuery). I derived that flag from
the existing `identChars.dashes` tokenizer option so there's a single
source of truth. Numeric cases like `1 - 2` were already safe (the `-`
is parsed into the literal), so this only affects the identifier case.

The shared dense-operator test in `operators.ts` was actually asserting
the broken `foo-bar` output for BigQuery; I scoped that to the
dashed-identifier dialects and added a BigQuery regression test.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Fixed formatting of the `-` operator in dialects that support dashes
in identifiers, such as BigQuery. When dense operator formatting is
enabled, spaces around the `-` operator are now properly preserved to
prevent expressions from being incorrectly merged into dashed
identifiers.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

586 of 656 branches covered (89.33%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

1318 of 1336 relevant lines covered (98.65%)

16443.45 hits per line

Jobs
ID Job ID Ran Files Coverage
1 27901335597.1 21 Jun 2026 10:23AM UTC 88
95.58
GitHub Action Run
Source Files on build 27901335597
  • Tree
  • List 88
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 311c4784 on github
  • Prev Build on master (#26974064740)
  • Next Build on master (#27901972030)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc