streetsidesoftware / cspell Goto Github PK
View Code? Open in Web Editor NEWA Spell Checker for Code!
Home Page: https://cspell.org
License: MIT License
A Spell Checker for Code!
Home Page: https://cspell.org
License: MIT License
Hello there! I'm in a fun and happy corporate environment, and having non-npm dependency makes the CI server less happy then one would ideally want... do you have any plans to move away from the dependency on https://github.com/Jason3S/configstore.git? Is there anything that can be done to speed this along?
Hello and thank you for creating this cSpell! ๐โโ๏ธ
All linters I know have an option to ignore a single line. I didn't find such a feature in cSpell. Have you considered it?
At the moment, cspell supports a couple of URI schemas when filtering files to spell check.
These are file
, untitled
, and vsls
(Thanks to #28).
The vsls
pull request makes it clear that this setting needs to be configuration based and not hard-coded.
Is it possible to bypass string variables for this spell checker?
currently this fails, but it shouldn't. I have to do an ignore every time, which is very annoying:
var URL = 'https://github.com/Jason3S/cspell/issues/26#issuecomment-383315831'
I want to spell check variable names, function names and all that etc,
I am not too fussed about the spelling of string variables.
BUT, I would like to spell check .spec.ts
So it should still find it('should fix spelin erros')
Edit: I have found this, which disables ALL stings:
"ignoreRegExpList": [
"string"
]
Purpose to create a cspell.json file in the current directory. This is very useful for customizing cspell.
cspell init
I tried to create a config file to add some words to it but cspell didn't load it, even if the filename was in current director, even if I tried cspell -c cspell.json cspell.json
.
I even tried --debug
mode, hopping that this would show more info but no message regarding config file is displayed.
Tested on MacOS, with cspell 2.1.11
Update: it seems that even the smallest syntax error in config file is totally and silently ignored, like and additional command after the last element of a list.
... considering that list of words is better kept as a sorted list, you can imagine a recurring issue.
Usually **/*.md would match root/foo.md
and also root/subfolder/bar.md
, but it seems like somewhere the noglobstar
option is being set so it only matches a single folder level
According to -v ignorePaths are picked from cspell.json, but ignored when cspell called with path starting with dot:
cspell -v ./src/**/*.*
Need a list of keywords
I discovered that cspell is finding java arguments like -Djenkins
as words and I attempted to make it recognize them by adding D
and jenkins
as words and adding "allowCompoundWords": true,
inside cspell.json
.
Still, this didn't work and these words are still reported.
I do not want to add each of them in the dictionary as the list would grow too fast.
What is the trick that needs to be done to bypass this case?
When I run cspell I always get more errors reported in VSCode than I do on the command-line, whether the command-line includes wildcards or just a single file. The VSCode list is always a superset of the command-line list.
Example:
VSCode Output:
Command-line Output:
Further notes:
When installing in the project that has rxjs 5.x library, cspell crashes with the following error when executed:
rxjs_1.of is not a function
Steps to reproduce:
npm i [email protected] cspell
./node_modules/.bin/cspell **/*.js
The standard format for linters is file-path:line:column
but cspell is using file-path[line, column]
, making it incompatible with lots of tools that rely on this.
For example iTerm2 fails to identify correct filename and the semantic-history feature get broken before it tries to open file-path[line
instead of file-path
.
I've long been using cspell as a plugin for VSCode and it works well--thanks! Today I installed the command-line version (npm install -g cspell
) and then tried this:
$ cspell --help
-bash: /Users/msorens/code/git/proj-ui/node_modules/cspell/dist/app.js: No such file or directory
I have tried sitting in different directories, but always the same error. That path reference is to an old git repo I have not even used for months. What is telling it to try to look there...?
I want to ignore all of my test files. This is what my config looks like:
{
"version": "0.1",
"words": [
"blockchain", "stuffs", "moob"
],
"ignoreRegExpList": ["\\woob*\\w"],
"flagWords": [
"stuff"
],
"ignorePaths": [
"node_modules/**",
".git",
"*Tests.js"
],
"minWordLength": 2
}
The "*Tests.js"
does not seem to do the trick. Any suggestions?
Keeping a list of words inside a JSON file sounds more of a sadistic task. If the wordlist would be loaded from a simple plaintext file, it could also be re-used by other tools/spellers.
Config file should have an option to mention the filename containing the wordlist.
Maybe in the future this file could also be an URL, as in this case it would allow you to share a wordlist across multiple repositories instead of having to copy it.
The default value of ignoreRegExpList
for HTML includes the href
pattern so that cspell doesn't check the contents of the href
attribute of links. However, I need it to do so. How can I disable the default ignore pattern?
BTW, it's a really questionable default value, especially if it's not disableable.
When cSpell returns that there are no errors in the files it has checked, it still sends an output to the error stream.
https://github.com/Jason3S/cspell/blob/d66356d72721536e5c6a96a1d19046632cf7d394/src/app.ts#L77
This gives a false negative when for example using it in a CI test.
See a PowerShell Pester test run here: https://ci.appveyor.com/project/johlju/certificatedsc/build/2.3.45.0#L465
Is it possible to override this behavior? Either a parameter so that it does not generate an error at all (if the output contains rows, errors were found), or a parameter to only send output to the error stream when an error was detected. In the later, if no errors was detected, I would be good to output the string in the stdout.
Building the dictionaries over and over does not make sense when deploying cspell.
The idea is to move all the currently included dictionaries out of the cspell repository and into cspell-dicts
See: streetsidesoftware/vscode-spell-checker#124
The file extension .hbs should be treated as type "handlebars"
These files should use the same dictionary set as HTML.
For some reason I can ask VSCode to use two languages ("de,en"
in my case), but when I am using the package directly in CI, it set the first language only.
Jason, what about html reporter? Do you plan to implement this feature?
cspell -v "**/*.ts"
Exclusion Globs:
Glob: dictionaries/** from cSpell.json
Glob: migrated_dictionaries/** from cSpell.json
Glob: node_modules/** from cSpell.json
Glob: coverage/** from cSpell.json
Glob: .git/** from cSpell.json
Glob: dist/** from cSpell.json
Glob: package.json from cSpell.json
Glob: **/package.json from cSpell.json
Glob: **/.cspell.json from cSpell.json
Glob: .vscode/** from cSpell.json
Glob: node_modules/** from default
I get this error when using cspell: 3.0.1
:
cspell src/**/*.ts
rxjs_1.of is not a function
npm ERR! Linux 4.4.0-101-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v7.10.1/bin/node" "/home/travis/.nvm/versions/node/v7.10.1/bin/npm" "run" "spell"
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] spell: `cspell src/**/*.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] spell script 'cspell src/**/*.ts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mmm-awesome-alexa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cspell src/**/*.ts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mmm-awesome-alexa
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mmm-awesome-alexa
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/.npm/_logs/2018-04-29T10_50_40_294Z-debug.log
I read in #48 that:
The command line version cannot pick up the settings from VS Code.
But it actually would be nice having both of them acting together. I think at least words in the local project dictionary (in .vscode/settings.json with key "cSpell.words") should be considered by the CLI version.
package main
import (
"github.com/imdario/mergo"
)
reports imdario and mergo as misspelt words. Ideally it should be possible to turn on only parsing comments in a file.
I had this sequence below which reports Fjira
as an unknown word and I know no way to avoid it:
<dash-feed://https%3A%2F%2Fjira.readthedocs.io%2Fen%2Flatest%2Fjira.xml>`_ format.
I didn't check the code but I have reasons to believe that probably URL support had the protocol hardcoded and thus failing to recognise it as a URI/URL.
Fails to detect obviously misspelt words, such as:
hellosd
applesq
bananasa
respectss
Tested version 1.0.1 on Windows.
Am I missing something?
I would like to spellcheck last commit message which means that cspell should be able to spellcheck from stdin with something like echo "some spell missstake!" | cspell
If cspell
would recognise stdin presence, it would easily be used to spell commit messages or other things that are not stored on file on disk.
While trying to enable cspell to be used a pre-commit hook, I faces a new issue, failure to install when doing:
pip install --user nodeenv
git clone https://github.com/Jason3S/cspell
cd cspell
nodeenv nenv
. nenv/bin/activate
npm install -g .
The last command fails with:
$ npm install -g . [21:18:12]
npm ERR! path /home/ssbarnea/cspell/nenv/lib/node_modules/cspell/dist/app.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/ssbarnea/cspell/nenv/lib/node_modules/cspell/dist/app.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ssbarnea/.npm/_logs/2018-07-04T21_18_18_526Z-debug.log
(nenv)FAIL: 254
It seems that foobar's
is reported as a word instead of checking for foobar
.
The default colored output is causing serious difficulties in reading the output mainly due to a combination of use of bold, red and green. This happen even for those that are not color blind.
Colors are good as they can increase lability of the text but in this case I think they work against it.
I propose a simplification
Words such as customizer fail. Using a larger English dictionary that supports word variations would help to reduce the many false positives I am seeing.
pre-commit is a framework for managing git pre-commit hooks, one that allow project maintainers to define hooks that can be reused by all project contributors.
In most cases enabling support for a new tool is done by creating a simple hook definition file in the root of the repository. This is enough to enable users to consume that tool.
Please note that I am already working on testing this and once is ready I should be able to make pull request to activate it. Still, there are few things I need to sort out before making the PR, one of them was the recently fixed bug related to installation.
There are a few things needed:
cspell is flagging 'dont' in dontRestart
as an error. This started happening after I upgraded from 2.x to 3.x.
cSpell: 3.1.3
node: 10.3.0
node_modules/.bin/cspell -v index.js
cspell;
Date: Sun, 24 Jun 2018 12:51:54 GMT
Options:
verbose: Yes
config: {cspell.json,.cspell.json}
exclude: node_modules/**
files: index.js
wordsOnly: No
unique: No
Config Files Found:
cspell.json
Exclusion Globs:
Glob: node_modules/** from default
Checking: index.js, File type: javascript, Language: en ... Issues: 3
Dictionaries Used: gue, en_us, companies, softwareTerms, misc, filetypes, typescript, node, npm
index.js:319:23 - Unknown word (dont)
index.js:330:26 - Unknown word (dont)
index.js:351:16 - Unknown word (dont)
CSpell: Files checked: 1, Issues found: 3 in 1 files
config (.spelling has a handfull of project specific non-words and some things like isarray etc)
{
"language": "en",
"allowCompoundWords": true,
"dictionaries": ["gue"],
"dictionaryDefinitions": [
{"name": "gue", "path": "./.spelling"}
]
}
cspell: 3.1.0
node: 10.3.0
Here's the stripped down contents of my cspell.json
{
"language": "en"
}
Verbose output
node_modules/.bin/cspell -v index.js |less -r
cspell;
Date: Sun, 24 Jun 2018 04:00:52 GMT
Options:
verbose: Yes
config: {cspell.json,.cspell.json}
exclude: node_modules/**
files: index.js
wordsOnly: No
unique: No
Config Files Found:
cspell.json
Exclusion Globs:
Glob: node_modules/** from default
Checking: index.js, File type: javascript, Language: ... Issues: 220
Dictionaries Used: companies, softwareTerms, misc, filetypes, typescript, node, npm
If I set --local en on the command line it works as expected. I've tried using local instead of language in the config file, and I've tried with no config file.
Hi Jason,
Great library and really good to see you using TS. We're using cspell as part of our CI pipeline and for one project we are deploying to AWS Lambda. That forces us to build using node v4.3 which doesn't support the ES2015 output you are targeting in your TS config.
This results at build in
/home/ubuntu/email-adapter/node_modules/cspell/dist/app.js:10
const { uri = '', row, col, text } = issue;
^
SyntaxError: Unexpected token {
I think older versions could be supported by targeting ES3 - unless of course you're using any ES2015+specific features that TS doesn't account for?
Thanks,
I have a project where the NPM project is nested in the folder UI/Dashboard. I would like to ignore all JSON files as it is not possible to use pragma directives in comments in JSON files. The cSpell.json file created by the extension when using "add to project dictionary". It is at the top level under the .vscode folder.
I've tried: "**/.json", "UI/Dashboard/tslint.json", "UI/Dashboard/.json", etc. I've also tried copying the cSpell.json to the .vscode folder under UI/Dashboard but nothing seems to work.
Is there a defect?
Sorry for the flood of issues ... this one is very non urgent (and opinionated) so feel free to ignore ...
The summary line
CSpell: Files checked: 16, Issues found: 0 in 0 files
Is emitted via stderr wether or not there were any errors found in the spell check. IMO stderr when there are errors and stdout for non errored runs. A silent when no errors option would work as well. I'm happy to figure it out and submit a PR if you're interested.
$ npm install -g cspell
$ cspell -h
/usr/lib/node_modules/cspell/dist/app.js:85
.action(async (files, options) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
$ cat /etc/fedora-release
Fedora release 26 (Twenty Six)
A command to give insight into why words might be considered correct.
See: streetsidesoftware/vscode-spell-checker#74
Example help:
Usage: cspell trace [options] <words...>
Report on tracing a word through the dictionaries
Options:
-h, --help output usage information
-c, --config <cspell.json> Configuration file to use. By default cspell looks for cspell.json in the current directory.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.