Closed vince-a-m closed 1 year ago
Patch coverage: 64.15
% and project coverage change: +0.25
:tada:
Comparison is base (
063c435
) 70.14% compared to head (fe73502
) 70.40%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
It looks good overall. I have one edge case that needs to be addressed. Plus a couple stylistic things that aren't crucial, but are probably worth doing to keep the code base consistent.
The edge case is when deleting a particular version of a collection with the deleteAllContents=true
parameter set. In this situation, the code deletes the objects in the contents of the collection, even if they're still referenced by another version of the same collection. That leaves the remaining version of the collection with dangling references.
Stylistically, there are two things I noticed. The first is the 2 space vs 4 space indentation. I don't have a preference on that, except that I think the code is generally a little easier to read if the indentation is consistent, especially within a file. The second is the way of iterating over a collection. Instead of using for (let i = 0; i < coll.length; i++)
the rest of the code uses for (const attackObject of objectList)
. It's a little more succinct and I think it conveys the intent better.
It looks like there's still a problem with deleting the contents when deleting a single version of a collection. I think the issue is that MongoDB uses an implicit AND between query terms. So when modified
is set, it's looking for collections that have a different value for stix.id
AND a different value for stix.modified
. Which will exclude other versions of the same collection.
I pushed a couple of additional test cases that might make it easier to check if things are working the way you want them to.
Thanks for finding that @ElJocko . npm run test
ran with no errors
SonarCloud Quality Gate failed.
0 Bugs
0 Vulnerabilities
0 Security Hotspots
1 Code Smell
No Coverage information
10.5% Duplication
Catch issues before they fail your Quality Gate with our IDE extension SonarLint