-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform v2 -> v1 stack, stackFrame, region #911
Conversation
}, | ||
""region"": { | ||
""startLine"": 15, | ||
""startColumn"": 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelcfanning @EasyRhin0
Chris, you have no action for now, but be aware:
At TC #18 on May 30th, we approved changes to the default values of missing region properties. In particular, if endColumn
is missing, in v1 that meant endColumn
== startColumn
(an insertion point). But in v2, endColumn
defaults to “one character past EOL (excluding the newline sequence”).
The reason for this change is that one of the TC members argued persuasively that the most natural interpretation of the region { "startLine": 3 }
is "The whole of line 3" and not "An insertion point at the beginning of line 3."
So when you get around to making the schema changes for oasis-tcs/sarif-spec#93, you'll need to adjust the transformations as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks
""name"": ""CodeScanner"", | ||
""semanticVersion"": ""2.1.0"" | ||
}, | ||
""invocation"": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't emit empty object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens when there are notifications but no other properties set on the invocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you stop if from happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I'd have to check all of the strings for null/whitespace, and the processId == 0, and the datetimes == datetime.minvalue. Would that be deterministic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but now that you spell it out, not worth the trouble. After all, if we're copying an entire run to the property bag, I've got now reason to gripe about this. Let it go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
""uri"": ""file:///C:/src/main.cs"", | ||
""module"": ""RuleLibrary"", | ||
""threadId"": 52, | ||
""fullyQualifiedLogicalName"": ""Rules.SecureHashAlgorithmRule.Register-0"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In v2, the stackFrame.fullyQualifiedLogicalName
property is always the key into the files dictionary (if the files dictionary exists). So you have to do this:
IF the files dictionary exists
AND it has a key that matches v2 stackFrame.fullyQualifiedLogicalName
AND the file object specified by that key has a fullyQualifiedName property
THEN
set v1 stackFrame.fullyQualifiedLogicalName to v2 file.fullyQualifiedName
set v1 stackFrame.logicalLocationKey to v2 stackFrame.fullyQualifiedLogicalName
ELSE
set v1 stackFrame.fullyQualifiedLogicalName to v2 stackFrame.fullyQualifiedLogicalName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. This actually clarifies it quite a bit, thanks
return region; | ||
} | ||
|
||
internal RegionVersionOne CreateRegion(int startColumn, int startLine, int endColumn = 0, int endLine = 0, int length = 0, int offset = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this overload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from the other transformer, where I do need it. Not needed here yet, will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logical location handling bug; possible unnecessary method overload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
Please check the logicalLocations (aka the cold trail from hell), I'm not confident there.