-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.0.0: Clean up API/file naming, add README (#25)
#### Description of changes * Bumps package.json to version 1.0.0 * Updates name/types of the exported API * Documents usage in README * Cleans up a few orphaned types (`ruleresults.ts`) and nonstandard file names (`/sarif/*.ts`) * Removes options parameter until we finalize which properties we want to offer (none of the old options map directly to first class properties in the new sarif format; probably want to reconsider that before making them part of our API surface). #### Pull request checklist - [x] Addresses an existing issue: Prepares for initial package release #21 - [x] **n/a** Added relevant unit test for your changes. (`npm run test`) - [x] Verified code coverage for the changes made.
- Loading branch information
Showing
12 changed files
with
98 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import * as Axe from 'axe-core'; | ||
import { WCAG } from './wcag'; | ||
|
||
export interface AxeResultDecorations { | ||
WCAG?: WCAG[]; | ||
} | ||
|
||
export type DecoratedAxeResult = Axe.Result & AxeResultDecorations; | ||
|
||
export interface DecoratedAxeResults { | ||
passes: DecoratedAxeResult[]; | ||
violations: DecoratedAxeResult[]; | ||
inapplicable: DecoratedAxeResult[]; | ||
incomplete: DecoratedAxeResult[]; | ||
timestamp: string; | ||
targetPageUrl: string; | ||
targetPageTitle: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,15 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import * as Axe from 'axe-core'; | ||
import { ConverterOptions } from './converter-options'; | ||
import { ResultDecorator } from './result-decorator'; | ||
import { SarifConverter } from './sarif-converter'; | ||
import { SarifLog } from './sarif/sarifLog'; | ||
import { SarifLog } from './sarif/sarif-log'; | ||
import { rulesWCAGConfiguration } from './wcag-mappings'; | ||
|
||
export { ConverterOptions } from './converter-options'; | ||
|
||
export function axeToSarif( | ||
axeResults: Axe.AxeResults, | ||
options?: ConverterOptions, | ||
): SarifLog { | ||
options = options ? options : {}; | ||
|
||
export function convertAxeToSarif(axeResults: Axe.AxeResults): SarifLog { | ||
const resultDecorator = new ResultDecorator(rulesWCAGConfiguration); | ||
const decoratedAxeResults = resultDecorator.decorateResults(axeResults); | ||
|
||
const sarifConverter = new SarifConverter(); | ||
|
||
// AxeResults -> ScannerResults | ||
const scannerResults = resultDecorator.decorateResults(axeResults); | ||
|
||
// ScannerResults -> ISarifLog | ||
return sarifConverter.convert(scannerResults, options); | ||
return sarifConverter.convert(decoratedAxeResults, {}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.