Skip to content

Honor comma_first for reindent_aligned formatting - #883

Open
ChrisJr404 wants to merge 1 commit into
andialbrecht:masterfrom
ChrisJr404:comma-first-aligned
Open

Honor comma_first for reindent_aligned formatting#883
ChrisJr404 wants to merge 1 commit into
andialbrecht:masterfrom
ChrisJr404:comma-first-aligned

Conversation

@ChrisJr404

Copy link
Copy Markdown

Fixes #490.

The comma_first option only affected reindent, so reindent_aligned still put the commas at the end of the line. This wires the same option through the aligned filter, which lines the commas up right under the keywords like the issue asked for. Default output is unchanged, you only get this when you pass comma_first=True.

>>> print(sqlparse.format(sql, reindent_aligned=True, comma_first=True))
select j.jobtitle
     , count(*)
     , max(salary) as top
  from employee e
     , job j
 where e.orig_salary < 43000
 group by j.jobtitle
  • ran the tests (pytest)
  • all style issues addressed (ruff)
  • your changes are covered by tests
  • your changes are documented, if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

comma_first option for reindent_aligned would be sweet

1 participant