Git Product home page Git Product logo

node-wcag's Introduction

node-wcag Build Status Coverage Status

WCAG and Section 508 accessibility audits from the command line or as a traditional node module.

WCAG Screenshot

CLI installation

$ npm install wcag --global

CLI usage

First, get a free AChecker API ID. Then:

$ wcag wikipedia.org --id=<achecker id>

Also works against localhost:

$ wcag localhost:8000 --id=<achecker id>

Options

id

Type: string

Your free AChecker API ID.

$ wcag wikipedia.org --id=845cc0a8435cb0a766396a8c56399a43df0c843

If an id is not passed on the command line, the tool will check for an ACHECKER_ID environment variable.

guide

Type: string
Choices: 508, WCAG1-A, WCAG1-AA, WCAG1-AAA, WCAG2-A, WCAG2-AA, WCAG2-AAA, BITV1, STANCA Default: WCAG2-AA

The accessbility guideline to validate against.

$ wcag wikipedia.org --id=<achecker id> --guide=508
$ wcag wikipedia.org --id=<achecker id> --guide=BITV1

Module installation

$ npm install wcag

Module usage

var wcag = require('wcag');
var options = {
  id: '69f6ea6a9e30b37c3d341d3b716df218f8942c0e',
  uri: 'http://contolini.github.io/node-wcag/test/fixtures/whitehouse.html',
  guide: 'WCAG2-AA'
};

wcag(options, function (error, data) {
  if (error) {
    console.error(error);
  } else {
    console.log(data);
  }
});

The example will return this output

Options

id

Type: string
Required: true Your free AChecker API ID.

uri

Type: string Required: true URL for the page you want to validate

guide

Type: string Required: false Choices: 508, WCAG1-A, WCAG1-AA, WCAG1-AAA, WCAG2-A, WCAG2-AA, WCAG2-AAA, BITV1, STANCA Default: WCAG2-AA

The accessbility guideline to validate against.

Contributing

Please read the Contributing guidelines.

Running node-wcag locally

To contribute code, fork this repo, clone it down to your machine and use npm link:

$ npm uninstall -g wcag
$ cd node-wcag
$ npm link
$ wcag whatever.com

Running tests

We are using nodeunit to test. To run tests, first install nodeunit and any dependencies via npm:

npm install

Run tests with:

npm test

License

The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

Software source code previously released under an open source license and then modified by CFPB staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open-source license.

For further details, please see: http://www.consumerfinance.gov/developers/sourcecodepolicy/

node-wcag's People

Contributors

anselmbradford avatar ascott1 avatar contolini avatar wpears avatar zrrrzzt 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

Watchers

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

node-wcag's Issues

No way to obtain an AChecker API ID - is this project alive?

CLI requires an AChecker API id:

$ wcag domainname.com
Please provide an AChecker API ID with `--id` or setting an `ACHECKER_ID` environment variable. Register at http://achecker.ca/register.php to get an ID.

http://achecker.ca/register.php returns 404, it looks like the original service is no longer there.

What is the status of this project? Any hope of getting it back to a useful state?

Find a way to make reporting less verbose

Some sites report hundreds of potential problems which can be overwhelming to scroll through. The problems often have the same message but occur on different lines.

Maybe we should cap the list by default. Something like:

  ⚠  499 potential problems found.

  ⚠  183:70 Anchor text may not identify the link destination.
  ⚠  183:174 Anchor text may not identify the link destination.
  ⚠  183:243 Anchor text may not identify the link destination.
  ⚠  183:295 Anchor text may not identify the link destination.
  ⚠  183:351 Anchor text may not identify the link destination.
  ⚠  183:409 Anchor text may not identify the link destination.
  ⚠  183:467 Anchor text may not identify the link destination.
  ⚠  183:522 Anchor text may not identify the link destination.
  ⚠  183:579 Anchor text may not identify the link destination.
  ⚠  183:638 Anchor text may not identify the link destination.
  ⚠  183:694 Anchor text may not identify the link destination.
  ⚠  183:749 Anchor text may not identify the link destination.

  487 additional problems not shown. Run with `--verbose` to show full list.

Or maybe we should just group similar errors?

  ⚠ 183:70, 183:174, 183:243, 183:295, 183:351, 183:409, 183:467, 183:522, 183:579, 183:638, 183:694, 183:749 Anchor text may not identify the link destination.

Or:

  ⚠ Anchor text may not identify the link destination. Occurs at 183:70, 183:174, 183:243, 183:295, 183:351, 183:409, 183:467, 183:522, 183:579, 183:638, 183:694, 183:749.

Example of the problem:

screen shot 2015-05-29 at 2 17 13 pm

Switch from xml2json to xml2js

xml2js is a parser written in pure JavaScript so the node-gyp buildstep we get by using xml2json will no longer be necessary.

Haven't looked into if we can just switch or if it requires a lot of extra work.

Parse multiple URLs at once

i.e. Let the user do wcag whatever.com anotherwebsite.com foo.com.

I'm not even sure what the output would look like.

Travis CI failing on `npm install`

Turns out the global installation isn't the problem: https://travis-ci.org/contolini/node-wcag/builds/80614351

$ npm install
npm ERR! Linux 3.13.0-40-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v0.12.7/bin/node" "/home/travis/.nvm/versions/node/v0.12.7/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/repo-templates
npm ERR! 404 
npm ERR! 404 'repo-templates' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'verb'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/build/contolini/node-wcag/npm-debug.log
The command "npm install" failed and exited with 1 during .
Your build has been stopped.

wat.

Add "quiet" mode

Sometimes you don't want the entire report. You just want to know if it PASSES (no errors founds) or FAILS. See #8 (comment).

Check if supplied URL is valid

Use the valid-url module

var validUrl = require('valid-url')

if (opts.uri && !validUrl.isWebUri(opts.uri)) {
    return callback(new Error('You supplied an invalid URL.'), null);
}

Abort on bad websites

If a request doesn't return 200, tell the user they supplied a bad URL.

http.get('http://thisisnotalegitimatewebsite.foo').on('error', function() {
  console.log("You supplied an invalid URL.");
});

Split CLI as separate module

I've always had one module containing both CLI and module. However, after reading this I think it would be better to keep them apart.

$ npm install wcag

Would install the module

$ npm install wcag-cli -g

would install the CLI (much as it is today)

It would still be possible to enable use of wcag as CLI handle

$ wcag <url> --key=<key>

Error: Unable to connect to undefined

I haven't had the time to look into this, but here's what I've got so far.

$ wcag https://www.mrfylke.no/ --id=69f6ea6a9e30b37c3d341d3b716df218f8942c0e

Returns

Error: Unable to connect to undefined

The same error message is returned from the module.

'use strict';

var wcag = require('wcag');
var options = {
  id: '69f6ea6a9e30b37c3d341d3b716df218f8942c0e',
  uri: 'https://www.mrfylke.no',
  guide: 'WCAG2-AA'
};

wcag(options, function (error, data) {
  if (error) {
    console.error(error);
  } else {
    console.log(data);
  }
});

//=> [Error: Unable to connect to undefined]

So far I've only seen this error with this url. If you check the url via the achecker websites everything is ok. The error message itself seems to be returned from lib/checkURI.js so that's probably a good place to start.

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.