Skip to main content

BaseTask

BaseTask

Kind: global class

new BaseTask(pluginName, context)

Creates a new instance of a BaseTask.

ParamDescription
pluginNameThe name of the plugin this task is included in.
contextThe runtime task context passed to the Task.

baseTask.log

Gets a reference to the SARIF log.

Kind: instance property of BaseTask
Read only: true

baseTask.config

Gets an object containing optional configuration for this Task. Tasks can be configured in the .checkuprc file.

Kind: instance property of BaseTask

baseTask.enabled

A boolean indicating whether this task is enabled or not. Tasks can be enabled by specifically configuring them in the .checkuprc file.

Kind: instance property of BaseTask

baseTask.fullyQualifiedTaskName

The fully qualified name for this task, in the format

pluginName/taskName

Kind: instance property of BaseTask

baseTask.addResult(messageText, kind, level, options)

Adds a result object to the Checkup output. Result objects are SARIF Result format.

Kind: instance method of BaseTask

ParamDescription
messageTextA non-empty string containing a plain text message
kindOne of a fixed set of strings that specify the nature of the result
levelOne of a fixed set of strings that specify the severity level of the result
optionsAdditional options to pass to the result
options.locationSpecifies a location where the result occurred
options.propertiesA property bag named properties, which stores additional values on the result

baseTask.flattenLintResults(results) โ‡’

Takes an array of nested lint results, ones that contain a top-level object and a messages array representing each result found for a file, and flattens them into an array of non-nested objects. This allows for easier processing into SARIF result objects.

Kind: instance method of BaseTask
Returns: An array of normalized lint results

ParamDescription
resultsAn array of lint results

baseTask.addRule(additionalRuleProps) โ‡’

Adds rule metadata to the SARIF log.

Kind: instance method of BaseTask
Returns: The task name, which represents the rule ID in the SARIF log.

ParamDescription
additionalRulePropsAdditional properties to be passed to the SARIF rule metadata.

baseTask.addRuleProperties(properties)

Adds additional properties to the rule metadata's properties in the SARIF log.

Kind: instance method of BaseTask

ParamTypeDescription
propertiesPropertyBagA to be merged with the rule metadata's properties.