Code Monkey home page Code Monkey logo

grunt-plato's Introduction

grunt-plato

Task to generate static analysis reports via plato

For more information on plato, see the docs and some example reports

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-plato --save-dev

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-plato');

Overview

In your project's Gruntfile, add a section named plato to the data object passed into grunt.initConfig().

grunt.initConfig({
  plato: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    }
  }
})

Options

options.jshint

Type: Object Default value: unset

A jshintrc style object specifying jshint options, see JSHint docs

options.complexity

Type: Object Default value: unset

A series of options passed to complexity-report, see Phil Booth's complexity-report

Usage Examples

Using Default Options

grunt.initConfig({
  plato: {
    your_task: {
      files: {
        'report/output/directory': ['src/**/*.js', 'test/**/*.js']
      }
    }
  }
})

Custom complexity options

plato: {
  your_task: {
    options : {
      complexity : {
        logicalor : false,
        switchcase : false,
        forin : true,
        trycatch : true
      }
    },
    files: {
      'reports': ['src/**/*.js']
    }
  }
}

Using a .jshintrc file

plato: {
  your_task: {
    options : {
      jshint : grunt.file.readJSON('.jshintrc')
    },
    files: {
      'reports': ['src/**/*.js']
    }
  }
}

Disabling jshint reporting

plato: {
  your_task: {
    options : {
      jshint : false
    },
    files: {
      'reports': ['src/**/*.js']
    }
  }
}

Excluding files matching a specific regexp

plato: {
  your_task: {
    options : {
      exclude: /\.min\.js$/    // excludes source files finishing with ".min.js"
    },
    files: {
      'reports': ['src/**/*.js']
    }
  }
}

Excluding files from a file (will overwrite exclude option)

plato: {
  your_task: {
    options : {
      excludeFromFile: '.jshintignore'    # excludes source files placed in .jshintignore
    },
    files: {
      'reports': ['src/**/*.js'],
    },
  },
}

Release History

  • 0.2.1 bumped for plato 0.6.0
  • 0.2.0 bumped for plato 0.5.0
  • 0.1.5 updating deps for grunt 0.4.0 final
  • 0.1.4 defaulting to new maintainability index
  • 0.1.3 updated dependencies
  • 0.1.2 updated for grunt 0.4.0rc5
  • 0.1.1 removed debug output
  • 0.1.0 initial release

grunt-plato's People

Contributors

afronski avatar eskimoblood avatar joshuacc avatar jsoverson avatar jussi-kalliokoski avatar m90 avatar serginator avatar yorch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-plato's Issues

installation fails

$ npm install --save-dev grunt-plato
npm ERR! Error: Invalid version: "0.2"
npm ERR! at Object.module.exports.fixVersionField (/usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:183:13)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:30:38
npm ERR! at Array.forEach (native)
npm ERR! at normalize (/usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:15)
npm ERR! at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:33)
npm ERR! at then (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:126:33)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:331:40
npm ERR! at evalmachine.:272:14
npm ERR! at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5
npm ERR! at Object.oncomplete (evalmachine.:108:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Linux 3.13.0-44-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--save-dev" "grunt-plato"
npm ERR! cwd /home/nporto/projects/carre-edu
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/nporto/projects/carre-edu/npm-debug.log
npm ERR! not ok code 0

Seperate input/output directory in task config

Would it be possible to change your config from this
files: {
'outputdir': ['inputfiles']
}
to something like that:
files: {
'output': 'path/to/report/,
'input': [...]
}

because I'd like to use sth like '<%= bundle.root %>docs/report' as my output directory which doesn't work right now as an object key.

Anyway, great plugin!

edit: actually the use of templates seems to work, but I do often get problems like:
Could not parse JSON from file ../docs/report/files/Gruntfile_js/report.history.json
and so on... seems to happen if the folder is empty before the first generating of files.

TypeError: Object #<Object> has no method 'options'

Could not get this to work with the default options. Also there is no mention of a recursive option, does it search recursively within the source directory by default?

module.exports = function(grunt)
{
   grunt.initConfig(
   {
      bowerful: {

         store: 'assets/vendor/lib',
         dest: 'build/assets/vendor/lib',

         packages: {
            'jquery': ''
         }
      },
      plato: {
         files: {
            'report': ['assets/script']
         }
      }

   });

   grunt.loadNpmTasks('grunt-bowerful');
   grunt.loadNpmTasks('grunt-plato');

   // Default task.
   grunt.registerTask('default', 'bowerful plato');
};

Stack trace

TypeError: Object # has no method 'options'
at Object.module.exports (/home/csbrandt/projects/tmp/node_modules/grunt-plato/tasks/plato.js:17:24)
at Object.task.registerMultiTask.thisTask (/usr/lib/node_modules/grunt/lib/grunt/task.js:109:15)
at Object.task.registerTask.thisTask.fn (/usr/lib/node_modules/grunt/lib/grunt/task.js:58:16)
at Task. (/usr/lib/node_modules/grunt/lib/util/task.js:343:36)
at Task. (/usr/lib/node_modules/grunt/lib/util/task.js:319:9)
at Task. (/usr/lib/node_modules/grunt/lib/util/task.js:346:11)
at Task. (/usr/lib/node_modules/grunt/lib/util/task.js:319:9)
at installed (/home/csbrandt/projects/tmp/node_modules/grunt-bowerful/tasks/bowerful.js:97:13)
at Object.module.exports (/home/csbrandt/projects/tmp/node_modules/grunt-bowerful/tasks/bowerful.js:124:13)
at Object.task.registerTask.thisTask.fn (/usr/lib/node_modules/grunt/lib/grunt/task.js:58:16)

ReferenceError: Symbol is not defined

Hi,

Was wondering if you could point me in the right direction regarding this one.
Loading "plato.js" tasks...ERROR

ReferenceError: Symbol is not defined

npm version 1.4.28
node version v0.10.32

Registering "grunt-plato" local Npm module tasks.
Reading /Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/package.json...OK
Parsing /Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/package.json...OK
Loading "plato.js" tasks...ERROR

ReferenceError: Symbol is not defined
at /Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/utils/Enum.js:183:12
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/utils/Enum.js:190:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/types/ReportType.js:7:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/transform/formats/json/FormatJSONCheckstyle.js:15:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/transform/TransformFormat.js:15:29)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/module/report/AbstractReport.js:9:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/node_modules/typhonjs-escomplex-commons/dist/module/report/ModuleReport.js:11:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/dist/Plugins.js:17:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/node_modules/typhonjs-escomplex-module/dist/ESComplexModule.js:15:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/dist/ESComplex.js:15:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/node_modules/typhonjs-escomplex/dist/index.js:7:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/lib/reporters/complexity/index.js:3:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/node_modules/plato/lib/plato.js:27:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.module.exports (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt-plato/tasks/plato.js:13:15)
at loadTask (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:318:10)
at /Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:354:7
at Array.forEach (native)
at loadTasks (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:353:11)
at Task.task.loadNpmTasks (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:401:5)
at Object.module.exports (/Users/xxx/Documents/work/projectX/grunt/tasks/plato.js:58:9)
at loadTask (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:318:10)
at /Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:354:7
at Array.forEach (native)
at loadTasks (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:353:11)
at Task.task.loadTasks (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:365:5)
at Object.module.exports (/Users/xxx/Documents/work/projectX/grunt/Gruntfile.js:26:9)
at loadTask (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:318:10)
at Task.task.init (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt/task.js:437:5)
at Object.grunt.tasks (/Users/xxx/Documents/work/projectX/grunt/node_modules/grunt/lib/grunt.js:111:8)
at Object.module.exports as cli
at Object. (/usr/local/lib/node_modules/grunt-cli/bin/grunt:45:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Loading "plato.js" tasks...OK
No tasks were registered or unregistered.

Generated HTML reports reports functions with cyclomatic complexity 1 even if `maxcyc` is set to 8

The config in my Gruntfile is as below:

    plato: {
            options: {
                // Task-specific options go here.
            },
            your_target: {
                // Target-specific file lists and/or options go here.
                options: {
                    jshint: false, //leave jshint to grunt-jshint

                    // ref: https  : //github.com/philbooth/complexity-report
                    complexity : {
                        maxcyc     : 5,
                        maxcycden  : 100,
                        maxhd      : 100,
                        maxhv      : 100,
                        maxhe      : 100,
                        logicalor  : false,
                        switchcase : false,
                        forin      : true,
                        trycatch   : true,
                        newmi      : true
                    },

                    exclude: /\.min\.js$/    // excludes source files finishing with ".min.js"
                },
                files: {
                    'coverage/report/': coverage_code
                }
            }
        },

But, the generated report still highlight functions with cyclomatic complexity 1.

image

Is there way to limit the report to only highlight functions exceeding thresholds?

Multiple output directories not supported

https://github.com/jsoverson/grunt-plato/blob/master/tasks/plato.js#L58 runs plato with the output directory of the first entry in the files object.

This, for example, will not work:
files: {
'plato_reports/data': ['app/src/data/.js'],
'plato_reports/modules': ['app/src/modules/
.js'],
'plato_reports/system': ['app/src/system/.js'],
'plato_reports/utils': ['app/src/utils/
.js']
}

All output will be in plato_reports/data. Expected behavior was a different report for each entry in files.

JSHint validation error

The Plato report gives me this indentation warnings, but not the JSHint task, event using the same .jshintrc file as configuration file parameter for both tasks.

"Expected 'case' to have an indentation at 25 instead at 29."

complexity options

What options are available in the Gruntfile.js ?

In the readme I see stuff like logicalor, switchcase ,forin ,trycatch etc, but what are the options which can be defined in the gruntfile.js? Also is it possible to set an output format? I love the HTML output, but our buildprocess also loves surefire reports.

Is there any documentation on grunt-plato ?

Plato ignores //jshint ignore:line Comments

Once and a while I have to use the ignore Comment in my Source.
e.g.

var $j = jQuery.noConflict(); // jshint ignore:line

Plato ignores this comment and marks the line as hint-Error.

excludeFromFile: '.jshintignore' does not support glob format

My .jshintignore file is actually a list of glob formats:

public/js/lib/**/*.js
public/components/**/*.js
public/js/lib/vendor/**/*.js
public/js/portal/bower_components/**/*.js
public/js/portal/lib/common/*.js
public/js/portal/lib/vendor/*.js
public/js/portal/components/**/*.js
public/js/portal/widgets/validateForm.js

This doesn't work because it's converted into a set of regex, which is not correct.

Using Grunt with expand-option (in files) screws up the output-path

Using Grunt's expand option in my config, results in the generated files ending up in the wrong place.

Take this example:

files: [{
    expand: true,
    cwd: 'src/www/',
    src: [
        '**/*.js',
        '!lib/**/*.js',
        '!vendor/**/*.js',
        '!shim/**/*.js'
    ],
    dest: 'src/logs/plato/'
}]

The above example does not put the generated files in src/logs/plato/files, but in src/logs/plato/ components/services/insight.js /files

Note that src/www/components/services/insight.js is actually a valid JS file. There are many more, but somehow grunt-plato took the location of the first file it encountered(?) and inserted it's path into it's output-location.

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

Cannot read property 'dest' of undefined

Using the following config:

plato: {
    options: {
        jshint : grunt.file.readJSON('.jshintrc')
    },
    files: {
        'report': ['src/js/**/*.js', 'src/js/*.js']
    }
}

I get the following error:

Cannot read property 'dest' of undefined

This is the verbose output:

Running "plato:files" (plato) task
Verifying property plato.files exists in config...OK
File: [no files]
Options: jshint={"bitwise":true,"curly":true,"eqeqeq":true,"force":true,"freeze":true,"immed":true,"indent":4,"maxdepth":4,"smarttabs":true,"trailing":true,"undef":true,"unused":false,"globals":{"browser":true,"jQuery":true,"define":true,"console":true,"$":true,"_":true,"Mustache":true,"d3":true,"require":true,"setTimeout":true,"window":true,"moment":true,"confirm":true,"document":true,"ga":true}}, complexity={"newmi":true}

Using grunt v0.4.2

source without "./" at the start cuts off names in report

If you specify a source directory like this:
...
files: {
'release/quality': ['source/{star star}/.js', '!source/lib/{star star}/.js']
}

instead of

files: {
'release/quality': ['./source/{star star}/.js', '!source/lib/{star star}/.js']
}

where {star star} is * * without the spaces

All reports end up with the module/file names having the first letter cut off.

Using plato commandline this doesn't happen. This may still be an issue with Plato but I wanted to confirm here first before posting on Plato (and having to provide a non grunt-plato example).

Add a possibility to define .jshintrc file

It would be great to have the possibility to define an external .jshintrc file instead of having to load the file manually. Currently you have to manually load the file so it always gets loaded when you load the Gruntfile regardless of whether you run plato or not.

My use case is that I have a project where a build server builds the code, runs jshint, tests, coverage, plato, etc. then deploys the "compiled code" + Gruntfile.js (for running the tasks necessary there) on another node. The deployed package doesn't include the .jshintrc and nor should it since it doesn't run jshint at any point.

Plato throws errors when encountering #!/usr/bin/env shebang

I'm getting an Unexpected token ILLEGAL warning online 1 of a file when parsing the following JavaScript file:

#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var path = require('path');

And the grunt-plato server is:

Running "plato:server" (plato) task
Error reading file server/bin/fxa-content-server.js:  Error: Line 1: Unexpected token ILLEGAL
Error: Line 1: Unexpected token ILLEGAL
    at throwError (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:1161:21)
    at advance (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:1089:9)
    at lookahead (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:1118:18)
    at parseSourceElements (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:3070:21)
    at parseProgram (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:3109:19)
    at /Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:3609:38
    at Object.parse (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/node_modules/esprima/esprima.js:3856:23)
    at Object.run (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/node_modules/complexity-report/src/complexityReport.js:41:19)
    at Object.exports.process (/Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/lib/reporters/complexity/index.js:6:19)
    at /Users/pdehaan/dev/fxa-content-server_pd/fxa-content-server/node_modules/grunt-plato/node_modules/plato/lib/plato.js:102:37

Removing the #!/usr/bin/env node fixes the error.

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.