tldr-pages / tldr

đź“š Collaborative cheatsheets for console commands
https://tldr.sh
Other
50.21k stars 4.09k forks source link

Proposal: Report missing links in other pages #11068

Open sebastiaanspeck opened 10 months ago

sebastiaanspeck commented 10 months ago

In several pages, there are references to other tldr-pages, but some of these don't exist. E.g.:

In the main pages, I could spot 11 missing links, but the extra languages have much more.

I already wrote a shell script to report all missing tldr-pages. Feel free to test it out and maybe integrate it to keep track of missing links?

kbdharun commented 10 months ago

Great work and agreed, it would be indeed nice to have a script to detect missing page references. I tried running this script locally on the tldr root directory but it doesn't seem to run for me. Can you provide some examples for the scripts (and also specify if any arguments need to be passed)?

Once it looks good, we could move it to the scripts directory.

sebastiaanspeck commented 10 months ago

You could checkout https://github.com/tldr-pages/tldr/commit/c7ef12204fe193d751f7b6d7c4b4ac99747b095b.

When being in the root of the repo, you could run it by using: ./scripts/missing-tldr-pages.sh to generate the missing-tldr-pages.md for the English pages or ./scripts/missing-tldr-pages.sh id to generate the missing-tldr-id-pages.md for the Indonesian pages.

It generates a file with contents like df doesn't exist yet! Command referenced in ./pages.id/osx/gdf.md or cgclassify doesn't exist yet! Command referenced in ./pages/linux/cgroups.md

Hope this information helps. Please let me know if you need anything to make this work for you.

sebastiaanspeck commented 10 months ago

In the meantime I was able to create a GitHub Action to run it once a day (which can be altered to our preferences of course).

The Action generates all missing-tldr-*-pages.md-pages and archives it in a missing-tldr-pages.zip.

The status per language is;

11 missing TLDR Pages in missing-tldr-pages.md.
188 missing TLDR Pages in missing-tldr-hi-pages.md.
198 missing TLDR Pages in missing-tldr-ne-pages.md.
186 missing TLDR Pages in missing-tldr-ta-pages.md.
0 missing TLDR Pages in missing-tldr-cs-pages.md.
197 missing TLDR Pages in missing-tldr-bs-pages.md.
198 missing TLDR Pages in missing-tldr-pt_PT-pages.md.
199 missing TLDR Pages in missing-tldr-uk-pages.md.
190 missing TLDR Pages in missing-tldr-sv-pages.md.
198 missing TLDR Pages in missing-tldr-th-pages.md.
166 missing TLDR Pages in missing-tldr-es-pages.md.
185 missing TLDR Pages in missing-tldr-tr-pages.md.
160 missing TLDR Pages in missing-tldr-de-pages.md.
0 missing TLDR Pages in missing-tldr-uz-pages.md.
161 missing TLDR Pages in missing-tldr-fr-pages.md.
0 missing TLDR Pages in missing-tldr-fa-pages.md.
180 missing TLDR Pages in missing-tldr-pl-pages.md.
183 missing TLDR Pages in missing-tldr-nl-pages.md.
199 missing TLDR Pages in missing-tldr-da-pages.md.
187 missing TLDR Pages in missing-tldr-ja-pages.md.
0 missing TLDR Pages in missing-tldr-ro-pages.md.
177 missing TLDR Pages in missing-tldr-id-pages.md.
145 missing TLDR Pages in missing-tldr-pt_BR-pages.md.
162 missing TLDR Pages in missing-tldr-ko-pages.md.
200 missing TLDR Pages in missing-tldr-lo-pages.md.
183 missing TLDR Pages in missing-tldr-ru-pages.md.
153 missing TLDR Pages in missing-tldr-it-pages.md.
182 missing TLDR Pages in missing-tldr-zh_TW-pages.md.
0 missing TLDR Pages in missing-tldr-sh-pages.md.
196 missing TLDR Pages in missing-tldr-ca-pages.md.
198 missing TLDR Pages in missing-tldr-ar-pages.md.
0 missing TLDR Pages in missing-tldr-sr-pages.md.
196 missing TLDR Pages in missing-tldr-ml-pages.md.
148 missing TLDR Pages in missing-tldr-zh-pages.md.
0 missing TLDR Pages in missing-tldr-bn-pages.md.
195 missing TLDR Pages in missing-tldr-no-pages.md.

As you can see, only 7 languages don't have any missing TLDR-references.

sebastiaanspeck commented 10 months ago

The next step would be to run a script to check if a PR doesn't add a non-existing TDLR command, maybe this can be added to the linter as mentioned before.

sebastiaanspeck commented 10 months ago

@kbdharun I am curious if you could manage to run the script yourself successfully today.

kbdharun commented 10 months ago

~Hi, sorry for the delay. I will check out the script later today.~

Update: Tested the script it works perfectly, but I agree that it should be part of the linter instead of running it independently.

sebastiaanspeck commented 10 months ago

The linter needs a huge rebuild. Right now it only checks the syntax AFAIK and doesn’t validate the page itself. Besides that, is it correct that the linter right now only works for English pages? I see a hard-coded “more information” in the code.

kbdharun commented 10 months ago

The linter needs a huge rebuild. Right now it only checks the syntax AFAIK and doesn’t validate the page itself. Besides that, is it correct that the linter right now only works for English pages? I see a hard-coded “more information” in the code.

Yeah, the Linter has been written with English pages in mind. But some of its checks work on translations too like the check for eol, periods, colons, etc.

sebastiaanspeck commented 10 months ago

If I have some time, I will see if I can extend the linter to check if it references any non-existing TDLR-commands. It will be different than the other checks since that only checks on syntax and this check will need to look outside of the current file to determine if it is okay.