From 48092540d09d87d6385b227fe255921285371838 Mon Sep 17 00:00:00 2001 From: Deepesh Pathak Date: Tue, 30 Jan 2018 03:33:01 +0530 Subject: [PATCH 1/3] Add spell check to makefile to check for typos ticket#25024 - Use misspell to check for typos in codebase - Add `make check-typos` to run the checks - Add `check-typos` to `make check` --- Makefile.am | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 04ca88a236..b892c69f78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,7 +97,7 @@ doxygen: test: all $(top_builddir)/src/test/test -check-local: check-spaces check-changes +check-local: check-spaces check-changes check-typos need-chutney-path: @if test ! -d "$$CHUTNEY_PATH"; then \ @@ -217,6 +217,26 @@ check-logs: $(top_srcdir)/scripts/maint/checkLogs.pl \ $(top_srcdir)/src/*/*.[ch] | sort -n +.PHONY: check-typos +check-typos: + @if test -x "`which misspell 2>&1;true`"; then \ + echo "Checking for Typos ..."; \ + (`which misspell` \ + $(top_srcdir)/src/**/*.[ch] \ + $(top_srcdir)/doc \ + $(top_srcdir)/contrib \ + $(top_srcdir)/scripts \ + $(top_srcdir)/README \ + $(top_srcdir)/ChangeLog \ + $(top_srcdir)/INSTALL \ + $(top_srcdir)/ReleaseNotes \ + $(top_srcdir)/LICENSE); \ + else \ + echo "Tor can use misspell to check for typos."; \ + echo "It seems that you don't have misspell installed."; \ + echo "You can install the latest version of misspell here: https://github.com/client9/misspell#install"; \ + fi + .PHONY: check-changes check-changes: if USEPYTHON From 72bfcb37f13a22780a0a771f17d3b5953703c815 Mon Sep 17 00:00:00 2001 From: Deepesh Pathak Date: Sun, 15 Apr 2018 01:05:49 +0530 Subject: [PATCH 2/3] add changes file and update check-typos in makefile --- ChangeLog | 2 +- Makefile.am | 6 +++--- changes/ticket25024 | 3 +++ src/common/crypto_rsa.h | 2 +- src/or/protover.c | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 changes/ticket25024 diff --git a/ChangeLog b/ChangeLog index 98da35a071..e0468e4e82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -875,7 +875,7 @@ Changes in version 0.3.3.2-alpha - 2018-02-10 would call the Rust implementation of protover_get_supported_protocols(). This was due to the C version returning a static string, whereas the Rust version newly allocated - a CString to pass accross the FFI boundary. Consequently, the C + a CString to pass across the FFI boundary. Consequently, the C code was not expecting to need to free() what it was given. Fixes bug 25127; bugfix on 0.3.2.1-alpha. diff --git a/Makefile.am b/Makefile.am index b892c69f78..cccad6c5ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,7 +97,7 @@ doxygen: test: all $(top_builddir)/src/test/test -check-local: check-spaces check-changes check-typos +check-local: check-spaces check-changes need-chutney-path: @if test ! -d "$$CHUTNEY_PATH"; then \ @@ -221,8 +221,8 @@ check-logs: check-typos: @if test -x "`which misspell 2>&1;true`"; then \ echo "Checking for Typos ..."; \ - (`which misspell` \ - $(top_srcdir)/src/**/*.[ch] \ + (misspell \ + $(top_srcdir)/src/[^e]*/*.[ch] \ $(top_srcdir)/doc \ $(top_srcdir)/contrib \ $(top_srcdir)/scripts \ diff --git a/changes/ticket25024 b/changes/ticket25024 new file mode 100644 index 0000000000..0ff22d0923 --- /dev/null +++ b/changes/ticket25024 @@ -0,0 +1,3 @@ + o Minor features (code quality): + - Add spell checking using misspell in Makefile. + Closes ticket 25024. diff --git a/src/common/crypto_rsa.h b/src/common/crypto_rsa.h index 2f5442a5d2..e952089318 100644 --- a/src/common/crypto_rsa.h +++ b/src/common/crypto_rsa.h @@ -35,7 +35,7 @@ /** A public key, or a public/private key-pair. */ typedef struct crypto_pk_t crypto_pk_t; -/* RSA enviroment setup */ +/* RSA environment setup */ MOCK_DECL(crypto_pk_t *,crypto_pk_new,(void)); void crypto_pk_free_(crypto_pk_t *env); #define crypto_pk_free(pk) FREE_AND_NULL(crypto_pk_t, crypto_pk_free_, (pk)) diff --git a/src/or/protover.c b/src/or/protover.c index 6532f09c2f..18382ba7c9 100644 --- a/src/or/protover.c +++ b/src/or/protover.c @@ -715,7 +715,7 @@ protover_all_supported(const char *s, char **missing_out) versions->high = i; } /* If the last one to be unsupported is one less than the current - * one, we're in a continous range, so set the high field. */ + * one, we're in a continuous range, so set the high field. */ if ((versions->high && versions->high == i - 1) || /* Similarly, if the last high wasn't set and we're currently * one higher than the low, add current index as the highest From fa21ac1de615e8a2f6f1b9fca3c3db96a9529197 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 22 Apr 2018 20:52:55 -0400 Subject: [PATCH 3/3] Tweak changes file for 25024 to mention "check-typos" --- changes/ticket25024 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changes/ticket25024 b/changes/ticket25024 index 0ff22d0923..0e5069cf81 100644 --- a/changes/ticket25024 +++ b/changes/ticket25024 @@ -1,3 +1,4 @@ o Minor features (code quality): - - Add spell checking using misspell in Makefile. + - Add optional spell-checking for the Tor codebase, using the "misspell" + program. To use this feature, run "make check-typos". Closes ticket 25024.