Giter VIP home page Giter VIP logo

Comments (3)

kucherenko avatar kucherenko commented on June 13, 2024

Try to use language html, not htmlmixed

from jscpd.

skyl avatar skyl commented on June 13, 2024

With 0.4.1, I get a similar traceback as above when trying to run against js and html templates:

        options = {
            path: path,
            reporter: 'json',
            files: [
                '**/*.js', '**/*.html'
            ],
            exclude: [
                '**/*main.js', '**/*build.js', '**/webspec/**'
            ],
            output: '.cpReport.json'
        };
        jscpd.prototype.run(options);

--->

Error: Unknown mode: [object Object]
  at Object.exports.getMode (node_modules/jscpd/node_modules/codemirror/addon/runmode/runmode.node.js:100:24)
  at evalmachine.<anonymous>:19:28
  at Object.exports.getMode (node_modules/codemirror/addon/runmode/runmode.node.js:101:10)
  at Object.exports.runMode (node_modules/codemirror/addon/runmode/runmode.node.js:106:22)
  at TokenizerCodeMirror.tokenize (node_modules/jscpd/src/tokenizer/TokenizerCodeMirror.coffee:41:16)
  at TokenizerCodeMirror.tokenize (node_modules/jscpd/src/tokenizer/TokenizerCodeMirror.coffee:1:1)
  at Strategy.detect (node_modules/jscpd/src/strategy.coffee:29:47)
  at Detector.start (node_modules/jscpd/src/detector.coffee:10:15)
  at jscpd.run (node_modules/jscpd/src/jscpd.coffee:105:26)

With languages=html, no code is found.

jscpd --path src --files "**/*.html" -l 100 --languages=html
...
100.00% (0 lines) duplicated lines out of 0 total lines of code.

With htmlmixed, I get a slightly different error:

> jscpd --path src --files "**/*.html" -l 100 --languages=htmlmixed
info:    jscpd - copy/paste detector for programming source code, developed by Andrey Kucherenko
warn:    File src/.cpd.yaml not found in current directory, or it is broken
warn:    File src/.cpd.yml not found in current directory, or it is broken
info:    Files search time: durationMs=550
info:    Scanning 869 files for duplicates...

evalmachine.<anonymous>:54
      state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "
                                 ^
TypeError: Object [object Object] has no method 'startState'
    at Object.html (evalmachine.<anonymous>:54:34)
    at Object.token (evalmachine.<anonymous>:101:20)
    at Object.exports.runMode (node_modules/jscpd/node_modules/codemirror/addon/runmode/runmode.node.js:171:24)
    at TokenizerCodeMirror.tokenize (node_modules/jscpd/src/tokenizer/TokenizerCodeMirror.coffee:66:18)
    at TokenizerCodeMirror.tokenize (node_modules/jscpd/src/tokenizer/TokenizerCodeMirror.coffee:3:59)
    at Strategy.detect (node_modules/jscpd/src/strategy.coffee:36:23)
    at Detector.start (node_modules/jscpd/src/detector.coffee:25:23)
    at jscpd.run (node_modules/jscpd/src/jscpd.coffee:129:28)
    at Object.<anonymous> (node_modules/jscpd/src/cli/cli.coffee:35:21)
    at after (node_modules/jscpd/node_modules/cli/cli.js:1057:18)

from jscpd.

kucherenko avatar kucherenko commented on June 13, 2024

Fixed in 0.5.0

from jscpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.