Skip to content

Fix the location object #130

@ghost

Description

The location object encapsulates two distinct, unrelated concepts:

  1. The concept that a location has both physical and logical aspects.
  2. The concept that a tool might detect a result in a file other than the one it was instructed to scan.

Not only are these two different concepts, they actually apply to two different entities. The first says something about locations; the second says something about results.

There are several problems with the current design:

  1. This conceptual entanglement makes it difficult to write the text for Result object's snippet property #99, “Result object's snippet property”.
  2. It is the reason that, when we introduced a physicalLocation object into stackFrame, we stopped short of introducing a location object to capture the “logical” aspects of the location; we left those as loose properties. The problem was that a “location” included two physicalLocation-valued properties, analysisTarget and resultFile, and that didn’t make sense for a stack frame.
  3. As defined, the location object contains two region objects (one in analysisTarget and one in resultFile), but only one or the other of them is ever used.

This is such a bad design flaw, IMO, that we have to fix it in CSD.1. I propose:

  1. In the location object, remove the physicalLocation-valued analysisTarget and resultFile properties, and define a single physicalLocation-valued property named physicalLocation.
  2. In the result object, retain the locations property (whose type is location[]). But now, the physicalLocation property of every location object in that array specifies the “result file”, that is, the file in which the result was detected.
  3. In the result object, add a new fileLocation-valued property named analysisTargetLocation. This is the file the tool was instructed to scan. It is required if the analysis target does not appear anywhere in the result.locations array; otherwise it is optional.

In the new design, a location object contains only one region object (location.physicalLocation.region). The new result.analysisTargetLocation property, since its type is fileLocation rather than physicalLocation, does not contain a region object.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions