golangci / misspell

Correct commonly misspelled English words in source files
MIT License
22 stars 11 forks source link

words.go: add 23 typos from the tinygo codebase #22

Closed dkegel-fastly closed 3 months ago

dkegel-fastly commented 3 months ago

Used the little script

awk '{printf "%s %s\n", length($1), $0;}' | sort -k1rn,1 -k2 | sed 's/^[0-9]* //'

to sort DictMain after adding the entries for those words, then moved "coca cola" back into place manually, verified that resulted in no extra changes.

ldez commented 3 months ago

https://github.com/golangci/misspell/blob/7082d007c4a8a395ea7d9c9a427b93be43bec2a3/words.go#L3

The list of words cannot be changed by hand.

You must use -dict to add your words for your project:

 -dict string
        User defined corrections file path (.csv). CSV format: typo,fix

https://github.com/golangci/misspell?tab=readme-ov-file#usage

dkegel-fastly commented 3 months ago

Happy to use a project-specific dictionary for tinygo.

That said, on the theory that this project might want to expand words.go sometime, is there a way currently to regenerate it?

Looking around the source tree, the original generator seems to have been removed in 2016: https://github.com/client9/misspell/commit/67d98e00e46e0a57742b26951ab41cba671071d5

ldez commented 3 months ago

The generator has been moved out of misspell itself, it has not been removed.

https://github.com/golangci/misspell-source-data

The words file has not been updated recently but it's quite complex to generate it (some APIs are now not free, others have evolved, etc).

Misspell is neither a complete spell-checking program nor a grammar checker. It is a tool to correct commonly misspelled English words. The list of words contains only common mistakes, they don't evolve too much over time.

dkegel-fastly commented 3 months ago

Thanks!

Now that you have a nice project-specific dictionaries feature, it's less important to improve the coverage of the main dictionary.

Someday it might be interesting to consider adding a source to https://github.com/golangci/misspell-source-data/tree/master/sources to harvest project-specific dictionaries from github projects that use misspell. Maybe after that feature is more widely known and used.