Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Bug 5021 - Add a script to fix spelling errors with codespell #562

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To run a Cache, you will need to:
1. customize the squid.conf configuration file:
% vi /usr/local/squid/etc/squid.conf

2. Initalise the cache:
2. Initialise the cache:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrumph, is there a way to tell codespell to prefer one spelling over the other? This is not critical or even important, but most Squid sources use the (American) "initialize" variant rather than the (British) "initialise" variant. I do not think codespell should change one for the other (or, at the very least, that deserves a separate discussion that I do not want to have now/here), but when fixing a spelling mistake, can we tell codespell to use the prevailing (in Squid) variant?

$ git grep -i initialise | wc -l
88
$ git grep -i initialize | wc -l
416

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possibility (but not really desirable for a number of reasons) is to supply our own dictionary with the -D option on codespell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that custom dictionary will replace the standard one (rather than just overwrite a few entries), then I agree that -D is not a good solution. Let's ignore this problem.

% /usr/local/squid/sbin/squid -z

3. start the cache:
Expand Down
2 changes: 1 addition & 1 deletion compat/GnuRegex.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ regex_compile(const char *pattern, int size, reg_syntax_t syntax, struct re_patt
* they can be reliably used as array indices. */
register unsigned char c, c1;

/* A random tempory spot in PATTERN. */
/* A random temporary spot in PATTERN. */
const char *p1;

/* Points to the end of the buffer, where we should append. */
Expand Down
2 changes: 1 addition & 1 deletion compat/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/*
* From discussions it was chosen to push compat code as far down as possible.
* That means we can have a separate compat for most
* compatability and portability hacks and resolutions.
* compatibility and portability hacks and resolutions.
*
* This file is meant to collate all those hacks files together and
* provide a simple include for them in the core squid headers
Expand Down
2 changes: 1 addition & 1 deletion compat/getaddrinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Update/Maintenance History:
*
* 15-Aug-2007 : Copied from fetchmail 6.3.8
* - added protection around libray headers
* - added protection around library headers
*
* 16-Aug-2007 : Altered configure checks
* Un-hacked slightly to use system gethostbyname()
Expand Down
2 changes: 1 addition & 1 deletion compat/getaddrinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Update/Maintenance History:
*
* 15-Aug-2007 : Copied from fetchmail 6.3.8
* - added protection around libray headers
* - added protection around library headers
*
* 16-Aug-2007 : Altered configure checks
* Un-hacked slightly to use system gethostbyname()
Expand Down
2 changes: 1 addition & 1 deletion compat/getnameinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Update/Maintenance History:
*
* 16-Aug-2007 : Copied from fetchmail 6.3.8
* - added protection around libray headers
* - added protection around library headers
* - added use of alternative name xgetnameinfo
* to split from any OS-provided.
*
Expand Down
2 changes: 1 addition & 1 deletion compat/inet_ntop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Update/Maintenance History:
*
* 24-Sep-2007 : Copied from bind 9.3.3
* - Added protection around libray headers
* - Added protection around library headers
* - Altered configure checks
* - Un-hacked slightly to use system gethostbyname()
*
Expand Down
2 changes: 1 addition & 1 deletion compat/inet_pton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Update/Maintenance History:
*
* 24-Sep-2007 : Copied from bind 9.3.3
* - Added protection around libray headers
* - Added protection around library headers
* - Altered configure checks to import
*
* 06-Oct-2007 : Various fixes to allow the build on MinGW
Expand Down
2 changes: 1 addition & 1 deletion compat/os/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* Netfilter have a history of defining their own versions of network protocol
* primitives without sufficient protection against the POSIX defines which are
* aways present in Linux.
* always present in Linux.
*
* netinet/in.h must be included before any other sys header in order to properly
* activate include guards in <linux/libc-compat.h> the kernel maintainers added
Expand Down
6 changes: 3 additions & 3 deletions compat/os/opensolaris_10_netdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct hostent {
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};

/*
Expand Down Expand Up @@ -417,7 +417,7 @@ int ruserok();
struct hostent *gethostbyname2();
void herror();
char *hstrerror();
/* IPv6 prototype definitons */
/* IPv6 prototype definitions */
int getaddrinfo();
void freeaddrinfo();
const char *gai_strerror();
Expand Down Expand Up @@ -461,7 +461,7 @@ extern int *__h_errno();
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
Expand Down
2 changes: 1 addition & 1 deletion compat/strnstr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Update/Maintenance History:
*
* 26-Apr-2008 : Copied from FreeBSD via OpenGrok
* - added protection around libray headers
* - added protection around library headers
* - added squid_ prefix for uniqueness
* so we can use it where OS copy is broken.
*
Expand Down
6 changes: 3 additions & 3 deletions errors/templates/error-details.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ detail: "%ssl_error_descr: %ssl_subject"
descr: "Certificate does not match domainname"

name: X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
detail: "SSL Certficate error: certificate issuer (CA) not known: %ssl_ca_name"
detail: "SSL Certificate error: certificate issuer (CA) not known: %ssl_ca_name"
descr: "Unable to get issuer certificate"

name: X509_V_ERR_UNABLE_TO_GET_CRL
Expand Down Expand Up @@ -39,7 +39,7 @@ detail: "%ssl_error_descr: %ssl_subject"
descr: "CRL signature failure"

name: X509_V_ERR_CERT_NOT_YET_VALID
detail: "SSL Certficate is not valid before: %ssl_notbefore"
detail: "SSL Certificate is not valid before: %ssl_notbefore"
descr: "Certificate is not yet valid"

name: X509_V_ERR_CERT_HAS_EXPIRED
Expand Down Expand Up @@ -83,7 +83,7 @@ detail: "Self-signed SSL Certificate in chain: %ssl_subject"
descr: "Self signed certificate in certificate chain"

name: X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
detail: "SSL Certficate error: certificate issuer (CA) not known: %ssl_ca_name"
detail: "SSL Certificate error: certificate issuer (CA) not known: %ssl_ca_name"
descr: "Unable to get local issuer certificate"

name: X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
Expand Down
2 changes: 1 addition & 1 deletion include/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ base64_encode_final(struct base64_encode_ctx *ctx,
/* Encodes a string in one go, including any padding at the end.
* Generates exactly BASE64_ENCODE_RAW_LENGTH(length) bytes of output.
* Supports overlapped operation, if src <= dst. FIXME: Use of overlap
* is deprecated, if needed there should be a separate public fucntion
* is deprecated, if needed there should be a separate public function
* to do that.*/
void
base64_encode_raw(char *dst, size_t length, const uint8_t *src);
Expand Down
2 changes: 1 addition & 1 deletion lib/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ heap_print_inorder(heap * hp, int id)
}

/*
* Returns 1 if HP maintians the heap property and 0 otherwise.
* Returns 1 if HP maintains the heap property and 0 otherwise.
*/
int
verify_heap_property(heap * hp)
Expand Down
2 changes: 1 addition & 1 deletion lib/libTrie/TrieNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TrieNode::~TrieNode()
bool
TrieNode::add(char const *aString, size_t theLength, void *privatedata, TrieCharTransform *transform)
{
/* We trust that privatedata and existant keys have already been checked */
/* We trust that privatedata and existent keys have already been checked */

if (theLength) {
int index = transform ? (*transform)(*aString): *aString;
Expand Down
2 changes: 1 addition & 1 deletion lib/ntlmauth/ntlmauth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ntlm_fetch_string(const ntlmhdr *packet, const int32_t packet_size, const strhdr
}

/**
* Adds something to the payload. The caller must guarrantee that
* Adds something to the payload. The caller must guarantee that
* there is enough space in the payload string to accommodate the
* added value.
* payload_length and hdr will be modified as a side-effect.
Expand Down
2 changes: 1 addition & 1 deletion lib/ntlmauth/ntlmauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define SQUID_NTLMAUTH_H

/* NP: All of this cruft is little endian */
/* Endian functions are usualy handled by the OS but not always. */
/* Endian functions are usually handled by the OS but not always. */
#include "ntlmauth/support_endian.h"

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion lib/profiler/Profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
* constant. Best metric to watch is "average time" and total cumulated
* time in given timeframe, which really show percentage of time spent
* in given section of code, and its average completion time. This data
* could be used to detect bottlenecks withing squid and optimise them.
* could be used to detect bottlenecks within squid and optimise them.
*
* \par
* TOTALS are quite off reality. Its there just to summarise cumulative
Expand Down
2 changes: 1 addition & 1 deletion lib/radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static char *rn_zeros, *rn_ones;
* node as high in the tree as we can go.
*
* The present version of the code makes use of normal routes in short-
* circuiting an explict mask and compare operation when testing whether
* circuiting an explicit mask and compare operation when testing whether
* a key satisfies a normal route, and also in remembering the unique leaf
* that governs a subtree.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/rfcnb/rfcnb-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ RFCNB_Print_Hex(FILE * fd, struct RFCNB_Pkt *pkt, int Offset, int Len)

j = 0;

/* We only want to print as much as sepcified in Len */
/* We only want to print as much as specified in Len */

while (pkt_ptr != NULL) {

Expand Down Expand Up @@ -478,7 +478,7 @@ RFCNB_Session_Req(struct RFCNB_Con *con,

switch (RFCNB_Pkt_Type(resp)) {

case RFCNB_SESSION_REJ: /* Didnt like us ... too bad */
case RFCNB_SESSION_REJ: /* Didn't like us ... too bad */

/* Why did we get rejected ? */

Expand Down
4 changes: 2 additions & 2 deletions lib/smblib/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ int SMB_Write(SMB_File *File_Handle, char *data, int numbytes)

max_write_data = (File_Handle -> tree -> mbs) - pkt_len;

/* the 3 is for the data block id and length that preceeds the data */
/* the 3 is for the data block id and length that precedes the data */

while (bytes_left > 0) {

Expand Down Expand Up @@ -1211,7 +1211,7 @@ int SMB_Search(SMB_Tree_Handle tree,
SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, tree -> con -> mid);
SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, tree -> con -> uid);

/* Tell server we known about non-dos names and extended attibutes */
/* Tell server we known about non-dos names and extended attributes */

SSVAL(SMB_Hdr(pkt), SMB_hdr_flg2_offset,
(SMB_FLG2_NON_DOS | SMB_FLG2_EXT_ATR));
Expand Down
4 changes: 2 additions & 2 deletions lib/smblib/smblib-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int SMBapi_NetUserPasswordSet(SMB_Tree_Handle tree, char *user,

SSVAL(SMB_Hdr(pkt), SMB_trans_len, param_len + strlen(SMB_LMAPI_SLOT) + 1);

p = SMB_Hdr(pkt) + SMB_trans_len + 2; /* Skip the BCC and ect */
p = SMB_Hdr(pkt) + SMB_trans_len + 2; /* Skip the BCC and etc */

strcpy(p, SMB_LMAPI_SLOT);
p = p + strlen(SMB_LMAPI_SLOT) + 1;
Expand Down Expand Up @@ -284,7 +284,7 @@ int SMBapi_NetSetUserInfo(SMB_Tree_Handle tree, char *user,
SSVAL(SMB_Hdr(pkt), SMB_trans_len, param_len + strlen(SMB_LMAPI_SLOT) +
1 + data_len);

p = SMB_Hdr(pkt) + SMB_trans_len + 2; /* Skip the BCC and ect */
p = SMB_Hdr(pkt) + SMB_trans_len + 2; /* Skip the BCC and etc */

strcpy(p, SMB_LMAPI_SLOT);
p = p + strlen(SMB_LMAPI_SLOT) + 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/smblib/smblib-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ typedef unsigned char UCHAR;
#define SMB_openx_mod_offset 39 /* mode to open with */
#define SMB_openx_atr_offset 41 /* search attributes */
#define SMB_openx_fat_offset 43 /* File attributes */
#define SMB_openx_tim_offset 45 /* time and date of creat */
#define SMB_openx_tim_offset 45 /* time and date of create */
#define SMB_openx_ofn_offset 49 /* Open function */
#define SMB_openx_als_offset 51 /* Space to allocate on */
#define SMB_openx_res_offset 55 /* reserved */
Expand Down
2 changes: 1 addition & 1 deletion lib/smblib/smblib-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int SMB_Figure_Protocol(const char *dialects[], int prot_index)

/* Negotiate the protocol we will use from the list passed in Prots */
/* we return the index of the accepted protocol in NegProt, -1 indicates */
/* none acceptible, and our return value is 0 if ok, <0 if problems */
/* none acceptable, and our return value is 0 if ok, <0 if problems */

int SMB_Negotiate(SMB_Handle_Type Con_Handle, const char *Prots[])

Expand Down
2 changes: 1 addition & 1 deletion lib/snmplib/CMU-SNMP-ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Parser
The parser now accepts two additional pieces of information in a mib:
DESCRIPTION and INDEX. It also handles "ACCESS" and "MAX-ACCESS".
With these additions, SNMPv2 SMI MIBs can be parsed with minimal
changes. (Specificly, with the removal of text conventions, etc.)
changes. (Specifically, with the removal of text conventions, etc.)

The included CMU MIB should be a good example.

Expand Down
4 changes: 2 additions & 2 deletions lib/snmplib/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ asn_build_length(u_char * data, int *datalength,
}

/*
* asn_parse_objid - pulls an object indentifier out of an ASN object
* asn_parse_objid - pulls an object identifier out of an ASN object
* identifier type.
* On entry, datalength is input as the number of valid bytes following
* "data". On exit, it is returned as the number of valid bytes
Expand Down Expand Up @@ -985,7 +985,7 @@ asn_build_bitstring(u_char * data, int *datalength,
/*
* To do: Write an asn_parse_exception function to go with the new
* asn_build_exception function below so that the exceptional values can
* be handled in input packets aswell as output ones.
* be handled in input packets as well as output ones.
*/

/*
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/testRFC1738.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void testRFC1738::PercentZeroNullDecoding()
CPPUNIT_ASSERT(memcmp(unescaped_str, "w%0rd",6)==0);
xfree(unescaped_str);

/* Handle '0' bytes embeded in encoded % */
/* Handle '0' bytes embedded in encoded % */
unescaped_str = xstrdup("w%%00%rd");
rfc1738_unescape(unescaped_str);
CPPUNIT_ASSERT(memcmp(unescaped_str, "w%00%rd",8)==0);
Expand Down
4 changes: 2 additions & 2 deletions scripts/boiler-mgr.pl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
my $extras = ''; # DEBUG section, inspired by ..., etc.

if (defined $boiler) {
my $copyClaims = ''; # formatted Copyright claims extraced from sources
my $copyClaims = ''; # formatted Copyright claims extracted from sources
my $preserveClaims = 0; # whether to preserve them or not

if (my @rawClaims = ($boiler =~ m/$reClaims/g)) {
Expand Down Expand Up @@ -221,7 +221,7 @@
}

# Some files have license declarations way down in the code so we may not
# find a boilerplate at all or find an "empty" boilerplate preceeding them.
# find a boilerplate at all or find an "empty" boilerplate preceding them.
my $license =
"Copyright|".
"This program is free software|".
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_cache.pl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
system("find ./ -print -type f > $tmpdir/fp$$");
chdir($tmpdir);
# this cut prints only the lines with 4 fields so unnecessary lines
# are supressed
# are suppressed
system("cut -d'/' -f4 -s fp$$ >> cd$$ ; rm fp$$")
}
system("sort -T $tmpdir cd$$ >scd$$; rm cd$$");
Expand Down
57 changes: 57 additions & 0 deletions scripts/codespell-whitelist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
actuall
agains
aline
alloced
anid
ans
aparent
backword
backwords
cachable
cas
childs
commend
crypted
dont
fo
followings
formater
hight
hist
iff
inactivate
initate
nd
neeed
nnumber
normall
othere
pasttime
performes
pevents
pointes
preceed
querys
readed
referer
retuned
sence
sheme
tage
te
tha
ther
therefor
thru
thur
tim
tthe
ue
uint
upto
vaid
valuse
whan
whe
wil
wnat
Loading