From 04279adf8cabcc7aa981bba8f27e8d621a4ac1c7 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:05:55 -0400 Subject: [PATCH 01/16] spelling: etc. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5b68af0..dfe008b 100644 --- a/README.md +++ b/README.md @@ -299,13 +299,13 @@ To just print probable misspellings: ### What problem does this solve? This corrects commonly misspelled English words in computer source -code, and other text-based formats (`.txt`, `.md`, etc). +code, and other text-based formats (`.txt`, `.md`, etc.). It is designed to run quickly so it can be used as a [pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) with minimal burden on the developer. -It does not work with binary formats (e.g. Word, etc). +It does not work with binary formats (e.g. Word, etc.). It is not a complete spell-checking program nor a grammar checker. @@ -322,7 +322,7 @@ They all work but had problems that prevented me from using them at scale: * slow, all of the above check one misspelling at a time (i.e. linear) using regexps * not MIT/Apache2 licensed (or equivalent) -* have dependencies that don't work for me (python3, bash, linux sed, etc) +* have dependencies that don't work for me (python3, bash, linux sed, etc.) * don't understand American vs. British English and sometimes makes unwelcome "corrections" That said, they might be perfect for you and many have more features From 8fdcf7b61ebcbe25f0516327bd0328de7a9ae2d6 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:09:22 -0400 Subject: [PATCH 02/16] spelling: comma-separated --- README.md | 2 +- cmd/misspell/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfe008b..828a60a 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Usage of misspell: -f string 'csv', 'sqlite3' or custom Golang template for output -i string - ignore the following corrections, comma separated + ignore the following corrections, comma-separated -j int Number of workers, 0 = number of CPUs -legal diff --git a/cmd/misspell/main.go b/cmd/misspell/main.go index 174d79d..d4f00f5 100644 --- a/cmd/misspell/main.go +++ b/cmd/misspell/main.go @@ -105,7 +105,7 @@ func main() { quietFlag = flag.Bool("q", false, "Do not emit misspelling output") outFlag = flag.String("o", "stdout", "output file or [stderr|stdout|]") format = flag.String("f", "", "'csv', 'sqlite3' or custom Golang template for output") - ignores = flag.String("i", "", "ignore the following corrections, comma separated") + ignores = flag.String("i", "", "ignore the following corrections, comma-separated") locale = flag.String("locale", "", "Correct spellings using locale perferances for US or UK. Default is to use a neutral variety of English. Setting locale to US will correct the British spelling of 'colour' to 'color'") mode = flag.String("source", "auto", "Source mode: auto=guess, go=golang source, text=plain or markdown-like text") debugFlag = flag.Bool("debug", false, "Debug matching, very slow") From 44c9c96fb2ce4f94810e0608145dcfe8dc2006ee Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:10:14 -0400 Subject: [PATCH 03/16] spelling: preferences --- README.md | 2 +- cmd/misspell/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 828a60a..46cae15 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Usage of misspell: -legal Show legal information and exit -locale string - Correct spellings using locale perferances for US or UK. Default is to use a neutral variety of English. Setting locale to US will correct the British spelling of 'colour' to 'color' + Correct spellings using locale perferences for US or UK. Default is to use a neutral variety of English. Setting locale to US will correct the British spelling of 'colour' to 'color' -o string output file or [stderr|stdout|] (default "stdout") -q Do not emit misspelling output diff --git a/cmd/misspell/main.go b/cmd/misspell/main.go index d4f00f5..11972ca 100644 --- a/cmd/misspell/main.go +++ b/cmd/misspell/main.go @@ -106,7 +106,7 @@ func main() { outFlag = flag.String("o", "stdout", "output file or [stderr|stdout|]") format = flag.String("f", "", "'csv', 'sqlite3' or custom Golang template for output") ignores = flag.String("i", "", "ignore the following corrections, comma-separated") - locale = flag.String("locale", "", "Correct spellings using locale perferances for US or UK. Default is to use a neutral variety of English. Setting locale to US will correct the British spelling of 'colour' to 'color'") + locale = flag.String("locale", "", "Correct spellings using locale perferences for US or UK. Default is to use a neutral variety of English. Setting locale to US will correct the British spelling of 'colour' to 'color'") mode = flag.String("source", "auto", "Source mode: auto=guess, go=golang source, text=plain or markdown-like text") debugFlag = flag.Bool("debug", false, "Debug matching, very slow") exitError = flag.Bool("error", false, "Exit with 2 if misspelling found") From 93faa6688cedb907eee3e0d33774ca3b4b288bcc Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:13:51 -0400 Subject: [PATCH 04/16] grammar: the following example selects --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46cae15..a3fa07b 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ or find . -type f | xargs misspell ``` -You can select a type of file as well. The following examples selects all `.txt` files that are *not* in the `vendor` directory: +You can select a type of file as well. The following example selects all `.txt` files that are *not* in the `vendor` directory: ```bash find . -type f -name '*.txt' | grep -v vendor/ | xargs misspell -error From 2509652a7410079755d8eba3adbed87cae437328 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:15:26 -0400 Subject: [PATCH 05/16] grammar: doubled word (other) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3fa07b..646a73d 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ on the command line. Conversely, you can check a golang source as if it were pure text by using `-source=text`. You might want to do this since many variable names have misspellings in them! -### Can I check only-comments in other other programming languages? +### Can I check only-comments in other programming languages? I'm told the using `-source=go` works well for ruby, javascript, java, c and c++. From 8fd9f9b4b49cd813cbf301bae5cb49afaacda739 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:16:26 -0400 Subject: [PATCH 06/16] grammar: Oxford comma --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 646a73d..29214e9 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ variable names have misspellings in them! ### Can I check only-comments in other programming languages? -I'm told the using `-source=go` works well for ruby, javascript, java, c and +I'm told the using `-source=go` works well for ruby, javascript, java, c, and c++. It doesn't work well for python and bash. From 256fb39996ddd8233659155856087a6b67ae0631 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:20:54 -0400 Subject: [PATCH 07/16] brand: gnu One can install (or use) GNU sed on non-Linux platforms, and some non-Linux platforms ship w/ GNU sed. https://riptutorial.com/sed/topic/9436/bsd-macos-sed-vs--gnu-sed-vs--the-posix-sed-specification --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29214e9..be94cd2 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,7 @@ They all work but had problems that prevented me from using them at scale: * slow, all of the above check one misspelling at a time (i.e. linear) using regexps * not MIT/Apache2 licensed (or equivalent) -* have dependencies that don't work for me (python3, bash, linux sed, etc.) +* have dependencies that don't work for me (python3, bash, GNU sed, etc.) * don't understand American vs. British English and sometimes makes unwelcome "corrections" That said, they might be perfect for you and many have more features From 2e14b15d07f38875b67e4262178263dd8daf87c1 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:21:37 -0400 Subject: [PATCH 08/16] grammar: an --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be94cd2..4c9c7bd 100644 --- a/README.md +++ b/README.md @@ -336,7 +336,7 @@ should be able to check and correct 1000 files in under 250ms. This uses the mighty power of golang's [strings.Replacer](https://golang.org/pkg/strings/#Replacer) which is -a implementation or variation of the +an implementation or variation of the [Aho–Corasick algorithm](https://en.wikipedia.org/wiki/Aho–Corasick_algorithm). This makes multiple substring matches *simultaneously*. From de3e88e5c29982d7cc19489967b88ddb7ebe1376 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:23:13 -0400 Subject: [PATCH 09/16] reword --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c9c7bd..9ad1b9e 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ an implementation or variation of the [Aho–Corasick algorithm](https://en.wikipedia.org/wiki/Aho–Corasick_algorithm). This makes multiple substring matches *simultaneously*. -In addition this uses multiple CPU cores to work on multiple files. +It also uses multiple CPU cores to work on multiple files concurrently. ### What problems does it have? From 97c3da402c6026186fc913829d3f32042ffc7ca3 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:24:11 -0400 Subject: [PATCH 10/16] spelling: uppercase / lowercase --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ad1b9e..f7cb18d 100644 --- a/README.md +++ b/README.md @@ -366,7 +366,7 @@ Thanks! ### Why is it making mistakes or missing items in golang files? The matching function is *case-sensitive*, so variable names that are multiple -worlds either in all-upper or all-lower case sometimes can cause false +worlds either in all-uppercase or all-lowercase sometimes can cause false positives. For instance a variable named `bodyreader` could trigger a false positive since `yrea` is in the middle that could be corrected to `year`. Other problems happen if the variable name uses a English contraction that From 979d61282083d503fc5cac535c19e404e15a9e30 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:24:47 -0400 Subject: [PATCH 11/16] grammar: comma after introductory phrase --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7cb18d..c373ed8 100644 --- a/README.md +++ b/README.md @@ -367,7 +367,7 @@ Thanks! The matching function is *case-sensitive*, so variable names that are multiple worlds either in all-uppercase or all-lowercase sometimes can cause false -positives. For instance a variable named `bodyreader` could trigger a false +positives. For instance, a variable named `bodyreader` could trigger a false positive since `yrea` is in the middle that could be corrected to `year`. Other problems happen if the variable name uses a English contraction that should use an apostrophe. The best way of fixing this is to use the From 53a45e59691d1af05ac114a2710b87bd8a5cec7d Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:25:37 -0400 Subject: [PATCH 12/16] grammar: an --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c373ed8..b744f71 100644 --- a/README.md +++ b/README.md @@ -369,7 +369,7 @@ The matching function is *case-sensitive*, so variable names that are multiple worlds either in all-uppercase or all-lowercase sometimes can cause false positives. For instance, a variable named `bodyreader` could trigger a false positive since `yrea` is in the middle that could be corrected to `year`. -Other problems happen if the variable name uses a English contraction that +Other problems happen if the variable name uses an English contraction that should use an apostrophe. The best way of fixing this is to use the [Effective Go naming conventions](https://golang.org/doc/effective_go.html#mixed-caps) and use From b5424bac962bedcf26352edd649df6fb6d31f6bb Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:26:27 -0400 Subject: [PATCH 13/16] grammar: is --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b744f71..e380d88 100644 --- a/README.md +++ b/README.md @@ -382,7 +382,7 @@ can check your code using [golint](https://github.com/golang/lint) The main code is [MIT](https://github.com/client9/misspell/blob/master/LICENSE). Misspell also makes uses of the Golang standard library and contains a modified version of Golang's [strings.Replacer](https://golang.org/pkg/strings/#Replacer) -which are covered under a [BSD License](https://github.com/golang/go/blob/master/LICENSE). Type `misspell -legal` for more details or see [legal.go](https://github.com/client9/misspell/blob/master/legal.go) +which is covered under a [BSD License](https://github.com/golang/go/blob/master/LICENSE). Type `misspell -legal` for more details or see [legal.go](https://github.com/client9/misspell/blob/master/legal.go) ### Where do the word lists come from? From 6cb63a871235b54cb0cf55528119aceaf8e0ca8c Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:27:22 -0400 Subject: [PATCH 14/16] grammar: on --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e380d88..1f44d6e 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,7 @@ which is covered under a [BSD License](https://github.com/golang/go/blob/master/ It started with a word list from [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines). Unfortunately, this list had to be highly edited as many of the words are -obsolete or based from mistakes on mechanical typewriters (I'm guessing). +obsolete or based on mistakes on mechanical typewriters (I'm guessing). Additional words were added based on actually mistakes seen in the wild (meaning self-generated). From d58bc9287fed8dab4c55ba9173855ec4e83a4d53 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:28:51 -0400 Subject: [PATCH 15/16] grammar: here are some --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f44d6e..a1c7346 100644 --- a/README.md +++ b/README.md @@ -407,7 +407,7 @@ English, so "what is American or not" is subject to opinion. Corrections and he ### What are some other enhancements that could be done? -Here's some ideas for enhancements: +Here are some ideas for enhancements: *Capitalization of proper nouns* could be done (e.g. weekday and month names, country names, language names) From 975f17831dc6c96cfa9ef0956d10e1740fed0df5 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 23 Sep 2019 09:29:58 -0400 Subject: [PATCH 16/16] spelling: aggregation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1c7346..6b5c23b 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ locale would correct "advisor" to "adviser". *Versioning* Some type of versioning is needed so reporting mistakes and errors is easier. -*Feedback* Mistakes would be sent to some server for agregation and feedback review. +*Feedback* Mistakes would be sent to some server for aggregation and feedback review. *Contractions and Apostrophes* This would optionally correct "isnt" to "isn't", etc.