structuredDiffForFile function returns incorrect results
See original GitHub issueHi there, I am using structuredDiffForFile
method from GitDSL
. I am using this function within the following code snippet:
function claimsToUpdateDocumentation() {
let claimsToUpdateDocumentation = false
danger.git.structuredDiffForFile(`${docsFolder}/CHANGEPLAN.md`)
.then((diff) => {
diff.chunks.forEach(chunk => {
chunk.changes.forEach(change => {
if (change.type === "add") {
const offence = regexPattern.exec(change.content)
if (offence) {
claimsToUpdateDocumentation = true;
}
}
})
})
return claimsToUpdateDocumentation;
})
}
I got inspired about the usage of this method from metaphysics dangerfile.ts. Every-time danger is run on our CI (on premise BitBucket server) against a PR it gets the diff for CHANGEPLAN.md
from previous PR. Example:
danger pr https://company.merck.com/projects/foo/repos/boo/pull-requests/2607
structuredDiffForFile
returns me the diff of CHANGEPLAN.md
from PR #2606 instead of returning diff from PR #2607.
Am I using structuredDiffForFile
incorrectly? Or is it a bug?
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Function returning wrong value - Stack Overflow
When i == 6 is not true , then execution reaches the end of func without encountering a return statement. This causes the...
Read more >CHANGELOG - Danger.systems
Now a subprocess can pass a JSON URL for Danger JS by looking in STDOUT for the regex /danger-results:\/\/*.+json/ . There is now...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version
9.2.1
(node_modules/.bin/danger --version
:9.2.1
) works properly with my simple project:dangerfile.js
:I will try to test it on an instance of Bitbucket in my company.
@platan I figured out that the problem was in our code 🤦♀️, so yes v9.2.1 with #871 solves the problem indeed! Sorry for confusion and thank you for help with resolving this issue