kucherenko / jscpd

Copy/paste detector for programming source code.
MIT License
4.61k stars 201 forks source link

bug: Incorrect .gitignore parsing? #651

Open maxpatiiuk opened 1 week ago

maxpatiiuk commented 1 week ago

This line has no impact as it's result is not assigned back to any variable:

https://github.com/kucherenko/jscpd/blob/d9584f2a248aefb6492139e98d61e9c43bc3abd3/apps/jscpd/src/init/ignore.ts#L15

Perharps it should be return ignore.map((pattern) => pattern.replace('!', '')); instead?

maxpatiiuk commented 1 week ago

Also, it seems like .gitignore patterns like /.git/** and detectClones's ignore pattern like .git/** are not working. .gitignores .git/** and detectClones's ignore pattern **/.git/** is working though.

Seems to be because fast-glob is being called with a pattern like /Users/maxpatiiuk/site/python/specify7/**/* That causes it to interpret every relative path ignore pattern to be relative to /, rather than process.cwd() Solutions: