jscpd doesn't handle naughty strings correctly
snowe2010 opened this issue Β· comments
Describe the bug
Recently started getting this error when testing my 'naughty strings' list. Seems like jscpd doesn't handle naughty strings very well π
build here
2021-03-08 02:51:49 [INFO] File:[/github/workspace/src/test/resources/naughty_string_printed.txt]
2021-03-08 02:51:50 [ERROR] Found errors in [jscpd] linter!
2021-03-08 02:51:50 [ERROR] Error code: 1. Command output:
------
TypeError: Cannot read property 'length' of undefined
at calculateLocation (/node_modules/@jscpd/tokenizer/dist/tokenize.js:72:59)
at /node_modules/@jscpd/tokenizer/dist/tokenize.js:115:32
at Array.map (<anonymous>)
at tokenize (/node_modules/@jscpd/tokenizer/dist/tokenize.js:115:10)
at Object.createTokenMapBasedOnCode (/node_modules/@jscpd/tokenizer/dist/tokenize.js:120:20)
at Tokenizer.generateMaps (/node_modules/@jscpd/tokenizer/dist/index.js:12:27)
at Detector.<anonymous> (/node_modules/@jscpd/core/dist/detector.js:33:46)
at Generator.next (<anonymous>)
at /node_modules/@jscpd/core/dist/detector.js:8:71
at new Promise (<anonymous>)
------
2021-03-08 02:51:50 [INFO] ---------------------------
2021-03-08 02:51:50 [INFO] File:[/github/workspace/src/test/resources/naughty_strings.json]
2021-03-08 02:51:51 [INFO] - File:[naughty_strings.json] was linted with [jscpd] successfully
here is naughty_strings_printed.txt
if you want to see the unicode characters before the file is written literally you can view that here.
To Reproduce
Steps to reproduce the behavior:
- add the above
naughty_string_printed.txt
to a repo - lint? using Super Linter
Expected behavior
Shouldn't have linting errors. This is a testing file in a resources directory, meant to test that my library handles naughty strings correctly.
Additional context
not sure what line it's failing on and I don't have the project setup to test locally. I'm getting this error in Github Actions.
Thank you, will investigate the issue
please use jscpd@3.3.25, the issue has been fixed
npx jscpd@3.3.25 .