Skip to content

Commit d057c73

Browse files
author
Ashley Baldwin-Hunter
authored
Clarify usage of other_locations key (#57)
* Clarify usage of other_locations key Addresses #56
1 parent f0073bf commit d057c73

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Diff for: SPEC.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ We welcome your participation and appreciate your patience as we finalize the pl
2929
- [Remediation points](#remediation-points)
3030
- [Locations](#locations)
3131
- [Positions](#positions)
32+
- [Other Locations](#other-locations)
3233
- [Contents](#contents)
3334
- [Source code traces](#source-code-traces)
3435
- [Packaging](#packaging)
@@ -201,7 +202,7 @@ The baseline remediation points value is 50,000, which is the time it takes to f
201202

202203
### Locations
203204

204-
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:
205+
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:
205206

206207
```json
207208
{
@@ -266,6 +267,23 @@ line of the file.
266267

267268
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.
268269

270+
### Other Locations
271+
272+
Other locations is an optional array of [Location](#locations) objects:
273+
274+
```json
275+
"other_locations": [
276+
{
277+
"path": "foo.rb",
278+
"lines": { "begin": 25, "end": 55 }
279+
},
280+
{
281+
"path": "bar.rb",
282+
"lines": { "begin": 20, "end": 50 }
283+
}
284+
]
285+
```
286+
269287
### Contents
270288

271289
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
279297

280298
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:
281299

282-
* `locations` -- **[Location] - Required**. An array of `Location` objects.
300+
* `locations` -- **[Location] - Required**. An array of [Location](#locations) objects.
283301
* `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.
284302

285303
An example trace:

0 commit comments

Comments
 (0)