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

"ignore" does not work with relative paths that don't start with a wildcard glob #611

Open
FFdhorkin opened this issue Oct 21, 2023 · 0 comments

Comments

@FFdhorkin
Copy link

Describe the bug
jscpd does not ignore paths that start with a relative path (as opposed to wildcard glob). Absolute paths work fine.

For example, with the following .jscpd.json:

    "ignore": [
        "patches/**"
    ],
    "reporters": [
        "console",
        "html"
    ],
    "output": "./jscpdReport",
    "gitignore": true
}

The patches folder does not get ignored. Changing "patches/**" to "./patches/**" does not work, either.

However, changing "patches/**" to "**/patches/**" ignores the root patches folder, but carries the risk of ignoring a subfolder with the same name that shouldn't be ignored.

An absolute path works, but is non-portable: /home/username/repos/reponame/patches

To Reproduce
Steps to reproduce the behavior:

  1. Have code in a subfolder that has a . prefix
  2. manually add it to the ignore section of your config, using the path from project root
  3. run jscpd
  4. folder from step 1 is not ignored

Expected behavior
A path that is in the ignore should follow filesystem rules.

  • /foo/** should ignore anything insides the system root "foo" folder.
  • foo/** and ./foo/** should ignore anything inside the "foo" folder at the project root

Desktop (please complete the following information):

  • OS: WSL2
  • OS Version: Ubuntu 22.04.2 LTS
  • NodeJS Version: 18.16.1
  • jscpd version: 3.5.10
@FFdhorkin FFdhorkin changed the title "ignore" does not work with paths that don't start with a wildcard glob "ignore" does not work with relative paths that don't start with a wildcard glob Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant