ahrefs / atd

Static types for JSON APIs
Other
308 stars 53 forks source link

[atddiff] Offer '--no-locations' option #382

Closed mjambon closed 8 months ago

mjambon commented 8 months ago

--no-locations is aimed at producing more stable results that allow diffing successive atddiff reports to spot new findings and ignore old ones.

I marked this feature as experimental because it doesn't feel quite right to me. We'll be using it for identifying new findings by comparing the previous atddiff report with the current one in CI. Experience will tell us if it's good enough or if we need something different.

The JSON output format changed. Two records - full_finding and finding were merged into one, finding. Here's the atddiff output obtained via git:

$ git difftool -x atddiff 2.14.1... src/lib/Atddiff_output.atd

Viewing (1/1): 'atddiff/src/lib/Atddiff_output.atd'
Launch 'atddiff' [Y/n]? 
[0dcca10b] Forward incompatibility:
File "/tmp/git-blob-FAlVip/Atddiff_output.atd", line 90, characters 2-18:
Required field 'finding' disappeared.
The following types are affected:
  finding
  full_finding
  result

[3b6e126b] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 82, characters 2-14:
Required field 'hash' is new.
The following types are affected:
  finding
  full_finding
  result

[00805a6d] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 84, characters 2-22:
Required field 'direction' is new.
The following types are affected:
  finding
  full_finding
  result

[1675485b] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 85, characters 2-28:
Required field 'kind' is new.
The following types are affected:
  finding
  full_finding
  result

[17a98b9a] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 86, characters 2-31:
Required field 'location_old' is new.
The following types are affected:
  finding
  full_finding
  result

[100a1891] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 87, characters 2-31:
Required field 'location_new' is new.
The following types are affected:
  finding
  full_finding
  result

[1aba7b00] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 91, characters 2-21:
Required field 'description' is new.
The following types are affected:
  finding
  full_finding
  result

[2bcc902b] Backward incompatibility:
File "/tmp/git-blob-NEGUip/Atddiff_output.atd", line 93, characters 2-29:
Required field 'affected_types' is new.
The following types are affected:
  finding

I think it will be much easier to decipher once we show the snippets of code affected by the findings (feature request #380).

Closes #377

PR checklist