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

Only use relative paths with function is_ignored() #258

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

ericwb
Copy link
Contributor

@ericwb ericwb commented Jan 31, 2024

The is_ignored() function expects paths relative to the starting path given when initializing the class. It raises a traceback if given an absolute path.

Traceback (most recent call last):
  File "/Users/ericwb/workspace/precli/.tox/py312/bin/precli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/ericwb/workspace/precli/precli/cli/main.py", line 301, in main
    file_list = discover_files(args.targets, args.recursive)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ericwb/workspace/precli/precli/cli/main.py", line 177, in discover_files
    if not preignore_mgr.is_ignored(path):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ericwb/workspace/precli/.tox/py312/lib/python3.12/site-packages/ignorelib.py", line 401, in is_ignored
    matches = list(self._find_matching(path))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ericwb/workspace/precli/.tox/py312/lib/python3.12/site-packages/ignorelib.py", line 368, in _find_matching
    raise ValueError('%s is an absolute path' % path)
ValueError: /var/folders/m3/_cy_9dfx73107r3w_zhnsd700000gn/T/tmp_100ms8v/securesauce-precli-2ef4388/LICENSE is an absolute path

The is_ignored() function expects paths relative to the starting
path given when initializing the class. It raises a traceback
if given an absolute path.

Signed-off-by: Eric Brown <[email protected]>
@ericwb ericwb merged commit 5ee3771 into securesauce:main Jan 31, 2024
8 checks passed
@ericwb ericwb deleted the fix_ignore branch January 31, 2024 22:47
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.

1 participant