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

Do not suppress errors in SQL code blocks within Markdown files #229

Closed
PhilippSalvisberg opened this issue Aug 3, 2022 · 2 comments · Fixed by #230
Closed

Do not suppress errors in SQL code blocks within Markdown files #229

PhilippSalvisberg opened this issue Aug 3, 2022 · 2 comments · Fixed by #230
Assignees
Labels
enhancement New feature or request JavaScript
Milestone

Comments

@PhilippSalvisberg
Copy link
Collaborator

The issue Trivadis/plsql-and-sql-coding-guidelines#130 describes a case where it would be beneficial to have the formatter to report errors in SQL code blocks of a Markdown file.

format.js reports errors in non-Markdown files by default (see https://github.com/Trivadis/plsql-formatter-settings/blob/sqldev-22.2.0/sqlcl/format.js#L522). However for Markdown files this feature is explicitly suppressed. The reason is, that not every SQL block in a Markdown file must be compatible with the Oracle dialect. However, I suggest to show the error by default and add an option to suppress the reporting of errors in files (in general).

@PhilippSalvisberg PhilippSalvisberg self-assigned this Aug 3, 2022
@PhilippSalvisberg PhilippSalvisberg added the enhancement New feature or request label Aug 3, 2022
@PhilippSalvisberg PhilippSalvisberg added this to the SQLcl 22.3.0 milestone Aug 3, 2022
@PhilippSalvisberg
Copy link
Collaborator Author

PhilippSalvisberg commented Aug 3, 2022

New option:

  serr=<scope>    scope of syntax errors to be reported. By default all errors are reported.
                  serr=none reports no syntax errors
                  serr=all reports all syntax errors
                  serr=ext reports syntax errors for files defined with ext option
                  serr=mext reports syntax errors for files defined with mext option

serr=ext would mimick the current behavior.

@PhilippSalvisberg
Copy link
Collaborator Author

It's difficult to identify the code block with an error in a Markdown file. A solution would be to print the number of the SQL code block processed. Something like this:

Formatting file x of y: markdown.md... #1... done... #2... skipped... #3... done... done.

In this case 3 SQL blocks were processed. Block 1 and 3 where have been formatted. Block 2 has been skipped due to a syntax error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request JavaScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant