question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Annotations in GitLab (pull request proposal)

See original GitHub issue

Is your feature request related to a problem? Please describe.

Display annotations in GitLab in addition to standard CI output.

Describe the solution you’d like

Since GitLab version 13.2 (July 2020) Code Quality reports have been made available in the free tier.

The reports are based on the Code Climate issue spec as described in the Implementing a custom tool section.

I would like an option in the graphql-inspector diff command to generate code climate JSON reports.

I propose the following mapping of severity levels:

Criticality Level Code Climate Severity GitHub Reference
DANGEROUS major Warning
NON_BREAKING info Notice
BREAKING critical Failure

Ref: GitHub severity mappings

Icons can be seen on the Vulnerability Report page.

GitLab Code Quality Icons

Example in pull requests:

Code Quality report on pull request page

And in the diff view (only for GitLab ultimate, urghhh):

Code Quality report in the diff view

The JSON for each change will look like the following:

Sample:

{
  criticality: {
    level: 'DANGEROUS',
    reason: 'Adding an enum value may break existing clients that were not programming defensively against an added case when querying an enum.'
  },
  type: 'ENUM_VALUE_ADDED',
  message: "Enum value 'ABC' was added to enum 'EnumA'"
}
{
  "type": "issue",
  "check_name": "ENUM_VALUE_ADDED",
  "description": "Enum value 'ABC' was added to enum 'EnumA'",
  "content": "Adding an enum value may break existing clients that were not programming defensively against an added case when querying an enum.",
  "categories": ["level === 'NON_BREAKING' ? 'Compatibility' : 'Bug Risk'"],
  "fingerprint": "hex(criticality.level + ':' + type + ':' + message)",
  "severity": "major",
  "location": {
    "path": "schema/cool-schema.graphql",
    "lines": {
      "begin": 10,
      "end": 15
    }
  }
}

The option would be --codeclimate "path/filenameString.json" and it would output valid Code Climate JSON to said path.

I would like to contribute this feature via a pull request, but only if the feature gets merged.

Describe alternatives you’ve considered

Not applicable.

Additional context

Issue #54 and #361


Pinging @kamilkisiela as the only maintainer

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilkisielacommented, Oct 1, 2021

@jord1e yes 😃

1reaction
kamilkisielacommented, Sep 30, 2021

@jord1e sounds good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Annotations in GitLab (pull request proposal) #1990 - GitHub
Describe the solution you'd like Since GitLab version 13.2 (July 2020) Code Quality reports have ... Annotations in GitLab (pull request proposal) #1990....
Read more >
Blame/commit message annotations in merge request diff view
Proposal. I propose making it possible to show "blame" in the merge request diff, so that each change is effectively annotated by the...
Read more >
Review a merge request - GitLab Docs
Merge requests are the primary method of making changes to files in a GitLab project. Create and submit a merge request to propose...
Read more >
Promote blameless culture by using "annotate" instead - GitLab
It originates from git pull when the maintainer pulls commits from another developer's clone (although fewer and fewer people realise the connection these...
Read more >
Merge requests - GitLab Docs
Merge requests (MRs) are the way you check source code changes into a branch. When you open a merge request, you can visualize...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found