New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qualweb/act-rules

Package Overview
Dependencies
Maintainers
3
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qualweb/act-rules

ACT-R module for qualweb accessibility evaluator

  • 0.1.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
411
increased by136.21%
Maintainers
3
Weekly downloads
 
Created
Source

QualWeb ACT Rules Module

Implementation of the ACT rules.

How to install

  $ npm i @qualweb/act-rules --save

How to run

Additional packages

  $ npm i @qualweb/get-dom-puppeteer --save
  'use strict';

  const { getDom } = require('@qualweb/get-dom-puppeteer');
  const { executeACTR } = require('@qualweb/act-rules');

  (async () => {
    const dom = await getDom('https://act-rules.github.io/pages/about/');

    const report = await executeACTR(dom.source.html.parsed, dom.processed.html.parsed);

    // print rules executed
    console.log(Object.keys(report));
    // ['QW-ACT-R1', 'QW-ACT-R2', 'QW-ACT-R3', ...]

    // print rule outcome
    console.log(report['QW-ACT-R1'].metadata.outcome);
    // 'passed' | 'failed' | 'notApplicable'

    // print rule results
    console.log(report['QW-ACT-R1'].results[0]);
    // {
    //   verdict: 'passed'
    //   description: 'HTML page has title element'
    //   code: '<title>Some title</title>'
    //   pointer: 'html > head > title'
    // }
  })();

Configure

If you want you can configure the module to run only specific rules, or rules based on their principles and conform levels. For that, just import the configure function from the module.

'use strict';

  const { getDom } = require('@qualweb/get-dom-puppeteer');
  const { configure, executeACTR } = require('@qualweb/act-rules');

  (async () => {
    const dom = await getDom('https://act-rules.github.io/pages/about/');

    const options = {
      rules: ['QW-ACT-R1', 'QW-ACT-R2'], // will execute these rules regarding the other options given
      principles: ['Understandable'], // will only execute rules that belong to the 'Understandable' principle
      levels: ['A', 'AA'] // will only execute rules that belong to the 'A' and 'AA' conform levels
    };

    // In this case, with these options, all rules that belong to the 'Understandable' principle and the 'A' and 'AA' conform levels and rules 'QW-ACT-R1' and 'QW-ACT-R2' will be executed

    configure(options);

    const report = await executeACTR(dom.source.html.parsed, dom.processed.html.parsed);
  })();

License

ISC

Keywords

FAQs

Package last updated on 21 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc