Giter VIP home page Giter VIP logo

plato's People

Contributors

alunny avatar bitdeli-chef avatar charmander avatar craig-davis avatar davidlinse avatar dciccale avatar devcrust avatar ehmicky avatar felipegs avatar ilanbiala avatar jraller avatar jsoverson avatar kunalkundaje avatar marook avatar matthewkastor avatar mischah avatar nerdgore avatar pedronauck avatar psysp avatar sljavi avatar tjbaker avatar tomhicks-bsf avatar treyhunner avatar typhonrt avatar victor-homyakov 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  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

plato's Issues

regex not working for -x or --exclude

I tried running the following command:

plato -r -d reports -t "MEAN Framework" -x /node_modules|reports|\.json/ .

And got the following error

-bash: reports: command not found
-bash: .json/: No such file or directory

What am I doing wrong?

Wrapping function

When you analyze code wrapped in a wrapper function, said function always gets a huge pizza slice () of the SLOC infographic in the report, even though the function is meaningless.

Example: https://github.com/sapo/Ink/blob/develop/Inkjs/Ink/UI/Toggle/1/lib.js

This file has a function starting in line 6, and wrapping the entire module. It is just a wrapper to create the module object (think module.exports) and return it, while getting all dependencies asynchronously, so I don't think it should count as the function with the most SLOC (although it CAN have if-statements and as such should appear in the cyclomatic complexity infograph.

Don't you think that an outmost function of a file, with no expressions outside, should not count towards SLOC statistics?

I get a lot of 'Could not parse JSON' errors

I seem to get a good report (awesome!) but I do get a lot of errors...
Could not parse JSON from file report\files\commonComponents_tabPanelMain_demo_v
iew_DemoPanel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tabPanelMain_demo_v
iew_DemoToolbar_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tabPanelMain_view_M
ainTabPanel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tabPanelMain_view_T
abPanelToolbar_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_model
_HardwareTreeGridModel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_model
_HardwareTreeModel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_store
HardwareTreeGridStore_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_store
HardwareTreeStore_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_view

TreeDemoTabPanel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_view

Viewport_js\report.history.json
Could not parse JSON from file report\files\commonComponents_tree_demo_app_js\re
port.history.json
Could not parse JSON from file report\files\commonComponents_underlinedPanel_dem
o_app_js\report.history.json
Could not parse JSON from file report\files\commonComponents_underlinedPanel_Und
erlinedPanel_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_controller_W
izardController_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_demo_demo_js
\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_private
_WizardContentPane_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_private
_WizardHelpWindow_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_private
_WizardNavigation_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_private
WizardStepsPane_js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_Wizard

js\report.history.json
Could not parse JSON from file report\files\commonComponents_wizard_view_WizardP
age_js\report.history.json
Could not parse JSON from file report\report.history.json
Done!

Example usage fails on Windows

In Windows when I try the example (modified for use from my project directory) I get an error:

plato -r -d report src/*.js

Output:

C:\node projects\mrteeth\node.js\beakerbridge>plato -d report -r ./*.js

fs.js:524
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory 'C:\node projects\mrteeth\node.js\beake
rbridge\*.js'
    at Object.fs.statSync (fs.js:524:18)
    at exports.inspect.runReports (C:\Users\Jeremy\AppData\Roaming\npm\node_modu
les\plato\lib\plato.js:59:33)
    at Array.forEach (native)
    at exports.inspect.runReports (C:\Users\Jeremy\AppData\Roaming\npm\node_modu
les\plato\lib\plato.js:58:11)
    at exports.inspect (C:\Users\Jeremy\AppData\Roaming\npm\node_modules\plato\l
ib\plato.js:113:7)
    at C:\Users\Jeremy\AppData\Roaming\npm\node_modules\plato\node_modules\fs-ex
tra\node_modules\mkdirp\index.js:38:26
    at Object.oncomplete (fs.js:297:15)

Instead I have to use:

plato -r -d report src/ *.js

Difference is the space between the path and the file filter.

If you don't specify files it throw exception and show stacktrace

This is what you see if you call plato -d <DIR>

/usr/lib/node_modules/plato/lib/util.js:14
  var prefixlen = first.length;
                       ^
TypeError: Cannot read property 'length' of undefined
    at Object.exports.findCommonBase (/usr/lib/node_modules/plato/lib/util.js:14:24)
    at Object.exports.inspect (/usr/lib/node_modules/plato/lib/plato.js:69:29)
    at Object.exports.exec (/usr/lib/node_modules/plato/lib/cli.js:47:9)
    at Object.<anonymous> (/usr/lib/node_modules/plato/bin/plato:19:5)
    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)

Can't take .jshintrc with comments

Title says it all -- even though .jshintrc is basically JSON, jshint actually accepts JavaScript-style double-slashed comments. plato does not.

Script access example

How can I use Plato from javascript instead of the commandline? I'm having trouble setting up Plato to be run as a script with npm and package json. https://github.com/isaacs/npm/issues/4403 It appears that I'm not allowed to specify strings with whitespace in them when setting up an item in the scripts hash. This makes it impossible to specify a title unless I want to make something nondescript or just plain ugly. If I could just call Plato from javascript and pass it the arguments I want, then I could just set up my script in package.json to call node and feed it a filename.

In package.json this doesn't work because of the space in the title

"scripts": {
  "generateReport": "plato --title \"Analysis of\" --recurse -d report src"
}

This would work though

"scripts": {
  "generateReport": "node scriptCallingPlato.js"
}

custom jshintrc predefs works unexpected for multiple files

$ plato -v
0.6.2

I have my file structure like below:

.
└── src
    ├── .jshintrc
    ├── bar.js
    └── foo.js

The src/.jshintrc file:

{
    "undef": true,
    "predef": ["define", "URL"]
}

Both src/foo.js and src/bar.js have the same content:

define();

These are my reproduce steps:

  1. Run plato -d output -l src/.jshintrc -r ./src in current directory
  2. Run open output/index.html to view the result

In result, I got:

src/bar.js lint errors: 0
src/foo.js lint errors: 1

And in report for src/foo.js it gave the error message:

Column: 1 "'define' is not defined."

However, the expected lint errors should all be 0 since my .jshintrc file have define in predef field

plato stuck in endless loop in node 0.9.10

FYI, when I run plato on this file or this one on node 0.8.20 everything is fine. When I switch to node 0.9.10, the following message is output to the console, endlessly:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

It doesn't matter if I change process.nextTick in my code to setImmediate or comment it out altogether (in the first example above). The second example does not do any recursion, timeouts, or nextTicks at all.

multiple input source directories

be able to have multiple projects / directory in the plato report
For example, i have a project with multiple directories which contains js code that i want to analyse with Plato and i want a seperation in the report.

Support for JSHint style globals

Seems that even when there's a JSHint style global declaration /*global $ MyNameSpace*/ at the top of the file, Plato still flags namespaces as not defined.

Live demo

Not sure how well it would work, but a website where you could just input an arbitrary git repo an get the stats.

Usage string is wrong

It say:

plato [options] file1.js file2.js ... fileN.js

which indicate that all options are optional -d is not so it need to be:

plato -d <DIR> [other options] file1.js [file2.js ... fileN.js]

other files are also optional [ xxx ] mean optional it's convention from unix.

Could not parse JSON from file /{PATH}/report.history.json

I am not sure if I am doing something incorrectly or if this is a known issue...

The reports are being generated correctly, but I am seeing the following warnings for each file. The paths are correct and the JSON files exist.

I am loading the plato task in another grunt plugin - not sure if that is pertinent.

Could not parse JSON from file /Users/jstrimp/castle-example/reports/analyze/files/a_js/report.history.json
Could not parse JSON from file /Users/jstrimp/castle-example/reports/analyze/files/x_js/report.history.json
Could not parse JSON from file /Users/jstrimp/castle-example/reports/analyze/files/y_js/report.history.json
Could not parse JSON from file /Users/jstrimp/castle-example/reports/analyze/report.history.json

Add support for extra extensions

JSHint and ComplexityReport both support specifying additional file extensions to include in scanning which is great for a project that I'm working on that needs to save JavaScript files as .SCP files for use by the host application.

Could you add a command-line parameter to specify additional file extensions to Plato?

Plugin API Support

This project is awesome! Just wondering what you'd think of some kind of API mechanism, so that others can crete Plato plugins. I've seen in other issue threads that you've entertained the idea of code coverage reports, but the actual computing of the statistics should be handled outside of Plato. With a plugin API of some sort, people could create beautiful Plato reports for just about anything--code coverage, unit test failures, developer contribution statistics, etc.

Perhaps you could have a config file for registering custom plugins like this:

plugins: {
  coverage: {
    command: "grunt coverage",
    expectedResult: "coverage-report.json"
  }
}

So basically Plato would spawn 3rd party scripts/processes to "do something", and we would expect those scripts/processes to output their results in some kind of well-known JSON format, which Plato would then use to create a chart.

For instance, maybe the JSON output for a code coverage report could look like this:

{
  "reportName": "Code Coverage",
  "chartType": "lineChart",
  "yAxis": "percent",
  "xAxis": "currentDate",
  "value": "72%"
}

This could be fed into the standard reporting mechanism that Plato uses to create historical reports over time. So in the above example, we could see the code coverage percentage trending up or down over time.

Changelog update

The readme contains a changelog, but it seems horribly out of date. Any chance that could be updated all the way to the latest release?

const keyword support

Some of my team is using the const keyword which is supported in V8/node.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/const

Right now plato shows warnings for const declarations:
const DB_NAME = 'mydb';
Column: 1 "Expected an identifier and instead saw 'const'."
Column: 1 "Expected an assignment or function call and instead saw an expression."
Column: 6 "Missing semicolon."

Is it possible this could be recognized as valid syntax? Or possibly it already is with a commandline option like jshint?

Thanks for bulding such an awesome JavaScript static analysis tool!

[enhancement] Allow for exclude from report option

Its great to point plato at a full project and let it go. The complexity linking and etc are quite nice. Until of course you see your node_modules being included and having to filter them out if you follow the prj/bin/ prj/lib/ and prj/node_modules/ directory structure. Any way to add a don't report on flag please :)

Example is not working, Error about plato/lib/util.js:6 (var prefixlen = first.length)

when i Run the example command - I get this Error:

/opt/plato/lib/util.js:6
var prefixlen = first.length;
^
TypeError: Cannot read property 'length' of undefined
at Object.findCommonBase (/opt/plato/lib/util.js:6:24)
at Object.inspect (/opt/plato/lib/plato.js:55:29)
at Object.exec (/opt/plato/lib/cli.js:43:9)
at Object. (/opt/plato/bin/plato:19:5)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:190:38)

Maintainability index of NaN breaks stuff...

I have a file that results in a maintainability index of NaN and when plato tries processing it I get the following error from plato-overview.js:111

Uncaught TypeError: Cannot call method 'toFixed' of null,

built in server

It would be nice to have an option to pass in some files and have it just start up a web server rather than generating files. Thoughts?

.jshintrc file not being honored?

When I run jshint manually, my preferred settings are applied (i.e. "quotmark": "single"). I currently have no issues remaining with jshint.

However, when I execute plato like this:

plato -r -d -l .jshintrc report routes/

I've also tried to specify the absolute path, to no avail. The report gets generated well (it's awesome!) but a lot of the warnings indicate that it's not picking up the settings in my jshintrc file.

Any ideas? Thanks!

Allow multiple exclusions

Specifying --exclude multiple times doesn't work:

plato -r -d report --exclude lib --exclude extra my_js_directory

Of course using a regular expression does work:

plato -r -d report --exclude lib\|extra my_js_directory

I think using multiple --exclude should probably work also.

filenames

Hello !

In your demo, for example with JQuery, names of the source files are like "src/ajax.js" (in the report)

When i try it on my project, filenames in the report are like :

if the path is : /my/full/path
and i have a file in the directory myFiles.js
so in the report the name is : my_full_path_myFiles.js

i launch the command : 'plato -r -d ~/Sites/plato /my/full/path'

Thanks in advance for your help

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.