Skip to content

Commit

Permalink
Provide messages for SARIF2006.MessagesShouldBeReachable. (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Golding committed Jul 3, 2020
1 parent 969ae19 commit f4597b2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions docs/Producing effective SARIF.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,14 @@ If 'version' is used, facilitate comparison between versions by specifying a ver

#### Description

URIs that refer to locations such as rule help pages and result-related work items should be reachable via a GET request.

#### Messages

##### `Default`: warning

{0}: The URI '{1}' was not reachable via a GET request.

---

### Rule `SARIF2007.ExpressPathsRelativeToRepoRoot`
Expand Down
Binary file modified docs/Rule factoring.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Sarif.Multitool/Rules/RuleResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Sarif.Multitool/Rules/RuleResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ Similarly, most 'result' objects contain at least one 'artifactLocation' object.
<value>{0}: The 'rules' array contains no information beyond the ids of the rules. Removing this array might reduce the log file size without losing information. In some scenarios (for example, when assessing compliance with policy), the 'rules' array might be used to record the full set of rules that were evaluated. In such a scenario, the 'rules' array should be retained even if it contains only id information.</value>
</data>
<data name="SARIF2006_UrisShouldBeReachable_FullDescription_Text" xml:space="preserve">
<value>Placeholder_SARIF2006_UrisShouldBeReachable_FullDescription_Text</value>
<value>URIs that refer to locations such as rule help pages and result-related work items should be reachable via an HTTP GET request.</value>
</data>
<data name="SARIF2006_UrisShouldBeReachable_Warning_Default_Text" xml:space="preserve">
<value>{0}: Placeholder {1}</value>
<value>{0}: The URI '{1}' was not reachable via an HTTP GET request.</value>
</data>
<data name="SARIF2007_ExpressPathsRelativeToRepoRoot_FullDescription_Text" xml:space="preserve">
<value>Placeholder_SARIF2007_ExpressPathsRelativeToRepoRoot_FullDescription_Text</value>
Expand Down
7 changes: 4 additions & 3 deletions src/Sarif.Multitool/Rules/SARIF2006.UrisShouldBeReachable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class UrisShouldBeReachable : SarifValidationSkimmerBase
public override string Id => RuleId.UrisShouldBeReachable;

/// <summary>
/// Placeholder
/// URIs that refer to locations such as rule help pages and result-related work items
/// should be reachable via an HTTP GET request.
/// </summary>
public override MultiformatMessageString FullDescription => new MultiformatMessageString { Text = RuleResources.SARIF2006_UrisShouldBeReachable_FullDescription_Text };

Expand Down Expand Up @@ -85,10 +86,10 @@ private void AnalyzeUri(string uriString, string pointer)
Uri uri = new Uri(uriString, UriKind.Absolute);
if (!IsUriReachable(uri.AbsoluteUri))
{
// {0}: Placeholder '{1}'
// {0}: The URI '{1}' was not reachable via an HTTP GET request.
LogResult(
pointer,
nameof(RuleResources.SARIF1005_UriMustBeAbsolute_Error_Default_Text),
nameof(RuleResources.SARIF2006_UrisShouldBeReachable_Warning_Default_Text),
uriString);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"id": "SARIF2006",
"name": "UrisShouldBeReachable",
"shortDescription": {
"text": "Placeholder_SARIF2006_UrisShouldBeReachable_FullDescription_Text."
"text": "URIs that refer to locations such as rule help pages and result-related work items should be reachable via an HTTP GET request."
},
"fullDescription": {
"text": "Placeholder_SARIF2006_UrisShouldBeReachable_FullDescription_Text"
"text": "URIs that refer to locations such as rule help pages and result-related work items should be reachable via an HTTP GET request."
},
"messageStrings": {
"Warning_Default": {
"text": "{0}: Placeholder {1}"
"text": "{0}: The URI '{1}' was not reachable via an HTTP GET request."
}
},
"helpUri": "http://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html"
Expand Down Expand Up @@ -62,7 +62,7 @@
"ruleId": "SARIF2006",
"ruleIndex": 0,
"message": {
"id": "Error_Default",
"id": "Warning_Default",
"arguments": [
"runs[0].results[0].workItemUris[0]",
"https://example.com/my-project/issues/42"
Expand All @@ -86,7 +86,7 @@
"ruleId": "SARIF2006",
"ruleIndex": 0,
"message": {
"id": "Error_Default",
"id": "Warning_Default",
"arguments": [
"runs[0].tool.driver.downloadUri",
"http://www.example.com/tools/codescanner/download.html"
Expand All @@ -110,7 +110,7 @@
"ruleId": "SARIF2006",
"ruleIndex": 0,
"message": {
"id": "Error_Default",
"id": "Warning_Default",
"arguments": [
"runs[0].tool.driver.rules[0].helpUri",
"http://www.example.com/rules/tst0001.html"
Expand All @@ -134,7 +134,7 @@
"ruleId": "SARIF2006",
"ruleIndex": 0,
"message": {
"id": "Error_Default",
"id": "Warning_Default",
"arguments": [
"runs[0].versionControlProvenance[0].repositoryUri",
"https://example.com/my-project"
Expand Down

0 comments on commit f4597b2

Please sign in to comment.