tldr-pages / tldr-lint

A linting tool to validate tldr pages
https://www.npmjs.com/package/tldr-lint
MIT License
35 stars 20 forks source link

New linter error if the filename doesn’t match the command on line 1 #282

Closed sebastiaanspeck closed 3 months ago

sebastiaanspeck commented 8 months ago

I found out at least one page where the filename doesn’t match the command on line 1; https://github.com/tldr-pages/tldr/blob/main/pages.de/common/aw-backup.md - aws-backup.md

Maybe we can introduce a new linter error to check this.

kbdharun commented 8 months ago

This is intentional (we have multiple pages like this), the page title is aws backup (the command). And we don't add spaces between files names to prevent breaking clients which may not parse the name as a string.

sebastiaanspeck commented 8 months ago

I know but aw-backup seems off. You are right that a # aws backup should be named aws-backup.md, but if this doesn’t match, it should trigger right?

kbdharun commented 8 months ago

I know but aw-backup seems off. You are right that a # aws backup should be named aws-backup.md, but if this doesn’t match, it should trigger right?

We also have pages like !.md which uses a different title as the linter doesn't support symbols so the first thing would be to add support for it. Then create a check for same name but to exclude same name with a space in between connecting commands.

sebastiaanspeck commented 8 months ago

It was just a thing that popped up in my mind when looking at https://lukwebsforge.github.io/tldri18n/ and seeing that english had not fully been 100% on all platforms. That way I found out about aw-backup.md in German.

MasterOdin commented 8 months ago

Related issue: https://github.com/tldr-pages/tldr/issues/5071

From that, there's at least three pages that all have the same command, but different file names, and would have to resolve that case.

gutjuri commented 3 months ago

IMO this should be checked by another step in the CI, as in my understanding a Linter only validates syntax, not semantics.

sebastiaanspeck commented 3 months ago

And we do have the Python-script now to check for any conflicting filenames in the tldr-repo itself which we can run (and is run by tldr-maintenance).