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

src/sqlfluff/core/linter: Improve ignore file processing #1650

Merged
merged 3 commits into from Oct 14, 2021

Conversation

CyberShadow
Copy link
Contributor

  • Don't re-scan entire directories for every sqlfluffignore
  • Fix crashes due to recursive symlinks
  • Improve warning when an exact file is ignored

@codecov
Copy link

codecov bot commented Oct 14, 2021

Codecov Report

Merging #1650 (5774087) into main (e6a18c5) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 5774087 differs from pull request most recent head 3ae064c. Consider uploading reports for the commit 3ae064c to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1650   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          133       133           
  Lines         9250      9251    +1     
=========================================
+ Hits          9250      9251    +1     
Impacted Files Coverage Δ
src/sqlfluff/core/linter/linter.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 e6a18c5...3ae064c. Read the comment docs.

@CyberShadow CyberShadow force-pushed the sqlfluffignore-no-glob branch 2 times, most recently from 207dd43 to 29c21b9 Compare October 14, 2021 12:57
@CyberShadow CyberShadow marked this pull request as ready for review October 14, 2021 15:59
@CyberShadow CyberShadow force-pushed the sqlfluffignore-no-glob branch 2 times, most recently from 27d1610 to 29c21b9 Compare October 14, 2021 16:00
- Don't re-scan entire directories for every sqlfluffignore

- Fix crashes due to recursive symlinks

- Improve warning when an exact file is ignored
Copy link
Member

@alanmcruickshank alanmcruickshank left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. The only thing I'm not sure about is the significance of the path_c file that you've added - what is it's function?

@@ -0,0 +1 @@
.
Copy link
Member

Choose a reason for hiding this comment

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

@CyberShadow - what's the significance of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the test case. (It's a symlink, but that's not visible on GitHub.)

Copy link
Member

Choose a reason for hiding this comment

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

Ahhhhhh. Makes sense. I'm on a windows machine so symlinks don't display properly :)

Comment on lines +770 to +781
linter_logger.warning(
"Exact file path %s was given but "
"it was ignored by a %s pattern in %s, "
"re-run with `--disregard-sqlfluffignores` to "
"skip %s"
% (
path,
ignore_file_name,
ignore_base,
ignore_file_name,
)
)
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍

Co-authored-by: Alan Cruickshank <alanmcruickshank@gmail.com>
@alanmcruickshank alanmcruickshank merged commit a3e4e3c into sqlfluff:main Oct 14, 2021
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.

Creating a .sqlfluffignore causes SQLFluff to crash if symlinks are present
3 participants