From b4a2591f740e36f0f0c93a2e4a5889f32725d139 Mon Sep 17 00:00:00 2001 From: ABaldwinHunter Date: Tue, 6 Jun 2017 11:06:20 -0400 Subject: [PATCH 1/3] Clarify usage of other_locations key --- SPEC.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/SPEC.md b/SPEC.md index e95387d..791f6f4 100644 --- a/SPEC.md +++ b/SPEC.md @@ -29,6 +29,7 @@ We welcome your participation and appreciate your patience as we finalize the pl - [Remediation points](#remediation-points) - [Locations](#locations) - [Positions](#positions) + - [Other Locations](#other-locations) - [Contents](#contents) - [Source code traces](#source-code-traces) - [Packaging](#packaging) @@ -201,7 +202,7 @@ The baseline remediation points value is 50,000, which is the time it takes to f ### Locations -Locations refer to ranges of a source code file. A Location contains a `path`, a source range, (expressed as `lines` or `positions`), and an optional array of `other_locations`. Here's an example location: +Locations refer to ranges of a source code file. A Location contains a `path`, a source range, (expressed as `lines` or `positions`). Here's an example location: ```json { @@ -266,6 +267,23 @@ line of the file. Offsets, however are 0-based. A Position of `{ "offset": 4 }` represents the _fifth_ character in the file. Importantly, the `offset` is from the beginning of the file, not the beginning of a line. Newline characters (and all characters) count when computing an offset. +### Other Locations + +Other locations is an optional array of [Location](#locations) objects: + +```json +"other_locations": [ + { + "path": "foo.rb", + "lines": { "begin": 25, "end": 55 } + }, + { + "path": "bar.rb", + "lines": { "begin": 20, "end": 50 } + } +] +``` + ### Contents Content gives more information about the issue's check, including a description of the issue, how to fix it, and relevant links. They are expressed as a hash with a `body` key. The value of this key should be a [Markdown](http://daringfireball.net/projects/markdown/) document. For example: @@ -279,7 +297,7 @@ Content gives more information about the issue's check, including a description Some engines require the ability to refer to other source locations in describing an issue. For this reason, an `Issue` object can have an associated `Trace`, a data structure meant to represent ordered or unordered lists of source code locations. A `Trace` has the following fields: -* `locations` -- **[Location] - Required**. An array of `Location` objects. +* `locations` -- **[Location] - Required**. An array of [Location](#locations) objects. * `stacktrace` -- **Boolean - Optional **. *Default: false* When `true`, this `Trace` object will be treated like an ordered stacktrace by the CLI and the Code Climate UI. An example trace: From ac8d6aa86cee51b645cf8b6a78d5e822d6dbf141 Mon Sep 17 00:00:00 2001 From: ABaldwinHunter Date: Tue, 6 Jun 2017 11:41:14 -0400 Subject: [PATCH 2/3] fix grammar --- SPEC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPEC.md b/SPEC.md index 791f6f4..42573cd 100644 --- a/SPEC.md +++ b/SPEC.md @@ -202,7 +202,7 @@ The baseline remediation points value is 50,000, which is the time it takes to f ### Locations -Locations refer to ranges of a source code file. A Location contains a `path`, a source range, (expressed as `lines` or `positions`). Here's an example location: +Locations refer to ranges of a source code file. A Location contains a `path` and a source range, (expressed as `lines` or `positions`). Here's an example location: ```json { From 02dcf1faae1c6f6fe2df75f2f692140dbe776e56 Mon Sep 17 00:00:00 2001 From: ABaldwinHunter Date: Tue, 6 Jun 2017 12:05:49 -0400 Subject: [PATCH 3/3] remove comma --- SPEC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPEC.md b/SPEC.md index 42573cd..52e7040 100644 --- a/SPEC.md +++ b/SPEC.md @@ -202,7 +202,7 @@ The baseline remediation points value is 50,000, which is the time it takes to f ### Locations -Locations refer to ranges of a source code file. A Location contains a `path` and a source range, (expressed as `lines` or `positions`). Here's an example location: +Locations refer to ranges of a source code file. A Location contains a `path` and a source range (expressed as `lines` or `positions`). Here's an example location: ```json {