Skip to main content

Context aware spelling check for C/C++ source code files.

Project description

C Code Spell Correction

Context aware spelling check of comments and string literals in C/C++ source code files. Operation is non-interactive to facilitate operations on an existing large code base.

  1. First pass to collect terms from source code and propose corrections to comments.
$ ./cspell --out-dict code.dic --out-corrections fix.json code.c ...
  1. Edit candiate corrections in fix.json.

  2. Apply corrections

$ ./cspell --add-dict code.dic --corrections fix.json --modify code.c ...

The argument -f/--inputs reads a list of source files from a file.

Operation

cspell separates string literals and C/C++ comments from code. Tokens/terms found in code are automatically excluding from spell check.

So in the following, myfunc(), thearg, and retval will not be flagged as spelling errors.

/** Copyright 2021 Michael Davidsaver
*  Who can't spelll rite
*/
#include <stdio.h>
/** @brief special
 * @param thearg is the argument
 */
void myfunc(int thearg) {
    // myfunc() is a functon on thearg and retval
    int retval = thearg;
    if(thearg==42)
        printf("thearg is amagic value\n");
    /* another commment */
    return retval;
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cspell-0.0.1a1.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file cspell-0.0.1a1.tar.gz.

File metadata

  • Download URL: cspell-0.0.1a1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for cspell-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 8ac6ea3b878e1261ddcd34dd04066f4ff0a23503996aabcecb8ecfb69c4c691e
MD5 68ef3f490a0d7c10440cbe39691ae235
BLAKE2b-256 5d2d3ab66db6acaddbe275e67892660fbc52e89d2cff1308deea01dde3471a17

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page