Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter must never fail and never add any warning #118

Open
mvorisek opened this issue May 23, 2024 · 2 comments
Open

Formatter must never fail and never add any warning #118

mvorisek opened this issue May 23, 2024 · 2 comments

Comments

@mvorisek
Copy link
Contributor

mvorisek commented May 23, 2024

As analysed in #116 (comment).

A little related with #39 formatting.

https://github.com/doctrine/sql-formatter/blob/1.4.0/src/Highlighter.php#L38-L46 should be removed then as we are very, very far validating queries (and it is impossible to do it in context-free parser).

Help welcomed.

@derrabus
Copy link
Member

Formatter must never fail and never add any warning

That's nice statement, but hardly an actionable issue. Can you please elaborate a bit more what the goal of this issue is? Otherwise I'm going to close it.

@mvorisek
Copy link
Contributor Author

Sure - see the linked analysis.

In this lib we do two things. We tokenize a query. And we format query. Both must be done in "we are sure" fashion and never assume anything.

What this issue namely aims is to get rid of https://github.com/doctrine/sql-formatter/blob/1.4.0/src/SqlFormatter.php#L221. This is namely the example which is currently wrong, the formatter must check if the indentation block has both start and end present, if not, no indentation must be done instead of ending it and warning about unexpected internal state.

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

No branches or pull requests

2 participants