mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 12:30:08 -06:00
Actually use the exclude pattern. Closes #47.
This commit is contained in:
@@ -40,12 +40,16 @@ def get_all_files():
|
||||
def get_files_matching(all_file_list_strategy):
|
||||
@functools.wraps(all_file_list_strategy)
|
||||
@memoize_by_cwd
|
||||
def wrapper(expr):
|
||||
regex = re.compile(expr)
|
||||
def wrapper(include_expr, exclude_expr):
|
||||
include_regex = re.compile(include_expr)
|
||||
exclude_regex = re.compile(exclude_expr)
|
||||
return set(filter(os.path.exists, (
|
||||
filename
|
||||
for filename in all_file_list_strategy()
|
||||
if regex.search(filename)
|
||||
if (
|
||||
include_regex.search(filename) and
|
||||
not exclude_regex.search(filename)
|
||||
)
|
||||
)))
|
||||
return wrapper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user