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

Allow to pass a single file as argument to the CLI #8

Open
santisoler opened this issue Mar 5, 2024 · 1 comment
Open

Allow to pass a single file as argument to the CLI #8

santisoler opened this issue Mar 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@santisoler
Copy link
Member

Description of the desired feature:

Currently, burocrata expects a directory to be passed as argument to the CLI. It would be nice if we could alternatively pass a single file to it.

We should be checking if the passed argument is a file or a directory and then act accordingly.
If the passed argument is a file, I think we can safely ignore the --extension option.

Maybe we can refactor the main function and move these lines to their own private function that will return the list of missing files. In case the passed argument is a file, then the function should just check if the file lacks the license notice or not:

missing_notice = []
for directory in directories:
amount = 0
for ext in extensions:
for path in directory.glob(f"**/*.{ext}"):
if gitignore.match_file(path):
continue
amount += 1
source_code = path.read_text().split("\n")
if not source_code:
missing_notice.append(path)
else:
for notice_line, file_line in zip(notice, source_code):
if notice_line != file_line:
missing_notice.append(path)
break

Are you willing to help implement and maintain this feature?

I'll be glad to!

@santisoler santisoler added the enhancement New feature or request label Mar 5, 2024
@leouieda
Copy link
Member

👍🏾 on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants