-
Notifications
You must be signed in to change notification settings - Fork 91
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
rules 1011 2008 (split from original) #1921
Changes from 5 commits
1c6d938
56477b9
bfa33d4
1ca3db3
65c0b4d
54df61d
63bb3fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.Json.Pointer; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.CodeAnalysis.Sarif.Multitool.Rules | ||
{ | ||
public class ProvideSchema : SarifValidationSkimmerBase | ||
{ | ||
public override MultiformatMessageString FullDescription => new MultiformatMessageString | ||
{ | ||
Text = RuleResources.SARIF2008_ProvideSchema_FullDescription_Text | ||
}; | ||
|
||
public override FailureLevel DefaultLevel => FailureLevel.Error; | ||
|
||
public override string Id => RuleId.ProvideSchema; | ||
|
||
protected override IEnumerable<string> MessageResourceNames => new string[] | ||
{ | ||
nameof(RuleResources.SARIF2008_ProvideSchema_Warning_Default_Text) | ||
}; | ||
|
||
protected override void Analyze(SarifLog log, string logPointer) | ||
{ | ||
AnalyzeSchema(log.SchemaUri, logPointer); | ||
} | ||
|
||
private void AnalyzeSchema(Uri schemaUri, string pointer) | ||
{ | ||
if (schemaUri == null) | ||
{ | ||
LogResult(pointer, nameof(RuleResources.SARIF2008_ProvideSchema_Warning_Default_Text)); | ||
return; | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ protected override void AnalyzeTarget( | |
|
||
if (!string.IsNullOrEmpty(sarifText)) | ||
{ | ||
// DISCUSS IN PR: Deserializing the object here injects "$Schema" property, corrupting our test for | ||
// SARIF2008_ProvideSchema | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Larry - need to discuss how to solve this. #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a possible bug in our Validate command. Isnt it? If you confirm, i can log a bug, mark the test cases as ignore and move on for now. In reply to: 443040878 [](ancestors = 443040878) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, change to SARIF2008 is the right fix. In reply to: 443046418 [](ancestors = 443046418,443040878) |
||
context.InputLogContents = sarifText; | ||
context.InputLog = context.InputLogContents != null ? Deserialize(context.InputLogContents) : null; | ||
|
||
|
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.
Warning (so rename resource strings accordingly). #Closed
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.
run.$schema
is optional, so not error-level.In reply to: 443047241 [](ancestors = 443047241)
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.
Oh, I see that the resources do say "warning".
In reply to: 443047241 [](ancestors = 443047241)
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.
Nice catch!!!
In reply to: 443047522 [](ancestors = 443047522,443047241)