Skip to content

Conversation

haya14busa
Copy link
Member

@haya14busa haya14busa commented Jun 15, 2020

This is a proposal of Reviewdog Diagnostic Protocol (RDP) Reviewdog Diagnostic Format as standard
diagnostic format.
Any review, suggestion, feedback, criticism, and comments from anyone are very
much welcome.

Preview: https://github.com/reviewdog/reviewdog/tree/rdp/proto/rdf

  • Updated Unreleased section in CHANGELOG or it's not notable changes.

@haya14busa haya14busa force-pushed the rdp branch 3 times, most recently from 6e5adc2 to b2ea1e5 Compare June 15, 2020 10:17
@haya14busa haya14busa requested a review from a team June 15, 2020 10:35
https://github.com/reviewdog/reviewdog repository, but we may create a separate
repository once it's reviewed and stabilized.

# Reviewdog Diagnostic Protocol (RDP)
Copy link
Contributor

Choose a reason for hiding this comment

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

The abbreviation RDP will create ambiguity with the popular Remote Desktop Protocol.
I think it would be better to find another abbreviation.

Copy link
Member Author

Choose a reason for hiding this comment

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

True. Do you have any suggestions?
I wonder whether protocol is good or not as well. https://github.com/reviewdog/reviewdog/tree/rdp/proto/rdp#open-questions

But if we use Format instead of Protocol, RDF (Reviewdog Diagnostic Format) is also used by Resource Description Framework as well.

The acronym is basically for providing short format name (currently rdpjsonl / rdpjson), so maybe it's ok even if there are other usages. Any thought?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather not collide w/ RDF / RDP -- I use both.

The lazy answer would be RDDP or RDDF.

"range": {
"start": {
"line": 14,
"column": 15
Copy link
Contributor

Choose a reason for hiding this comment

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

Some compilers/linters can only provide absolute position in the file, not line/column.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's actually a good discussion point. The reason why I didn't include the byte offset (absolute position in the file) is that if we added it, all consumers tools of RDP output (such as reviewdog) need to add support to convert byte offset <-> line/column.

My current idea is the conversion should happen outside RDP, such as in linters or converters.

@kayoub5
Copy link
Contributor

kayoub5 commented Jun 15, 2020

@haya14busa Have you considered using an existing protocol? such as LSP?
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic

@haya14busa
Copy link
Member Author

Have you considered using an existing protocol? such as LSP?

Considered, but no.
See https://github.com/reviewdog/reviewdog/tree/rdp/proto/rdp#language-server-protocol-lsp

@kayoub5
Copy link
Contributor

kayoub5 commented Jun 15, 2020

// - rdpjsonl: JSON Lines (http://jsonlines.org/) of the `Diagnostic` message.
// - rdpjson: JSON format of the `DiagnosticResult` message.

syntax = "proto3";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think using a JSON Schema file to describe the format would be easier for others to use and validate their output

Copy link
Member Author

@haya14busa haya14busa Jun 15, 2020

Choose a reason for hiding this comment

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

I prefer Protocol Buffer (as primary IDL) because...

  • Protobuf can auto-generate code for a lot of languages including Go which is used in reviewdog.
  • It's more readable (I believe) and I think it's actually not difficult to understand. It supports comments for example.

But, yes that's a good point.
It should be able to auto-generate json schema from protobuf so we can give it a try. https://github.com/chrusty/protoc-gen-jsonschema

Copy link
Member Author

Choose a reason for hiding this comment

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

Added. 3e7cb51

@haya14busa
Copy link
Member Author

I happened to find Static Analysis Results Interchange Format (SARIF) https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html

@haya14busa
Copy link
Member Author

I found SARIF 6 hours ago by finding @microsoft/eslint-formatter-sarif while investigating eslint custom formatter and I just found that GitHub's new Code Scanning (beta) feature uses SARIF for third-party code scanning support. https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning#about-third-party-code-scanning-tools (I got an email just 40 min ago!)
Screenshot 2020-06-16 at 03 50 00

This is very interesting. My proposal can be still useful for some use cases like reviewdog or as a light weight format but discarding my proposal and adopting SARIF can be plausible alternative option.
I'll investigate it more and update the document.

Copy link
Contributor

@jsoref jsoref left a comment

Choose a reason for hiding this comment

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

I don't have time right now, but I'd suggest copying the markdown file rendering into Grammarly and addressing most of its comments.

https://github.com/reviewdog/reviewdog repository, but we may create a separate
repository once it's reviewed and stabilized.

# Reviewdog Diagnostic Protocol (RDP)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather not collide w/ RDF / RDP -- I use both.

The lazy answer would be RDDP or RDDF.

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>

## Reviewdog Diagnostic Protocol Concept
Again, the idea behind the Reviewdog Diagnostic Protocol (RDP) is to standardize
the protocol for how diagnostic tools (e.g. compilers, linters, etc..) and
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to the language tool complaint, as a general rule you should not do e.g. ..., etc. -- e.g. is used to introduce examples, but etc. (et cetera) is for and others, which aren't really an example.

Here, the sample solution is to drop etc.. entirely. Possibly adding and or or before code review API.
Note: there's no need for the trailing . in this, as the parenthetical isn't a sentence.

@haya14busa haya14busa changed the title RFC: Reviewdog Diagnostic Protocol (RDP) RFC: Reviewdog Diagnostic Format Jul 21, 2020
@haya14busa
Copy link
Member Author

haya14busa commented Jul 21, 2020

Thank you everyone for the reviews so far!

I updated the document. Renamed to Reviewdog Diagnostic Format (RD format) and added a section about the SARIF.

I'm going to merge this PR because new upcoming features (like supporting suggestion) depends on it.
However, I still welcome any reviews and feedback.
Please feel free to leave any comments here or #628.

@haya14busa haya14busa merged commit 0988ded into master Jul 21, 2020
@haya14busa haya14busa deleted the rdp branch July 21, 2020 14:50
KikeE36 added a commit to KikeE36/reviewdog that referenced this pull request Feb 22, 2021
https://github.com/reviewdog/reviewdog/tree/reviewdog:master
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### ✨ Release Note <!-- optional -->

### 🚀 Enhancements
- [reviewdog#888](reviewdog#888) Allow GitHub PR reporting for a forked repository iff it's triggered by `pull_request_target`

### 🐛 Fixes
- ...

### 🚨 Breaking changes
- ...

---

## [v0.11.0] - 2020-10-25

### ✨ Release Note
reviewdog v0.11 introduced [Reviewdog Diagnostic Format (RDFormat)](./README.md#reviewdog-diagnostic-format-rdformat)
as generic machine-readable diagnostic format and it unlocks new rich features like code suggestions.

### 🚀 Enhancements
- [reviewdog#629](reviewdog#629) Introduced Reviewdog Diagnostic Format.
 - [reviewdog#674](reviewdog#674) [reviewdog#703](reviewdog#703) Support rdjsonl/rdjson as input format
 - [reviewdog#680](reviewdog#680) github-pr-review: Support multiline comments
 - [reviewdog#675](reviewdog#675) [reviewdog#698](reviewdog#698) github-pr-review: Support suggested changes
 - [reviewdog#699](reviewdog#699) Support diff input format (`-f=diff`). Useful for suggested changes.
 - [reviewdog#700](reviewdog#700) Support to show code(rule), code URL and severity in GitHub and GitLab reporters.
- [reviewdog#678](reviewdog#678) github-pr-review: Support Code Suggestions
  - Introduced [reviewdog/action-suggester](https://github.com/reviewdog/action-suggester) action.
- Introduced [reviewdog/action-setup](https://github.com/reviewdog/action-setup) GitHub Action which installs reviewdog easily including nightly release.
- [reviewdog#769](reviewdog#769) Integration with [Bitbucket Code Insights](https://support.atlassian.com/bitbucket-cloud/docs/code-insights/) and [Bitbucket Pipelines](https://bitbucket.org/product/ru/features/pipelines)

---

## [v0.10.2] - 2020-08-04

### 🐛 Fixes
- [reviewdog#709](reviewdog#709) Check for GITHUB_ACTIONS instead of GITHUB_ACTION

---

## [v0.10.1] - 2020-06-30

### 🚀 Enhancements
- [reviewdog#563](reviewdog#563) Use `CI_API_V4_URL` environment variable when present.

### 🐛 Fixes
- [reviewdog#609](reviewdog#609) reviewdog command will fail with unexpected tool's error for github-check/github-pr-check reporters as well. ([@haya14busa])
- [reviewdog#603](reviewdog#603) Fixed detection of Pull Requests from forked repo. ([@haya14busa])

---

## [v0.10.0] - 2020-05-07

### ✨ Release Note

With v0.10.0 release, now reviewdog can find issues outside diff by controlling
filtering behavior with `-filter-mode`. Also, you can ensure to check reported
results by exit 1 with `-fail-on-error`.

Example
```shell
$ cd subdir/ && reviewdog -filter-mode=file -fail-on-error -reporter=github-pr-review
```

### 🚀 Enhancements
- [reviewdog#446](reviewdog#446)
  Added `-fail-on-error` flag
  ([document](https://github.com/reviewdog/reviewdog/tree/e359505275143ec85e9b114fc1ab4a4e91d04fb5#exit-codes))
  and improved exit code handling. ([@DmitryLanda](https://github.com/DmitryLanda), [@haya14busa])
- [reviewdog#187](reviewdog#187)
  Added `-filter-mode` flag [`added`, `diff_context`, `file`, `nofilter`]
  ([document](https://github.com/reviewdog/reviewdog/tree/e359505275143ec85e9b114fc1ab4a4e91d04fb5#filter-mode))
  which controls how reviewdog filter results. ([@Le6ow5k1](https://github.com/Le6ow5k1), [@haya14busa])
- [reviewdog#69](reviewdog#69) Support gerrit! ([@staticmukesh](https://github.com/staticmukesh))
- [reviewdog#548](reviewdog#548) Introduced nightly release ([reviewdog/nightly](https://github.com/reviewdog/nightly)). ([@haya14busa])

### 🐛 Fixes
- [reviewdog#461](reviewdog#461) All reporters now supports sub-directory run. ([@haya14busa])

### 🚨 Breaking changes
- `github-check` reporter won't report results outside diff by default now. You
  need to use `-filter-mode=nofilter` to keep the same bahavior.

---

See https://github.com/reviewdog/reviewdog/releases for older release note.

[Unreleased]: reviewdog/reviewdog@v0.10.0...HEAD
[v0.10.0]: reviewdog/reviewdog@v0.9.17...v0.10.0
[v0.10.1]: reviewdog/reviewdog@v0.10.0...v0.10.1
[v0.10.2]: reviewdog/reviewdog@v0.10.1...v0.10.2
[v0.11.0]: reviewdog/reviewdog@v0.10.2...v0.11.0
[@haya14busa]: https://github.com/haya14busa
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.

3 participants