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

Allow file output directly from cli #2625

Merged
merged 8 commits into from
Feb 13, 2022
Merged

Allow file output directly from cli #2625

merged 8 commits into from
Feb 13, 2022

Conversation

alanmcruickshank
Copy link
Member

This resolves #2244 and provides a clean solution to sqlfluff/sqlfluff-github-actions#15.

This adds a --write-output to the lint and parse commands so that the commands can write directly to file. In the case that file output is enabled, the stdout logging is re-enabled so that the user can get e.g. yaml output to file and still get human output to stdout.

@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Merging #2625 (a88aff0) into main (d44c83e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #2625   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          163       163           
  Lines        11904     11915   +11     
=========================================
+ Hits         11904     11915   +11     
Impacted Files Coverage Δ
src/sqlfluff/cli/commands.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d44c83e...a88aff0. Read the comment docs.

Copy link
Member

@barrywhart barrywhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One suggestion to create a reusable function to eliminate a bit of duplicate code.

src/sqlfluff/cli/commands.py Show resolved Hide resolved
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.

Suppress dbt logs and warnings when using --format github-annotation
2 participants