Skip to content

Instantly share code, notes, and snippets.

@scalvert
Last active August 27, 2021 23:12
Show Gist options
  • Save scalvert/59d0dbdf40bcc44c20c2d6ae20ced47e to your computer and use it in GitHub Desktop.
Save scalvert/59d0dbdf40bcc44c20c2d6ae20ced47e to your computer and use it in GitHub Desktop.

export const MyCustomThing: React.FC = ({ ruleResults: RuleResults }) => { return {ruleResults}; };

// End to end custom components

  • Pretty formatter can render a checkup log
  • Each task identifies what component its results should use to render
    • Ember test types wants to use a table, therefore it specifies the component to render as part of its metadata that is stored in rules, eg. { "component": "table" }
    • Plugins register their custom components similar to how tasks are themselves registered (via an API provided from checkup-formatter-pretty to plugins
  • Checkup runs, produces all results and stores into a SARIF log
    • SARIF log contains rules metadata for each task run, which itself includes which component, by name, we want to render using the pretty formatter
  • During format of the PrettyFormatter, we iterate the results in the log
    • for each task
      • lookup its rule metadata, and grab the component property's value (it should either match a built-in component, or if using a custom component, it should use the registered name)
      • lookup the component by name
      • pass result data into looked up component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment