Skip to content

Commit

Permalink
ignore command added
Browse files Browse the repository at this point in the history
  • Loading branch information
diogoocruz committed Apr 4, 2024
1 parent d0d0705 commit d7b78a7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions burocrata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@
show_default=True,
help="Print information during execution / Don't print",
)
@click.option(
"--ignore",
"-i",
default=None,
show_default=True,
help="A comma separated list of directories to ignore during the analysis ",
)
@click.version_option()
@click.argument(
"directories",
type=click.Path(exists=True, file_okay=False, path_type=pathlib.Path),
nargs=-1,
)
def main(extension, check, verbose, directories):
def main(extension, check, verbose, directories, ignore):
"""
Burocrata: Check and insert copyright and license notices into source code
Expand Down Expand Up @@ -84,7 +92,12 @@ def main(extension, check, verbose, directories):
exclude = config["tool"]["burocrata"]["exclude"]
exclude = pathspec.PathSpec.from_lines("gitwildmatch", exclude)
########

if ignore:
ignore = ignore.split(",")
print(ignore)
ignore = [i for i in ignore]
ignore = pathspec.PathSpec.from_lines("gitwildmatch", ignore)

gitignore = get_gitignore()

missing_notice = []
Expand All @@ -96,6 +109,9 @@ def main(extension, check, verbose, directories):
continue
if exclude.match_file(path):
continue
if ignore:
if ignore.match_file(path):
continue
amount += 1
source_code = path.read_text().split("\n")
if not source_code:
Expand Down

0 comments on commit d7b78a7

Please sign in to comment.