npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-cpplint

v0.4.0

Published

Validates C++ files with cpplint

Downloads

1,125

Readme

node-cpplint Build Status Dependency Status devDependency Status

Validates CPP files with Google's cpplint

Usage

This module has been built for usage with Node scripts, to run from the command line, and to be used as a Grunt task.

Options

All methods of using this module allow for these specific configuration options:

  • reporter The reporter to use ( spec | json | plain-text ); defaults to spec.
  • counting The counting-type ( total | toplevel | detailed ); defaults to total. The total number of errors found is always printed. If toplevel is provided, then the count of errors in each of the top-level categories like build and whitespace will also be printed. If detailed is provided, then a count is provided for each category like build/class.
  • verbose The verbosity level; defaults to 1. A number 0-5 to restrict errors to certain verbosity levels.
  • filters Enable/disable filtering for specific errors.
  • extensions List of file extensions to lint.
  • linelength The allowed line length.

A list of files is also expected.

CLI usage

Using the spec reporter, disabling whitespace/braces errors and linting file1.

bin/cpplint --reporter spec --filter whitespace-braces file1

Setting verbosity to 3, line length to 120, and the counting-type to detailed while linting file1 and file2.

bin/cpplint --verbose 3 --counting detailed --linelength 120 file2 file3

Using the plain-text reporter, ignoring build/deprecated errors and linting file1.

bin/cpplint --filter build-deprecated --reporter plain-text file1

Using the cc and hpp extensions and linting source1.cc and source1.hpp.

bin/cpplint --extensions cc,hpp source1.cc source1.hpp

JavaScript usage

Using the spec reporter

var cpplint = require('lib/index.js');
var reporter = require('lib/reporters').spec;
var options = {
  files: [
    '/path/to/some/files.cc'
  ]
};

cpplint(options, reporter);

Using a custom reporter, disabling whitespace/braces and enabling whitespace/include_alpha

var cpplint = require('lib/index');
var options = {
  files: [
    '/path/to/some/files.cc'
  ],
  filters: {
    'whitespace': {
      'braces': false,
      'include_alpha': true
    }
  },
  // This could be an array of strings or a comma separated string
  extensions: [
    'cc',
    'hpp'
  ]
};

cpplint(options, function (err, report) {
  // your reporting logic
});

Grunt Task

grunt.loadNpmTasks('node-cpplint');

grunt.initConfig({
  cpplint: {
    files: [
      'src/**/*.cc',
      'src/**/*.cpp'
    ],
    reporter: 'spec',
    verbosity: 1
  },
  filters: {
    'whitespace': {
      'braces': false,
      'include_alpha': true
    }
  },
  linelength: 120,
  // This could be an array of strings or a comma separated string
  extensions: [
    'cc',
    'hpp'
  ]
});

TODO

Future plans (in no particular order):

  • better test coverage
  • xunit-xml reporter

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests (using vows) for any new or changed functionality. Lint and test your code using grunt jslint and verify that all unit tests are passing with grunt vows.

Revision History

0.4.0

  • add support for the linelength option

0.3.0

  • update cpplint

0.2.0

  • update cpplint
  • added extensions option for overriding what file extensions to lint

0.1.5

  • more windows compability fixes (line-endings) (@zcbenz)

0.1.4

  • bug fix in filters support (@kevinsawicki)

0.1.3

  • update grunt task to work with grunt 0.4 (@kevinsawicki)
  • update dev dependencies (grunt-jslint, vows, ...)
  • added npm test support

0.1.2

  • added support for ignoring certain errors (filters)

0.1.1

  • added simple grunt task

0.1.0

  • first public version
  • provides a few simple options for validating CPP files