Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to configure meta-data with rules (and pass them to reports) #165

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

nikku
Copy link
Member

@nikku nikku commented Feb 17, 2025

Proposed Changes

As described in #18, this allows rule authors to configure meta in a rule. The meta-data will be passed along with reports so downstream integrators, can, i.e. ship custom documentation URLs with their rules (camunda/camunda-modeler#4491).

Example rule (exposing a documentation URL)

module.exports = function(config) {
  return {
    meta: {
      documentation: {
        url: 'https://github.com/bpmn-io/bpmnlint'
      }
    },
    check: (node, reporter) => {
      ...
    }
  };
};

Example accessing the documentation URL from a report

const url = report.meta?.documentation?.url;

What's inside this PR

This PR is comprised in two parts:

  • 038a2cb adds meta support
  • 95be026 adds a transform hook that allows integrators to attach and/or modify existing rules (whereas the purpose is on modifying meta-data, i.e. overriding documentation URLs, or attaching them)

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

Closes #18

Depends on #163

Copy link
Member

@barmac barmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Base automatically changed from typings to main February 17, 2025 18:54
This is most handy for fiddling with meta-data exposed by rules,
i.e. to alter / inject documentation urls or other information.

This intentionally cannot be used to alter rule configuration or
activation; this must be done via a custom bpmnlint configuration.
@nikku nikku merged commit 376d85b into main Feb 17, 2025
7 of 9 checks passed
@nikku nikku deleted the meta branch February 17, 2025 19:15
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Feb 17, 2025
nikku added a commit that referenced this pull request Feb 17, 2025
nikku added a commit that referenced this pull request Feb 17, 2025
nikku added a commit that referenced this pull request Feb 17, 2025
nikku added a commit that referenced this pull request Feb 17, 2025
nikku added a commit that referenced this pull request Feb 17, 2025
barmac pushed a commit that referenced this pull request Feb 18, 2025
nikku added a commit to camunda/bpmnlint-plugin-camunda-compat that referenced this pull request Feb 18, 2025
Previously we injected them via camunda/linting,
now we can use the new meta infrastructure provided by
bpmnlint itself.

Related to bpmn-io/bpmnlint#165
nikku added a commit to camunda/bpmnlint-plugin-camunda-compat that referenced this pull request Feb 18, 2025
Previously we injected them via camunda/linting,
now we can use the new meta infrastructure provided by
bpmnlint itself.

Related to bpmn-io/bpmnlint#165
nikku added a commit to bpmn-io/bpmn-js-bpmnlint that referenced this pull request Feb 18, 2025
  This embeds a link to the actual documentation, if provided
  via `meta?.documentation?.url`.

  Related to bpmn-io/bpmnlint#165

  Closes #92

feat: show rule name with report

  This simplifies things, i.e. users are able to learn about the source of rules.
nikku added a commit to bpmn-io/bpmn-js-bpmnlint that referenced this pull request Feb 18, 2025
  This embeds a link to the actual documentation, if provided
  via `meta?.documentation?.url`.

  Related to bpmn-io/bpmnlint#165

  Closes #92

feat: show rule name with report

  This simplifies things, i.e. users are able to learn about the source of rules.
barmac pushed a commit to bpmn-io/bpmn-js-bpmnlint that referenced this pull request Feb 19, 2025
  This embeds a link to the actual documentation, if provided
  via `meta?.documentation?.url`.

  Related to bpmn-io/bpmnlint#165

  Closes #92

feat: show rule name with report

  This simplifies things, i.e. users are able to learn about the source of rules.
barmac pushed a commit to camunda/bpmnlint-plugin-camunda-compat that referenced this pull request Feb 20, 2025
Previously we injected them via camunda/linting,
now we can use the new meta infrastructure provided by
bpmnlint itself.

Related to bpmn-io/bpmnlint#165
nikku pushed a commit to camunda/linting that referenced this pull request Feb 20, 2025
We now provide the documentation via upstream.

Related to bpmn-io/bpmnlint#165
nikku pushed a commit to camunda/linting that referenced this pull request Feb 20, 2025
We now provide the documentation via upstream.

Related to bpmn-io/bpmnlint#165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to provide custom meta-data with rules
2 participants