How to use alex - 5 common examples

To help you get started, we’ve selected a few alex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swinton / linter-alex / lib / analysis.js View on Github external
async function processBlob(context, owner, repo, tree_sha, filename, file_sha) {
  const {data: {content: encoded}} = await context.github.gitdata.getBlob({owner, repo, sha: file_sha})
  const decoded = Buffer.from(encoded, 'base64').toString()
  context.log(`Blob (${file_sha}) for https://github.com/${owner}/${repo}/blob/${tree_sha}/${filename} is: %j`, decoded)

  const analysis = alex.markdown(decoded).messages.map(message => {
    const {message: description, ruleId: title, location} = message
    return {
      path: filename,  // The path to the file being annotated.
      start_line: location.start.line, // The start line of the annotation.
      end_line: location.end.line, // The end line of the annotation.
      annotation_level: 'notice', // The level of the annotation. Can be one of notice, warning, or failure.
      message: description, // A short description of the feedback for these lines of code. The maximum size is 64 KB.
      title: title // The title that represents the annotation. The maximum size is 255 characters.
    }
  })

  return analysis
}
github JasonEtco / prosebot / lib / providers / alex.js View on Github external
buildResults () {
    const results = new Map()

    for (const [filename, contents] of this.contentMap) {
      const res = alex.markdown(contents).messages
      results.set(filename, this.serializeReasons(res))
    }

    return results
  }
}
github contentful / extensions / marketplace / sensitive-language / src / language-checker.js View on Github external
function checkContent(isRichText, value, config = {}) {
  const { messages } = isRichText
    ? alex.text(documentToPlainTextString(value), config)
    : alex.markdown(value, config);

  return messages;
}
github contentful / extensions / marketplace / sensitive-language / src / language-checker.js View on Github external
function checkContent(isRichText, value, config = {}) {
  const { messages } = isRichText
    ? alex.text(documentToPlainTextString(value), config)
    : alex.markdown(value, config);

  return messages;
}
github Skn0tt / alex-browser-extension / src / alex_content_script / alex-errors.ts View on Github external
export async function getAlexErrors(input: string): Promise {
  const report = alex.text(
    input,
    await getAlexConfig()
  );

  const { messages } = report;

  return messages.map(message => {
    return message.message;
  });
}

alex

Catch insensitive, inconsiderate writing

MIT
Latest version published 8 months ago

Package Health Score

66 / 100
Full package analysis

Popular alex functions