-
Notifications
You must be signed in to change notification settings - Fork 78
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
FIX: Respect exclude option in config file #111
base: master
Are you sure you want to change the base?
Conversation
I also added a bunch of tests to test this functionality. The new tests also cover the fix for fortran-lang#94.
40541a4
to
d9219a6
Compare
@@ -2046,6 +2056,19 @@ def build_ws_dict(args): | |||
ws_dict['intrinsics'] = args.whitespace_intrinsics | |||
return ws_dict | |||
|
|||
def build_case_dict(args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a bit of unrelated refactor to make this consistent with build_ws_dict()
.
" does not exist!\n") | ||
sys.exit(1) | ||
if not os.path.isfile(directory) and directory != '-' and not args.recursive: | ||
sys.stderr.write("file " + directory + " does not exist!\n") | ||
if os.path.isdir(directory) and not args.recursive: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a bit clearer. Also the directory != '-'
condition was redundant here.
# Prune excluded patterns from list of child directories | ||
# https://stackoverflow.com/a/19859907 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was fairly confused by this code so added a link.
@@ -2077,35 +2101,34 @@ def build_ws_dict(args): | |||
|
|||
for dirpath, dirnames, files in os.walk(directory,topdown=True): | |||
|
|||
file_args = args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual fix.
else: | ||
self.removeTmpDir() | ||
|
||
def test_config_stdin(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a test for the fix in #98.
p1.wait() | ||
|
||
check_output_file(alien_file, outstring_with_config) | ||
# Excluded files and directories should not be touched at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the test would fail before the fix.
@pseewald friendly ping. 😊 LMK if you want me to split this PR into smaller pieces to make it easier to review. |
I've approved the run but I won't have time until the end of the year to become familiar with this PR and review changes. |
Upstream PR: github.com/fortran-lang/pull/111
As explained in #110, the
exclude
option given via the config file did not work.Here's the fix, a bit of a refactor, and a bunch of new tests.
If this change looks good to you, I would do a bit more refactoring since right now we're needlessly re-parsing the config files for each FORTRAN file, instead of just parsing it once per directory. I didn't want to do it right away to make the initial review easier.
I build this PR on top of #98 since it touched the same code. I am happy to rebase if it gets merged first.
Closes #110.
CC @pseewald
sidenote: Instead of the
exclude
option, it would be nice to support something like the.gitignore
file. For example, ESLint has.eslintignore
.