Skip to content

Commit 0576826

Browse files
committed
Add trace
1 parent 53ff513 commit 0576826

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

Diff for: SPEC.md

+29-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ An `issue` represents a single instance of a real or potential code problem, det
7777
* `content` -- **Optional**. A markdown snippet describing the issue, including deeper explanations and links to other resources.
7878
* `categories` -- **Required**. At least one category indicating the nature of the issue being reported.
7979
* `location` -- **Required**. A `Location` object representing the place in the source code where the issue was discovered.
80-
* `other_locations` -- **Optional.** An array of `Location` objects useful for engines which highlight more than one source location in an issue.
80+
* `trace` -- **Optional.** A `Trace` object representing other interesting source code locations related to this issue.
8181
* `remediation_points` -- **Optional**. An integer indicating a rough estimate of how long it would take to resolve the reported issue.
8282
* `severity` -- **Optional**. A `Severity` string (`info`, `normal`, or `critical`) describing the potential impact of the issue found.
8383

@@ -180,9 +180,35 @@ Contents give more information about the issue's check, including a description
180180
"body": "This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See [this page](http://c2.com/cgi/wiki?AbcMetric) for more information on ABC size."
181181
}
182182
```
183-
### Other Locations
183+
### Source Code Traces
184184

185-
Some engines require the ability to refer to other source locations. For this reason, the Issue type has an optional `other_locations` field, which is an array of other `Location` items that this issue needs to refer to.
185+
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:
186+
187+
* `locations` -- **[Location] - Required**. An array of `Location` objects.
188+
* `stacktrace` -- **Boolean - Optional**. When `true`, this `Trace` object will be treated like an ordered stacktrace by the CLI and the Code Climate UI.
189+
190+
An example trace:
191+
192+
```json
193+
"trace": {
194+
"locations": [{
195+
"path": "path/to/file.css",
196+
"lines": {
197+
"begin": 13,
198+
"end": 14
199+
}
200+
},
201+
{
202+
"path": "path/to/file.css",
203+
"lines": {
204+
"begin": 19,
205+
"end": 20
206+
}
207+
}],
208+
"stacktrace": true
209+
}
210+
211+
```
186212

187213
## Versioning
188214

0 commit comments

Comments
 (0)