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

Updating scripts without extensions #29

Open
adam-moss opened this issue Feb 3, 2023 · 2 comments
Open

Updating scripts without extensions #29

adam-moss opened this issue Feb 3, 2023 · 2 comments

Comments

@adam-moss
Copy link

As I'm testing I've noticed copywrite correctly updates scripts that have a file extension, e.g. .sh, .js etc. but doesn't update scripts that don't.

E.g. it would detect and update check-release.sh but not check-release

Is there a way to update this files, either through explicit configuration or automagically?

@CalebAlbers
Copy link
Member

This is a really good point - I'm sure there's a handful of cases like this that copywrite misses today on HashiCorp repos.

Is there a way to update this files, either through explicit configuration or automagically?

Unfortunately, not today. Detecting the file format when no extension is present is tricky. We could try to parse shebangs to detect it and skip out if it isn't a known shebang, though I wonder if something like https://github.com/github/linguist would do a better job.

The point about explicit configuration is an interesting one. Do you have any ideas for what that might look like? My first thought was a key-value mapping of files to file type, but I see that as potentially more unwieldy to maintain than manually adding headers for the files that are missed. I'd love to discuss more

@adam-moss
Copy link
Author

For explicitly setting I think something like the ignore_headers globbing could work, but I guess you'd need to have an include and exclude merge type of complexity to avoid mangling things it shouldn't?

Or just key-value pairs as you suggest. More work but definitely more accurate and simpler to maintain. If we compared that to say node's package.json packaging approach, you could include everything by default if not specified, or only what is if it is?

I think automatic file identifying is also good idea, and consistent with things like pre-commit. Linguist is a possibility for sure, or perhaps something like scc (go) or pre-commit's own identify (python) could do the heavy lifting here?

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

No branches or pull requests

2 participants