2017 © Pedro Peláez
 

library node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

image

webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  • Tuesday, April 3, 2018
  • by webignition
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2,390 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 7 % Grown

The README.md

node-jslint-output-parser Build Status

Overview

PHP parser for the output of reid/node-jslint, get lovely things such as:, (*1)

  • a list of errors
  • error counts
  • % of content scanned
  • bunnies

If you're building a PHP-based application that programmatically interfaces with node-jslint, this is for you., (*2)

Usage

The "Hello World" example

Running JSLint from the command line through node-jslint can give you a nice collection of error information to process:, (*3)

node jslint.js --json /home/jon/www/gears.simplytestable.com/src/SimplyTestable/WebClientBundle/Resources/public/js/app.js

[
   "/home/jon/www/gears.simplytestable.com/src/SimplyTestable/WebClientBundle/Resources/public/js/app.js",
   [
      {
         "id":"(error)",
         "raw":"Missing 'use strict' statement.",
         "evidence":"    var nextTaskIdCollection = [];",
         "line":6,
         "character":5,
         "a":"var",
         "reason":"Missing 'use strict' statement."
      },
      {
         "id":"(error)",
         "raw":"Unexpected '{a}'.",
         "evidence":"    ",
         "line":7,
         "character":1,
         "a":"(space)",
         "reason":"Unexpected '(space)'."
      },

Let's parse that in a unit test and see what we can get:, (*4)

<?php
$parser = new webignition\NodeJslintOutput\Parser();

$parser->parse($rawOutputString);
$nodeJsLintOutput = $parser->getNodeJsLintOutput();

$this->assertNotNull($nodeJsLintOutput);
$this->assertEquals(7, $nodeJsLintOutput->getEntryCount());
$this->assertEquals(4, $nodeJsLintOutput->getPercentScanned());

$outputEntries = $nodeJsLintOutput->getEntries();
foreach ($outputEntries as $outputEntry) {
    /* @var $outputEntry \webignition\NodeJslintOutput\Entry\Entry */    
    echo $outputEntry->getReason() . "\n";
    echo $outputEntry->getEvidence() . "\n";    
}

See? Useful. We can see how many entries are in the output, what the entries are and how much of the linted content was scanned., (*5)

Seeing Why JSLint Stopped Scanning

I LINT YOU. Y U NO SCAN ALL CODE, (*6)

Sometimes JSLint encounters too many errors, sometimes it stops scanning if the code quality is just not up to scratch., (*7)

It's nice to see why scanning stopped., (*8)

<?php
$parser = new webignition\NodeJslintOutput\Parser();

$parser->parse($rawOutputString);
$nodeJsLintOutput = $parser->getNodeJsLintOutput();

$this->assertTrue($nodeJsLintOutput->wasStopped());
$this->assertFalse($nodeJsLintOutput->hasTooManyErrors());

Building

Using as a library in a project

If used as a dependency by another project, update that project's composer.json and update your dependencies., (*9)

"require": {
    "webignition/node-jslint-output-parser": "*"      
}

Developing

This project has external dependencies managed with [composer][3]. Get and install this first., (*10)

# Make a suitable project directory
mkdir ~/node-jslint-output-parser && cd ~/node-jslint-output-parser

# Clone repository
git clone git@github.com:webignition/node-jslint-output-parser.git.

# Retrieve/update dependencies
composer.phar install

Testing

Have look at the [project on travis][4] for the latest build status, or give the tests a go yourself., (*11)

cd ~/node-jslint-output-parser
phpunit

The Versions

03/04 2018

dev-master

9999999-dev https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Jon Cram

parser output jslint

03/04 2018

2.0

2.0.0.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Jon Cram

parser output jslint

03/04 2018

dev-cs-psr4

dev-cs-psr4 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Jon Cram

parser output jslint

26/01 2014

1.0.6

1.0.6.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jon Cram

parser output jslint

25/01 2014

1.0.5.3

1.0.5.3 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jon Cram

parser output jslint

25/01 2014

1.0.5.2

1.0.5.2 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jon Cram

parser output jslint

24/01 2014

1.0.5.1

1.0.5.1 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jon Cram

rss

14/10 2013

1.0.5

1.0.5.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jon Cram

rss

13/09 2013

1.0.4

1.0.4.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jon Cram

rss

10/09 2013

1.0.3

1.0.3.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jon Cram

rss

19/03 2013

1.0.2

1.0.2.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jon Cram

rss

19/03 2013

dev-parse-from-json-output

dev-parse-from-json-output https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

 

by Jon Cram

rss

19/03 2013

1.0

1.0.0.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

 

by Jon Cram

rss

19/03 2013

1.0.1

1.0.1.0 https://github.com/webignition/node-jslint-output-parser

Parser for the output of reid / node-jslint, get lovely things such as a list of errors, error counts, % of content scanned, bunnies

  Sources   Download

MIT

The Requires

 

by Jon Cram

rss