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

Misspell word 'demostrate' is not detected when scan via FILE access. #999

Closed
4 of 18 tasks
vikivivi opened this issue Feb 25, 2021 · 3 comments
Closed
4 of 18 tasks

Comments

@vikivivi
Copy link

Info

Kind of Issue

  • runtime - command-line tools
  • building / compiling
  • security
  • change in behavior
  • crash / error

Which Tool or library

  • cspell -- the command-line spelling tool
  • cspell-tools -- used for building dictionary files
  • cspell-lib -- library that does the actual spell checking.
  • cspell-trie -- tool for working with trie files.

Which Version

Version: cspell 5.2.4 with node-v14.16.0-linux-x64.tar.xz from nodejs.org.
All other node_modules: cspell is freshly installed today 25-Feb-2021.

Issue with supporting library?

  • No
  • cspell-glob -- library for matching glob patterns
  • cspell-io -- thin file i/o library
  • cspell-trie-lib - trie lib
  • cspell-trie2-lib - trie lib alternate format

OS:

  • Macos
  • Linux
  • Windows
  • Other

version:

Ubuntu 20.04.2 LTS (Fully upgraded using apt-get dist-upgrade)

Bug Description

Describe the bug

Misspell word demostrate not reported as unknown word when scan as FILE.

To Reproduce

Steps to reproduce the behavior:

$ cat hello.c
#include <stdio.h>

int main() {
    /* Currently demostrate thisisbadspell */
    printf("Demostrate misspell!");
    printf("Demonstrate correct spelling!");
    return 0;
}
  • Misspell word demostrate is detected correctly when using stdin.
$ cat hello.c | /home/user/bin/cspell/node_modules/.bin/cspell lint -c /home/user/bin/cspell/cspell.json --no-progress --no-summary stdin
stdin:4:18 - Unknown word (demostrate)
stdin:4:29 - Unknown word (thisisbadspell)
stdin:5:13 - Unknown word (Demostrate)
  • Misspell word demostrate is NOT detected when using FILE.
$ /home/user/bin/cspell/node_modules/.bin/cspell lint -c /home/user/bin/cspell/cspell.json --no-progress --no-summary ./hello.c 
/home/user/hello.c:4:29 - Unknown word (thisisbadspell)
  • FYI, printf is included in my custom dictionary. See cspell.json
  • Verifying misspell demostrate in not in dictionaries. Seem OK.
$ grep -rn "demostrate" ~/bin/cspell/node_modules/@cspell/
$ find ~/bin/cspell/node_modules/@cspell/ -name "*.gz" | xargs -n1 zgrep -Hn demostrate

Expected behavior

stdin detection seem working correctly. Detection rate via FILE seem doubtful. I am not sure am I the only one have this issue.

Screenshots

See above console output.

Additional context

Add any other context about the problem here.

cspell.json

{
    "version": "0.1",
    "language": "en",
    "words": [
    ],
    "flagWords": [
    ],
    "enableFiletypes": [
        "shellscript"
    ],
    "ignorePaths": ["node_modules/**"],
    "dictionaries": ["custom"],
    "dictionaryDefinitions": [
        { "name": "custom", "path": "/home/user/bin/scripts/data/dictionary-aspell-personal.txt"}
    ]
}

Example Repository (Optional)

An example repository makes things easier to debug.

@Jason3S
Copy link
Collaborator

Jason3S commented Feb 25, 2021

@vikivivi,

Thank you for the excellent bug report.

The issue is with the cpp settings. It has allowCompoundWords by default.

Adding --language-id=cpp to the command line will show the same behavior.

cat hello.c | /home/user/bin/cspell/node_modules/.bin/cspell lint -c /home/user/bin/cspell/cspell.json --no-progress --no-summary --language-id=cpp stdin

To always turn off allowCompoundWords, use the following:

"languageSettings": [
    {
        "languageId": "*",
        "allowCompoundWords": false
    }
]

trace is a useful command to see if a word is in one of the dictionaries:

cspell trace demostrate

@vikivivi
Copy link
Author

Thank you @Jason3S . You answered my issue with the additional setting for my cspell.json. I am closing this issue. Thank you for introducing the trace command. I guess people like us (the user) will fail to understand much of the cspell.json setting.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants