Comments (13)
Regarding danger/danger#684, I'm thinking adding a GitHub review feature could be separate from just adding a { file, line }
options hash to the warn/message/fail/markdown functions. I can see value in making one-off comments using Danger as well as integrating into GitHub's review feature. If Danger-rb supports both (or is in the process of doing so), Danger-js can support the same API for parity between tools (we can leave sticky
out of Danger-js, though 😃).
Thanks for posting links and explaining the PR Diff positioning system - they will be useful for understand how to parse the diff. A coworker went through a similar experience trying to parse GitHub diffs for an Android static analysis tool he and another coworker have been working on, so I think those could also be some helpful references.
I'm thinking the diff parser could be added to this repo, and if generic enough, it could be pulled out into an npm package for reuse - I didn't see anything when searching npmjs.com that did quite what we need here.
from danger-js.
We do already have a diff parser in Danger JS - here but what I mean is WRT the diff parser is: You need to take an absolute file path + line, e.g. { file: "CHANGELOG.md", line: 6 }
and come back with something that could be found inside the existing diff object that we have e.g. { commit: 918b1dc, file: "CHANGELOG.md", line: 9}
or if it wasn't found, then it needs to go inside the main comment.
The API docs will give you a sense of what I mean
Other than that, all sounds fine to me 👍
from danger-js.
So, from my perspective, I think sticky is something we should avoid. Every Dangerfile that we have at Artsy had sticky turned off on each trigger, which is why I turned it off by default.
Unless someone really, really, really wants it, we should avoid it. It adds a considerable amount of internal complexity (finding all pre-existing violations in every comment / issue before incrementally updating/removing them) on Danger for an occasionally useful feature.
So, file: line:
What would be involved in porting that functionality to Danger-js?
Both of those would work (and be backwards compatible) I think I'm in favour of the options hash. Gives more room for further improvement in the future without making a lot of args on those functions.
Generally the usage of file: line:
has been inside danger-rb plugins, where elegance of the code is less important ( you want lots of 2-3 LOC rules ideally )
Implementation:
I see two options here, you can start a review, and make the comments inside there ( see this discussion on what that could look like ) or just outright use the commit API.
Either way, there needs to be
- A "main violations" abstraction that posts the normal GitHub comment (what we have right now)
- A "file violation" abstraction that handles
file: line:
-> PR Diff positioning system
This is by far the most gnarly code in Danger-rb, so I advise taking your time on it and trying to find better abstractions than we have in ruby.
from danger-js.
Thanks @orta, think I misunderstood about the diff parsing thing originally. I'll dive into the code and get my hands dirty. Will open a PR if I have any more questions. 😄
from danger-js.
This issue is open if someone would like to contribute! An initial attempt to solve this was in #99, which might give a starting point. Feel free to comment here to ask more questions or open a PR to get work-in-progress feedback. 😃
from danger-js.
I would be pleased to help on this.
At www.bam.tech, we want to use danger as a poka-yoke, to share good practice and learning accros the teams. Inline comment have a big impact on it.
That being said, I have a bad overview of danger js, so maybe it is to complicated for a first task.
My plan so far:
- backport
MessagingOptions
from #99 - access danger context to get the diff:
- if the inline comment is in the diff, add the inline object to a list of object and the a summary of inline comment (necessary ?)
- else do the details summary thing (dear-github/dear-github#166 (comment)) inside the
githubResultsTemplate
- if the inline object, implement a review call and inline feedback
- add a setting (env variables/ api) to fallback to use the commit api if the user do not want a review
Does it seems a good plan for you ?
What are the difficult points / points to carefully design the abstraction ?
from danger-js.
That feels about right, yeah 👍
Here's the main chunk of the work in danger ruby.
I've slowly grown to the idea that I want to see something like #196 which will end up requiring the "did this danger instance create this table" but that's further down the line. Most of the work is in deciding where a comment should go, and making sure every comment is up-to-date when danger does a second run
from danger-js.
Thanks for looking into this, @tychota!
add a setting (env variables/ api) to fallback to use the commit api if the user do not want a review
If it's possible to weave GitHub reviews and inline comments together through some API configuration option, that sounds awesome. I guessed that inline commenting would be the simplest first step, but I'm not familiar with GitHub's API on either of these things, so I'm not sure what would be doable in one PR.
For reference, here is the Ruby PR where the GitHub reviews feature was introduced in Danger - danger/danger#702.
from danger-js.
@macklinu @orta: until September 6, I have a bit of vacation and two talks for meetups/training to prepare so it will be pretty busy.
I would definitively have more time after that and your links is so valuable to me. I have now a clearer idea about the work required.
from danger-js.
Any progress on this?
from danger-js.
from danger-js.
Wow.
from danger-js.
ah yeah! This can be closed 👍
from danger-js.
Related Issues (20)
- [BUG] Danger Ignore not working on Gitlab - Tried different formats HOT 6
- [BUG] Inline comments deleted in GitLab pipeline HOT 6
- [BUG] danger.github.reviews only providing the first 30 reviews HOT 7
- [BUG] --removePreviousComments overrides resolved threads on Gitlab HOT 7
- [DEPS] Move from @gitbeaker/node to @gitbeaker/rest HOT 3
- [BUG] Danger taking comments as modified files HOT 6
- [BUG] process.env - Cannot read properties of undefined (reading 'env') HOT 1
- [BUG] substr is deprecated HOT 2
- [BUG] Danger.js comments removed from Github PR after merge HOT 5
- [BUG] [Gitlab] Can't post multiple inline comments HOT 1
- [BUG] Upgrading to danger `11.3.0` causes `tsc` build errors HOT 4
- [BUG] Include dangerfile.ts in the tsconfig makes tsc run out of memory HOT 2
- [BUG][Spec] GitHubReviewers interface is not described
- [BUG] Danger fails to create inline comments on Gitlab
- [BUG] Danger posting separate comment for each warning on GitHub HOT 2
- GHCR publishing is broken HOT 3
- [BUG] GitHubAPIPR unsupported structure HOT 2
- [BUG] `parent_ids` of GitLab MR commits is always an empty array HOT 2
- [BUG] `message` does not attach to a file and line provided, and instead all comments are in the "main comment" section HOT 1
- [Feature Request] Support ignoring whitespace-only changes HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from danger-js.