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

Look for .sqlfluffignore in current directory #2573

Conversation

barrywhart
Copy link
Member

@barrywhart barrywhart commented Feb 7, 2022

Brief summary of the change made

Fixes #556

Are there any other side effects of this change that we should be aware of?

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

@barrywhart barrywhart marked this pull request as draft February 7, 2022 17:47
@barrywhart barrywhart marked this pull request as ready for review February 7, 2022 18:06
[os.path.basename(ignore_file_path)],
)
for ignore_file_path in ignore_file_paths
]
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is not as big or complex as it first appears. I basically just moved lines 853 - 867 below, out of the if statement.

Copy link
Member

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

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

LGTM assuming tests pass)

(a lot less changes when you hide whitespace changes btw)

@barrywhart barrywhart marked this pull request as draft February 7, 2022 18:40
@barrywhart
Copy link
Member Author

A Windows test is failing. Will investigate. Probably something to do with the Windows-specific concept of "current drive", and having a current directory per drive, which is different from Unix. Hopefully nothing too tricky. Debugging test failures on GitHub is 🤢 .

@tunetheweb
Copy link
Member

A Windows test is failing. Will investigate. Probably something to do with the Windows-specific concept of "current drive", and having a current directory per drive, which is different from Unix. Hopefully nothing too tricky. Debugging test failures on GitHub is 🤢 .

I had problems with this on the original move to GitHub Actions. I add the following note to tox.ini:

# Have option to explictly set TMPDIR for python as on GitHub Action Windows
# machines it doesn't read this from env and resets to system default, which
# is often on different drive (C) from working dir (D), which causes problems.

Wonder if it's something similar here?

@barrywhart
Copy link
Member Author

I think it's similar. commonpath() is failing because it's receiving two paths, one with a drive letter, one without:

  • test\\fixtures\\linter\\sqlfluffignore
  • D:\\a\\sqlfluff\\sqlfluff\\test\\fixtures\\linter\\sqlfluffignore\\path_a

I found a possible fix: calling .absolute() rather than .resolve(). There's a discussion about it here.

@barrywhart barrywhart marked this pull request as ready for review February 7, 2022 19:34
@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #2573 (b0fe38e) into main (8822bf4) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #2573   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          163       163           
  Lines        11851     11852    +1     
=========================================
+ Hits         11851     11852    +1     
Impacted Files Coverage Δ
src/sqlfluff/core/config.py 100.00% <100.00%> (ø)
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 8822bf4...b0fe38e. Read the comment docs.

@barrywhart barrywhart merged commit ac9ea80 into sqlfluff:main Feb 7, 2022
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.

Configuration from current working path not being loaded when path provided.
2 participants