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

RFE: ignore build system input .in extension when determining the type #727

Closed
scop opened this issue May 21, 2023 · 6 comments · Fixed by #729
Closed

RFE: ignore build system input .in extension when determining the type #727

scop opened this issue May 21, 2023 · 6 comments · Fixed by #729
Labels
C-enhancement Category: Raise on the bar on expectations

Comments

@scop
Copy link
Contributor

scop commented May 21, 2023

Would be good to strip known template/backup filename extensions before attempting a match against a filename/extension glob.

Here's an implementation of that I did some time ago for bat: sharkdp/bat#1687

@epage
Copy link
Collaborator

epage commented May 22, 2023

Template files are a weird case because they contain multiple languages. Which language should we check?

For backup files, I assume we would instead want to ignore all of them.

@scop
Copy link
Contributor Author

scop commented May 22, 2023

Right, ignoring backups would make sense for typos.

Regarding templates, the case I'm mostly interested in is the .in generic build system input one; for that I think the right thing to do is to strip the suffix and decide based on what's left in the name after that. I don't remember coming across one that would actually have multiple languages in it, but just some placeholders to be replaced.

For this specific case, using appropriate type specific extend-globs like

[type.sh]
extend-glob = ["*.sh.in"]

...does seem to serve as a workaround for the time being.

@epage
Copy link
Collaborator

epage commented May 22, 2023

I don't remember coming across one that would actually have multiple languages in it, but just some placeholders to be replaced.

I was referring to when you have a template language mixed in with the generated output.

You could say php/html is an example of this. See also liquid, tera, ninja, handlebars, etc.

@epage
Copy link
Collaborator

epage commented May 22, 2023

Another aspect of backups is that hopefully they are gitignored (in the per-user ignore file) which typos will then ignore by defalt.

@scop
Copy link
Contributor Author

scop commented May 23, 2023

Right, agreed on both, and the PHP example is an interesting one.

Anyway as far as I'm concerned, this RFE reduces to just stripping the literal trailling .in suffix (recursively, as at least *.in.in are a pattern in use in some cases too) before attempting filename based type finding.

@epage
Copy link
Collaborator

epage commented May 23, 2023

I'd be fine with just stripping .in

@epage epage added the C-enhancement Category: Raise on the bar on expectations label May 23, 2023
@scop scop changed the title RFE: ignore known template/backup filename extensions when determining the type RFE: ignore build system input .in extension when determining the type May 24, 2023
phip1611 pushed a commit to phip1611/typos that referenced this issue Dec 5, 2023
`.in` is typically used for build system template input files,
containing some placeholders to replace. In some cases, multiple rounds
of replacements are used, each with their own `.in`, so remove all
trailing instances of it before attempting a filename match.

Closes crate-ci#727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants