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

option to specify includePaths for files #571

Closed
Morriz opened this issue Nov 13, 2020 · 3 comments
Closed

option to specify includePaths for files #571

Morriz opened this issue Nov 13, 2020 · 3 comments

Comments

@Morriz
Copy link

Morriz commented Nov 13, 2020

Is your feature request related to a problem? Please describe.
It is now not possible to run cspell without specifying the patterns of files with the command. There is one workaround via excludePaths that has a large performance hit:

cspell '**/*' '**/.*'

And then excluding everything again, except the suspects:

  "ignorePaths": ["./**", "./.**/**", "!/.values/README.md"],

This results in only the README.md being spell checked. Great. Not performant though.

Describe the solution you'd like
add includePaths so that we don't have to specify any pattern and can just run cspell, which will find all it needs in it's config to operate on.

Additional context
When working with a lot of projects it becomes cumbersome to have to maintain configuration in multiple places. It is preferable to be able to just call a command without parameters, and copy over a file from another project and just edit that, instead of invocations.

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 22, 2021

I think this is a good idea. I'm thinking about the right way to do it.

  • the globs listed on the command line are combined with the globs in the includePaths to determine the list of files to be checked.
  • If no files are listed in either, then no files are checked and cspell will exit with code 1.

The setting controls the behavior of the cspell cli and not the cspell library.

Jason3S added a commit that referenced this issue Feb 15, 2021
Related to #571

## Specify `files`

Make it possible to specify which files to check in the configuration file.

A new configuration field `files` has be added:

```js
{
    // tell cspell to check all JavaScript and Markdown files.
    files: ["**/*.js", "**/*.md"]
}
```
## Commits

* feat: Be able to specify files to spell check within the config.
* dev: Use files from config in cli application
* dev: add methods to support glob normalization to a common root.
* refactor: move the methods to a more logical place.
* dev: Correct the order to load configuration files to support VS Code Ext
* dev: Normalize globs passed in on the command line.
  - Added lots of test to ensure behavior.
  - Added support for `files` to be defined in the configuration.
  - Fixed some issues related to the root.
* dev: build lists of include and exclude globs.
* dev: File normalization is now done in cspell-glob.
* dev: Use a generator to flatten the results and make them unique.
* dev: Normalize relative paths
* dev: Use a single glob.
* dev: make single glob optional
* Use 0.2 for the main cspell.json file
* Update launch.json
@Jason3S
Copy link
Collaborator

Jason3S commented Feb 25, 2021

@Morriz,

With version 5.3.0 it is possible to add a files section to a cspell.json.

{
    "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
    "version": "0.2",
    "files": [
        "**/*",
        ".github/**/*"
    ]
}

@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