You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to exclude paths from search when running upload-process, I found that excluded paths were still being searched (and producing false-positive uploads of un-processable data). I tried passing them as relative and absolute paths before rolling up my sleeves and splashing a hundred logger.debug() calls through the code to trace it out. What I found follows:
$ python3 example.py
paths that match: {PosixPath('example1'), PosixPath('example3'), PosixPath('example2')}
I'm not sure it's the cleanest way, but everything "just works" if I cast everything passed as folders_to_ignore to strings during FileFinder initialization but this feels kind of dodgy/hamfisted to me (again, not actually good at Python):
defselect_file_finder(
root_folder_to_search,
folders_to_ignore,
explicitly_listed_files,
disable_search,
report_type="coverage",
):
# cast everything passed in folders_to_ignore as a stringfolders_to_ignore= [str(dir) fordirinfolders_to_ignore]
returnFileFinder(
root_folder_to_search,
folders_to_ignore,
explicitly_listed_files,
disable_search,
report_type,
)
The text was updated successfully, but these errors were encountered:
mckern
changed the title
"--exclude" flags don't seem to work when uploading reports
"upload-process --exclude" flags don't seem to work when uploading reports
Aug 7, 2024
While trying to exclude paths from search when running
upload-process
, I found that excluded paths were still being searched (and producing false-positive uploads of un-processable data). I tried passing them as relative and absolute paths before rolling up my sleeves and splashing a hundredlogger.debug()
calls through the code to trace it out. What I found follows:When
select_file_finder()
is called, it gets a list of Path objects. But search_files() compares this as a list of strings;if d in folders_to_ignore
is never true, so excluded paths still end up in the search tree when scanning for reports. I don't really know Python as much as I know how to be clumsy with Python butsearch_files()
seems to expect aList(str)
. While I'm unfamiliar with Typing it looks like there's no implicit casting for aList(Path)
to aList(str)
? Here's a very, very trivial example I worked up based on the code fromfolder_searcher.py
:Compared to:
I'm not sure it's the cleanest way, but everything "just works" if I cast everything passed as
folders_to_ignore
to strings duringFileFinder
initialization but this feels kind of dodgy/hamfisted to me (again, not actually good at Python):The text was updated successfully, but these errors were encountered: