diff --git a/semgrep_output_v1.atd b/semgrep_output_v1.atd index d7f9857..25bae59 100644 --- a/semgrep_output_v1.atd +++ b/semgrep_output_v1.atd @@ -274,20 +274,16 @@ type cli_match_extra = { ?metavars: metavars option; (* Those fields are derived from the rule but the metavariables - * they contain have been expanded to their concrete value. - *) + * they contain have been expanded to their concrete value. *) message: string; + (* If present, semgrep was able to compute a string that should be * inserted in place of the text in the matched range in order to fix the - * finding. - * Note that this is the result of applying both the fix: or fix_regex: - * in a rule. - *) + * finding. Note that this is the result of applying both the fix: or + * fix_regex: in a rule. *) ?fix: string option; - (* TODO: done with monkey patching right now in the Python code, - * and seems to be used only when sending findings to the backend. - *) + * and seems to be used only when sending findings to the backend. *) ?fixed_lines: string list option; (* fields coming from the rule *) @@ -298,12 +294,11 @@ type cli_match_extra = { fingerprint: string; lines: string; - (* extra fields *) + (* for nosemgrep *) ?is_ignored: bool option; (* EXPERIMENTAL: added by dependency_aware code *) - ?sca_info: sca_info option; - + ?sca_info: sca_match option; (* EXPERIMENTAL: If present indicates the status of postprocessor validation. * This field not being present should be equivalent to No_validator. * Added in semgrep 1.37.0 *) @@ -311,7 +306,6 @@ type cli_match_extra = { (* EXPERIMENTAL: added by secrets post-processing & historical scanning code * Since 1.60.0. *) ?historical_info: historical_info option; - (* EXPERIMENTAL: For now, present only for taint findings. May be extended to * otherslater on. *) ?dataflow_trace: match_dataflow_trace option; @@ -530,7 +524,7 @@ type transitivity ] (* part of cli_match_extra *) -type sca_info = { +type sca_match = { reachable: bool; reachability_rule: bool; sca_finding_schema: int; @@ -538,25 +532,25 @@ type sca_info = { } type dependency_match = { - dependency_pattern: dependency_pattern; + dependency_pattern: sca_pattern; found_dependency: found_dependency; lockfile: fpath; } -type dependency_pattern = { +type sca_pattern = { ecosystem: ecosystem; package: string; semver_range: string; } +(* alt: sca_dependency? *) type found_dependency = { package: string; version: string; ecosystem: ecosystem; + (* ??? *) allowed_hashes: (string * string list) list - - - ; + ; ?resolved_url: string option; transitivity: transitivity; (* Path to the manifest file that defines the project containing this @@ -564,7 +558,6 @@ type found_dependency = { *) ?manifest_path: fpath option; (* Path to the lockfile that contains this dependency. - * * Examples: package-lock.json, nested/folder/requirements.txt, go.mod * Since 1.87.0 *) @@ -1476,12 +1469,11 @@ type finding = { ?fixed_lines: string list option; - ?sca_info: sca_info option; - (* Note that this contains code! - * TODO? do we need to send this to the App? - *) + (* added in ?? *) + ?sca_info: sca_match option; + (* Note that this contains code! TODO? do we need to send this to the App? *) ?dataflow_trace: match_dataflow_trace option; - (* Added in semgrep 1.39.0 see comments in cli_match_extra. *) + (* Added in semgrep 1.39.0 see comments in cli_match_extra *) ?validation_state: validation_state option; (* Added in semgrep 1.65.0 see comments in cli_match_extra *) ?historical_info: historical_info option; @@ -1801,7 +1793,6 @@ type core_output = { results: core_match list; (* errors are guaranteed to be duplicate free; see also Report.ml *) errors: core_error list; - inherit cli_output_extra; } @@ -1812,32 +1803,26 @@ type core_match = { extra: core_match_extra; } -(* TODO: try to make it as close as possible to 'cli_match_extra' below *) +(* TODO: try to make it as close as possible to 'cli_match_extra' below + * See the corresponding comment in cli_match_extra for more information + * about the fields below. + *) type core_match_extra = { + metavars: metavars; + engine_kind: engine_of_finding; + is_ignored: bool; (* These fields generally come from the rule, but may be set here if they're * being overriden for that particular finding. This would currently occur - * for rule with a validator for secrets, depending on what the valdiator + * for rule with a validator for secrets, depending on what the validator * might match, but could be expanded in the future. - * - * Added in semgrep 1.44.0 *) + *) ?message: string option; ?metadata: raw_json option; ?severity: match_severity option; - - metavars: metavars; - (* old: was called rendered_fix *) ?fix: string option; - ?dataflow_trace: match_dataflow_trace option; - engine_kind: engine_of_finding; - (* for nosemgrep *) - is_ignored: bool; - (* If present indicates the status of postprocessor validation. This field - * not being present should be equivalent to No_validator. - * Added in semgrep 1.37.0 *) + ?sca_match: sca_match option; ?validation_state : validation_state option; - (* EXPERIMENTAL: added by secrets post-processing & historical scanning code. - * Since 1.63.0. *) ?historical_info: historical_info option; (* Escape hatch to pass untyped info from semgrep-core to the semgrep output. * Useful for quick experiments, especially when combined with semgrep @@ -1860,7 +1845,7 @@ type core_error = { ?details: string option; ?location: location option; ?rule_id: rule_id option; - } +} (*****************************************************************************) (* semgrep-core JSON input via -targets (from pysemgrep) *) diff --git a/semgrep_output_v1.jsonschema b/semgrep_output_v1.jsonschema index caad1c8..6d445d2 100644 --- a/semgrep_output_v1.jsonschema +++ b/semgrep_output_v1.jsonschema @@ -147,7 +147,7 @@ "fingerprint": { "type": "string" }, "lines": { "type": "string" }, "is_ignored": { "type": "boolean" }, - "sca_info": { "$ref": "#/definitions/sca_info" }, + "sca_info": { "$ref": "#/definitions/sca_match" }, "validation_state": { "$ref": "#/definitions/validation_state" }, "historical_info": { "$ref": "#/definitions/historical_info" }, "dataflow_trace": { "$ref": "#/definitions/match_dataflow_trace" }, @@ -347,7 +347,7 @@ { "const": "unknown" } ] }, - "sca_info": { + "sca_match": { "type": "object", "required": [ "reachable", "reachability_rule", "sca_finding_schema", @@ -364,12 +364,12 @@ "type": "object", "required": [ "dependency_pattern", "found_dependency", "lockfile" ], "properties": { - "dependency_pattern": { "$ref": "#/definitions/dependency_pattern" }, + "dependency_pattern": { "$ref": "#/definitions/sca_pattern" }, "found_dependency": { "$ref": "#/definitions/found_dependency" }, "lockfile": { "$ref": "#/definitions/fpath" } } }, - "dependency_pattern": { + "sca_pattern": { "type": "object", "required": [ "ecosystem", "package", "semver_range" ], "properties": { @@ -1125,7 +1125,7 @@ "metadata": { "$ref": "#/definitions/raw_json" }, "is_blocking": { "type": "boolean" }, "fixed_lines": { "type": "array", "items": { "type": "string" } }, - "sca_info": { "$ref": "#/definitions/sca_info" }, + "sca_info": { "$ref": "#/definitions/sca_match" }, "dataflow_trace": { "$ref": "#/definitions/match_dataflow_trace" }, "validation_state": { "$ref": "#/definitions/validation_state" }, "historical_info": { "$ref": "#/definitions/historical_info" }, @@ -1498,14 +1498,15 @@ "type": "object", "required": [ "metavars", "engine_kind", "is_ignored" ], "properties": { + "metavars": { "$ref": "#/definitions/metavars" }, + "engine_kind": { "$ref": "#/definitions/engine_of_finding" }, + "is_ignored": { "type": "boolean" }, "message": { "type": "string" }, "metadata": { "$ref": "#/definitions/raw_json" }, "severity": { "$ref": "#/definitions/match_severity" }, - "metavars": { "$ref": "#/definitions/metavars" }, "fix": { "type": "string" }, "dataflow_trace": { "$ref": "#/definitions/match_dataflow_trace" }, - "engine_kind": { "$ref": "#/definitions/engine_of_finding" }, - "is_ignored": { "type": "boolean" }, + "sca_match": { "$ref": "#/definitions/sca_match" }, "validation_state": { "$ref": "#/definitions/validation_state" }, "historical_info": { "$ref": "#/definitions/historical_info" }, "extra_extra": { "$ref": "#/definitions/raw_json" } diff --git a/semgrep_output_v1.proto b/semgrep_output_v1.proto index beb1a58..d34e616 100644 --- a/semgrep_output_v1.proto +++ b/semgrep_output_v1.proto @@ -1,6 +1,6 @@ // Generated by jsonschema2protobuf. DO NOT EDIT! // Source file: semgrep_output_v1.jsonschema -// Source file sha256 digest: 92c23e510cfd829fd7fd8599a6ea113ccef901d0f1bd64b28936450c16105afe +// Source file sha256 digest: 4fa61427814c36f7c021950234accc23d354b50d13f0300152d244cf6bb87aaa syntax = "proto3"; @@ -57,7 +57,7 @@ message CliMatchExtra { string fingerprint = 426561151; string lines = 109322879; bool is_ignored = 531173073; - ScaInfo sca_info = 493451; + ScaMatch sca_info = 493451; google.protobuf.Any validation_state = 332615966; HistoricalInfo historical_info = 358982721; MatchDataflowTrace dataflow_trace = 359307815; @@ -102,7 +102,7 @@ message MatchIntermediateVar { string content = 432904766; } -message ScaInfo { +message ScaMatch { bool reachable = 496110486; bool reachability_rule = 397050732; int64 sca_finding_schema = 176474186; @@ -110,12 +110,12 @@ message ScaInfo { } message DependencyMatch { - DependencyPattern dependency_pattern = 345131372; + ScaPattern dependency_pattern = 345131372; FoundDependency found_dependency = 28307609; string lockfile = 99886121; } -message DependencyPattern { +message ScaPattern { google.protobuf.Any ecosystem = 7072103; string package = 337745074; string semver_range = 154778121; @@ -442,7 +442,7 @@ message Finding { google.protobuf.Any metadata = 534382816; bool is_blocking = 487146492; repeated string fixed_lines = 405597072; - ScaInfo sca_info = 493451; + ScaMatch sca_info = 493451; MatchDataflowTrace dataflow_trace = 359307815; google.protobuf.Any validation_state = 332615966; HistoricalInfo historical_info = 358982721; @@ -596,14 +596,15 @@ message CoreMatch { } message CoreMatchExtra { + map metavars = 81814710; + google.protobuf.Any engine_kind = 428564670; + bool is_ignored = 531173073; string message = 337998899; google.protobuf.Any metadata = 534382816; google.protobuf.Any severity = 191113633; - map metavars = 81814710; string fix = 118677; MatchDataflowTrace dataflow_trace = 359307815; - google.protobuf.Any engine_kind = 428564670; - bool is_ignored = 531173073; + ScaMatch sca_match = 199861263; google.protobuf.Any validation_state = 332615966; HistoricalInfo historical_info = 358982721; google.protobuf.Any extra_extra = 60155542; diff --git a/semgrep_output_v1.py b/semgrep_output_v1.py index f44382f..0a3485b 100644 --- a/semgrep_output_v1.py +++ b/semgrep_output_v1.py @@ -281,6 +281,293 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass(frozen=True) +class DependencyChild: + """Original type: dependency_child = { ... }""" + + package: str + version: str + + @classmethod + def from_json(cls, x: Any) -> 'DependencyChild': + if isinstance(x, dict): + return cls( + package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('DependencyChild', 'package'), + version=_atd_read_string(x['version']) if 'version' in x else _atd_missing_json_field('DependencyChild', 'version'), + ) + else: + _atd_bad_json('DependencyChild', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['package'] = _atd_write_string(self.package) + res['version'] = _atd_write_string(self.version) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'DependencyChild': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Npm: + """Original type: ecosystem = [ ... | Npm | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Npm' + + @staticmethod + def to_json() -> Any: + return 'npm' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Pypi: + """Original type: ecosystem = [ ... | Pypi | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Pypi' + + @staticmethod + def to_json() -> Any: + return 'pypi' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Gem: + """Original type: ecosystem = [ ... | Gem | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Gem' + + @staticmethod + def to_json() -> Any: + return 'gem' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Gomod: + """Original type: ecosystem = [ ... | Gomod | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Gomod' + + @staticmethod + def to_json() -> Any: + return 'gomod' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Cargo: + """Original type: ecosystem = [ ... | Cargo | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Cargo' + + @staticmethod + def to_json() -> Any: + return 'cargo' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Maven: + """Original type: ecosystem = [ ... | Maven | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Maven' + + @staticmethod + def to_json() -> Any: + return 'maven' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Composer: + """Original type: ecosystem = [ ... | Composer | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Composer' + + @staticmethod + def to_json() -> Any: + return 'composer' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Nuget: + """Original type: ecosystem = [ ... | Nuget | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Nuget' + + @staticmethod + def to_json() -> Any: + return 'nuget' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Pub: + """Original type: ecosystem = [ ... | Pub | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Pub' + + @staticmethod + def to_json() -> Any: + return 'pub' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class SwiftPM: + """Original type: ecosystem = [ ... | SwiftPM | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'SwiftPM' + + @staticmethod + def to_json() -> Any: + return 'swiftpm' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Mix: + """Original type: ecosystem = [ ... | Mix | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Mix' + + @staticmethod + def to_json() -> Any: + return 'mix' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Hex: + """Original type: ecosystem = [ ... | Hex | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Hex' + + @staticmethod + def to_json() -> Any: + return 'hex' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Ecosystem: + """Original type: ecosystem = [ ... ]""" + + value: Union[Npm, Pypi, Gem, Gomod, Cargo, Maven, Composer, Nuget, Pub, SwiftPM, Mix, Hex] + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return self.value.kind + + @classmethod + def from_json(cls, x: Any) -> 'Ecosystem': + if isinstance(x, str): + if x == 'npm': + return cls(Npm()) + if x == 'pypi': + return cls(Pypi()) + if x == 'gem': + return cls(Gem()) + if x == 'gomod': + return cls(Gomod()) + if x == 'cargo': + return cls(Cargo()) + if x == 'maven': + return cls(Maven()) + if x == 'composer': + return cls(Composer()) + if x == 'nuget': + return cls(Nuget()) + if x == 'pub': + return cls(Pub()) + if x == 'swiftpm': + return cls(SwiftPM()) + if x == 'mix': + return cls(Mix()) + if x == 'hex': + return cls(Hex()) + _atd_bad_json('Ecosystem', x) + _atd_bad_json('Ecosystem', x) + + def to_json(self) -> Any: + return self.value.to_json() + + @classmethod + def from_json_string(cls, x: str) -> 'Ecosystem': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass(frozen=True) class Fpath: """Original type: fpath""" @@ -1066,6 +1353,40 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass +class ScaPattern: + """Original type: sca_pattern = { ... }""" + + ecosystem: Ecosystem + package: str + semver_range: str + + @classmethod + def from_json(cls, x: Any) -> 'ScaPattern': + if isinstance(x, dict): + return cls( + ecosystem=Ecosystem.from_json(x['ecosystem']) if 'ecosystem' in x else _atd_missing_json_field('ScaPattern', 'ecosystem'), + package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('ScaPattern', 'package'), + semver_range=_atd_read_string(x['semver_range']) if 'semver_range' in x else _atd_missing_json_field('ScaPattern', 'semver_range'), + ) + else: + _atd_bad_json('ScaPattern', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['ecosystem'] = (lambda x: x.to_json())(self.ecosystem) + res['package'] = _atd_write_string(self.package) + res['semver_range'] = _atd_write_string(self.semver_range) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'ScaPattern': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass class Sha1: """Original type: sha1""" @@ -1073,14 +1394,229 @@ class Sha1: value: str @classmethod - def from_json(cls, x: Any) -> 'Sha1': - return cls(_atd_read_string(x)) + def from_json(cls, x: Any) -> 'Sha1': + return cls(_atd_read_string(x)) + + def to_json(self) -> Any: + return _atd_write_string(self.value) + + @classmethod + def from_json_string(cls, x: str) -> 'Sha1': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class HistoricalInfo: + """Original type: historical_info = { ... }""" + + git_commit: Sha1 + git_commit_timestamp: Datetime + git_blob: Optional[Sha1] = None + + @classmethod + def from_json(cls, x: Any) -> 'HistoricalInfo': + if isinstance(x, dict): + return cls( + git_commit=Sha1.from_json(x['git_commit']) if 'git_commit' in x else _atd_missing_json_field('HistoricalInfo', 'git_commit'), + git_commit_timestamp=Datetime.from_json(x['git_commit_timestamp']) if 'git_commit_timestamp' in x else _atd_missing_json_field('HistoricalInfo', 'git_commit_timestamp'), + git_blob=Sha1.from_json(x['git_blob']) if 'git_blob' in x else None, + ) + else: + _atd_bad_json('HistoricalInfo', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['git_commit'] = (lambda x: x.to_json())(self.git_commit) + res['git_commit_timestamp'] = (lambda x: x.to_json())(self.git_commit_timestamp) + if self.git_blob is not None: + res['git_blob'] = (lambda x: x.to_json())(self.git_blob) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'HistoricalInfo': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class SvalueValue: + """Original type: svalue_value = { ... }""" + + svalue_abstract_content: str + svalue_start: Optional[Position] = None + svalue_end: Optional[Position] = None + + @classmethod + def from_json(cls, x: Any) -> 'SvalueValue': + if isinstance(x, dict): + return cls( + svalue_abstract_content=_atd_read_string(x['svalue_abstract_content']) if 'svalue_abstract_content' in x else _atd_missing_json_field('SvalueValue', 'svalue_abstract_content'), + svalue_start=Position.from_json(x['svalue_start']) if 'svalue_start' in x else None, + svalue_end=Position.from_json(x['svalue_end']) if 'svalue_end' in x else None, + ) + else: + _atd_bad_json('SvalueValue', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['svalue_abstract_content'] = _atd_write_string(self.svalue_abstract_content) + if self.svalue_start is not None: + res['svalue_start'] = (lambda x: x.to_json())(self.svalue_start) + if self.svalue_end is not None: + res['svalue_end'] = (lambda x: x.to_json())(self.svalue_end) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'SvalueValue': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class MetavarValue: + """Original type: metavar_value = { ... }""" + + start: Position + end: Position + abstract_content: str + propagated_value: Optional[SvalueValue] = None + + @classmethod + def from_json(cls, x: Any) -> 'MetavarValue': + if isinstance(x, dict): + return cls( + start=Position.from_json(x['start']) if 'start' in x else _atd_missing_json_field('MetavarValue', 'start'), + end=Position.from_json(x['end']) if 'end' in x else _atd_missing_json_field('MetavarValue', 'end'), + abstract_content=_atd_read_string(x['abstract_content']) if 'abstract_content' in x else _atd_missing_json_field('MetavarValue', 'abstract_content'), + propagated_value=SvalueValue.from_json(x['propagated_value']) if 'propagated_value' in x else None, + ) + else: + _atd_bad_json('MetavarValue', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['start'] = (lambda x: x.to_json())(self.start) + res['end'] = (lambda x: x.to_json())(self.end) + res['abstract_content'] = _atd_write_string(self.abstract_content) + if self.propagated_value is not None: + res['propagated_value'] = (lambda x: x.to_json())(self.propagated_value) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'MetavarValue': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class Metavars: + """Original type: metavars""" + + value: Dict[str, MetavarValue] + + @classmethod + def from_json(cls, x: Any) -> 'Metavars': + return cls(_atd_read_assoc_object_into_dict(MetavarValue.from_json)(x)) + + def to_json(self) -> Any: + return _atd_write_assoc_dict_to_object((lambda x: x.to_json()))(self.value) + + @classmethod + def from_json_string(cls, x: str) -> 'Metavars': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Direct: + """Original type: transitivity = [ ... | Direct | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Direct' + + @staticmethod + def to_json() -> Any: + return 'direct' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Transitive: + """Original type: transitivity = [ ... | Transitive | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Transitive' + + @staticmethod + def to_json() -> Any: + return 'transitive' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Unknown: + """Original type: transitivity = [ ... | Unknown | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'Unknown' + + @staticmethod + def to_json() -> Any: + return 'unknown' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class Transitivity: + """Original type: transitivity = [ ... ]""" + + value: Union[Direct, Transitive, Unknown] + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return self.value.kind + + @classmethod + def from_json(cls, x: Any) -> 'Transitivity': + if isinstance(x, str): + if x == 'direct': + return cls(Direct()) + if x == 'transitive': + return cls(Transitive()) + if x == 'unknown': + return cls(Unknown()) + _atd_bad_json('Transitivity', x) + _atd_bad_json('Transitivity', x) def to_json(self) -> Any: - return _atd_write_string(self.value) + return self.value.to_json() @classmethod - def from_json_string(cls, x: str) -> 'Sha1': + def from_json_string(cls, x: str) -> 'Transitivity': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: @@ -1088,129 +1624,134 @@ def to_json_string(self, **kw: Any) -> str: @dataclass -class HistoricalInfo: - """Original type: historical_info = { ... }""" +class FoundDependency: + """Original type: found_dependency = { ... }""" - git_commit: Sha1 - git_commit_timestamp: Datetime - git_blob: Optional[Sha1] = None + package: str + version: str + ecosystem: Ecosystem + allowed_hashes: Dict[str, List[str]] + transitivity: Transitivity + resolved_url: Optional[str] = None + manifest_path: Optional[Fpath] = None + lockfile_path: Optional[Fpath] = None + line_number: Optional[int] = None + children: Optional[List[DependencyChild]] = None + git_ref: Optional[str] = None @classmethod - def from_json(cls, x: Any) -> 'HistoricalInfo': + def from_json(cls, x: Any) -> 'FoundDependency': if isinstance(x, dict): return cls( - git_commit=Sha1.from_json(x['git_commit']) if 'git_commit' in x else _atd_missing_json_field('HistoricalInfo', 'git_commit'), - git_commit_timestamp=Datetime.from_json(x['git_commit_timestamp']) if 'git_commit_timestamp' in x else _atd_missing_json_field('HistoricalInfo', 'git_commit_timestamp'), - git_blob=Sha1.from_json(x['git_blob']) if 'git_blob' in x else None, + package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('FoundDependency', 'package'), + version=_atd_read_string(x['version']) if 'version' in x else _atd_missing_json_field('FoundDependency', 'version'), + ecosystem=Ecosystem.from_json(x['ecosystem']) if 'ecosystem' in x else _atd_missing_json_field('FoundDependency', 'ecosystem'), + allowed_hashes=_atd_read_assoc_object_into_dict(_atd_read_list(_atd_read_string))(x['allowed_hashes']) if 'allowed_hashes' in x else _atd_missing_json_field('FoundDependency', 'allowed_hashes'), + transitivity=Transitivity.from_json(x['transitivity']) if 'transitivity' in x else _atd_missing_json_field('FoundDependency', 'transitivity'), + resolved_url=_atd_read_string(x['resolved_url']) if 'resolved_url' in x else None, + manifest_path=Fpath.from_json(x['manifest_path']) if 'manifest_path' in x else None, + lockfile_path=Fpath.from_json(x['lockfile_path']) if 'lockfile_path' in x else None, + line_number=_atd_read_int(x['line_number']) if 'line_number' in x else None, + children=_atd_read_list(DependencyChild.from_json)(x['children']) if 'children' in x else None, + git_ref=_atd_read_string(x['git_ref']) if 'git_ref' in x else None, ) else: - _atd_bad_json('HistoricalInfo', x) + _atd_bad_json('FoundDependency', x) def to_json(self) -> Any: res: Dict[str, Any] = {} - res['git_commit'] = (lambda x: x.to_json())(self.git_commit) - res['git_commit_timestamp'] = (lambda x: x.to_json())(self.git_commit_timestamp) - if self.git_blob is not None: - res['git_blob'] = (lambda x: x.to_json())(self.git_blob) + res['package'] = _atd_write_string(self.package) + res['version'] = _atd_write_string(self.version) + res['ecosystem'] = (lambda x: x.to_json())(self.ecosystem) + res['allowed_hashes'] = _atd_write_assoc_dict_to_object(_atd_write_list(_atd_write_string))(self.allowed_hashes) + res['transitivity'] = (lambda x: x.to_json())(self.transitivity) + if self.resolved_url is not None: + res['resolved_url'] = _atd_write_string(self.resolved_url) + if self.manifest_path is not None: + res['manifest_path'] = (lambda x: x.to_json())(self.manifest_path) + if self.lockfile_path is not None: + res['lockfile_path'] = (lambda x: x.to_json())(self.lockfile_path) + if self.line_number is not None: + res['line_number'] = _atd_write_int(self.line_number) + if self.children is not None: + res['children'] = _atd_write_list((lambda x: x.to_json()))(self.children) + if self.git_ref is not None: + res['git_ref'] = _atd_write_string(self.git_ref) return res @classmethod - def from_json_string(cls, x: str) -> 'HistoricalInfo': + def from_json_string(cls, x: str) -> 'FoundDependency': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class SvalueValue: - """Original type: svalue_value = { ... }""" +@dataclass +class DependencyMatch: + """Original type: dependency_match = { ... }""" - svalue_abstract_content: str - svalue_start: Optional[Position] = None - svalue_end: Optional[Position] = None + dependency_pattern: ScaPattern + found_dependency: FoundDependency + lockfile: Fpath @classmethod - def from_json(cls, x: Any) -> 'SvalueValue': + def from_json(cls, x: Any) -> 'DependencyMatch': if isinstance(x, dict): return cls( - svalue_abstract_content=_atd_read_string(x['svalue_abstract_content']) if 'svalue_abstract_content' in x else _atd_missing_json_field('SvalueValue', 'svalue_abstract_content'), - svalue_start=Position.from_json(x['svalue_start']) if 'svalue_start' in x else None, - svalue_end=Position.from_json(x['svalue_end']) if 'svalue_end' in x else None, + dependency_pattern=ScaPattern.from_json(x['dependency_pattern']) if 'dependency_pattern' in x else _atd_missing_json_field('DependencyMatch', 'dependency_pattern'), + found_dependency=FoundDependency.from_json(x['found_dependency']) if 'found_dependency' in x else _atd_missing_json_field('DependencyMatch', 'found_dependency'), + lockfile=Fpath.from_json(x['lockfile']) if 'lockfile' in x else _atd_missing_json_field('DependencyMatch', 'lockfile'), ) else: - _atd_bad_json('SvalueValue', x) + _atd_bad_json('DependencyMatch', x) def to_json(self) -> Any: res: Dict[str, Any] = {} - res['svalue_abstract_content'] = _atd_write_string(self.svalue_abstract_content) - if self.svalue_start is not None: - res['svalue_start'] = (lambda x: x.to_json())(self.svalue_start) - if self.svalue_end is not None: - res['svalue_end'] = (lambda x: x.to_json())(self.svalue_end) + res['dependency_pattern'] = (lambda x: x.to_json())(self.dependency_pattern) + res['found_dependency'] = (lambda x: x.to_json())(self.found_dependency) + res['lockfile'] = (lambda x: x.to_json())(self.lockfile) return res @classmethod - def from_json_string(cls, x: str) -> 'SvalueValue': + def from_json_string(cls, x: str) -> 'DependencyMatch': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class MetavarValue: - """Original type: metavar_value = { ... }""" +@dataclass +class ScaMatch: + """Original type: sca_match = { ... }""" - start: Position - end: Position - abstract_content: str - propagated_value: Optional[SvalueValue] = None + reachable: bool + reachability_rule: bool + sca_finding_schema: int + dependency_match: DependencyMatch @classmethod - def from_json(cls, x: Any) -> 'MetavarValue': + def from_json(cls, x: Any) -> 'ScaMatch': if isinstance(x, dict): return cls( - start=Position.from_json(x['start']) if 'start' in x else _atd_missing_json_field('MetavarValue', 'start'), - end=Position.from_json(x['end']) if 'end' in x else _atd_missing_json_field('MetavarValue', 'end'), - abstract_content=_atd_read_string(x['abstract_content']) if 'abstract_content' in x else _atd_missing_json_field('MetavarValue', 'abstract_content'), - propagated_value=SvalueValue.from_json(x['propagated_value']) if 'propagated_value' in x else None, + reachable=_atd_read_bool(x['reachable']) if 'reachable' in x else _atd_missing_json_field('ScaMatch', 'reachable'), + reachability_rule=_atd_read_bool(x['reachability_rule']) if 'reachability_rule' in x else _atd_missing_json_field('ScaMatch', 'reachability_rule'), + sca_finding_schema=_atd_read_int(x['sca_finding_schema']) if 'sca_finding_schema' in x else _atd_missing_json_field('ScaMatch', 'sca_finding_schema'), + dependency_match=DependencyMatch.from_json(x['dependency_match']) if 'dependency_match' in x else _atd_missing_json_field('ScaMatch', 'dependency_match'), ) else: - _atd_bad_json('MetavarValue', x) + _atd_bad_json('ScaMatch', x) def to_json(self) -> Any: res: Dict[str, Any] = {} - res['start'] = (lambda x: x.to_json())(self.start) - res['end'] = (lambda x: x.to_json())(self.end) - res['abstract_content'] = _atd_write_string(self.abstract_content) - if self.propagated_value is not None: - res['propagated_value'] = (lambda x: x.to_json())(self.propagated_value) + res['reachable'] = _atd_write_bool(self.reachable) + res['reachability_rule'] = _atd_write_bool(self.reachability_rule) + res['sca_finding_schema'] = _atd_write_int(self.sca_finding_schema) + res['dependency_match'] = (lambda x: x.to_json())(self.dependency_match) return res @classmethod - def from_json_string(cls, x: str) -> 'MetavarValue': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Metavars: - """Original type: metavars""" - - value: Dict[str, MetavarValue] - - @classmethod - def from_json(cls, x: Any) -> 'Metavars': - return cls(_atd_read_assoc_object_into_dict(MetavarValue.from_json)(x)) - - def to_json(self) -> Any: - return _atd_write_assoc_dict_to_object((lambda x: x.to_json()))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Metavars': + def from_json_string(cls, x: str) -> 'ScaMatch': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: @@ -1439,6 +1980,7 @@ class CoreMatchExtra: severity: Optional[MatchSeverity] = None fix: Optional[str] = None dataflow_trace: Optional[MatchDataflowTrace] = None + sca_match: Optional[ScaMatch] = None validation_state: Optional[ValidationState] = None historical_info: Optional[HistoricalInfo] = None extra_extra: Optional[RawJson] = None @@ -1455,6 +1997,7 @@ def from_json(cls, x: Any) -> 'CoreMatchExtra': severity=MatchSeverity.from_json(x['severity']) if 'severity' in x else None, fix=_atd_read_string(x['fix']) if 'fix' in x else None, dataflow_trace=MatchDataflowTrace.from_json(x['dataflow_trace']) if 'dataflow_trace' in x else None, + sca_match=ScaMatch.from_json(x['sca_match']) if 'sca_match' in x else None, validation_state=ValidationState.from_json(x['validation_state']) if 'validation_state' in x else None, historical_info=HistoricalInfo.from_json(x['historical_info']) if 'historical_info' in x else None, extra_extra=RawJson.from_json(x['extra_extra']) if 'extra_extra' in x else None, @@ -1477,6 +2020,8 @@ def to_json(self) -> Any: res['fix'] = _atd_write_string(self.fix) if self.dataflow_trace is not None: res['dataflow_trace'] = (lambda x: x.to_json())(self.dataflow_trace) + if self.sca_match is not None: + res['sca_match'] = (lambda x: x.to_json())(self.sca_match) if self.validation_state is not None: res['validation_state'] = (lambda x: x.to_json())(self.validation_state) if self.historical_info is not None: @@ -2065,114 +2610,29 @@ def to_json_string(self, **kw: Any) -> str: @dataclass class TriageIgnored: - """Original type: triage_ignored = { ... }""" - - triage_ignored_syntactic_ids: List[str] = field(default_factory=lambda: []) - triage_ignored_match_based_ids: List[str] = field(default_factory=lambda: []) - - @classmethod - def from_json(cls, x: Any) -> 'TriageIgnored': - if isinstance(x, dict): - return cls( - triage_ignored_syntactic_ids=_atd_read_list(_atd_read_string)(x['triage_ignored_syntactic_ids']) if 'triage_ignored_syntactic_ids' in x else [], - triage_ignored_match_based_ids=_atd_read_list(_atd_read_string)(x['triage_ignored_match_based_ids']) if 'triage_ignored_match_based_ids' in x else [], - ) - else: - _atd_bad_json('TriageIgnored', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['triage_ignored_syntactic_ids'] = _atd_write_list(_atd_write_string)(self.triage_ignored_syntactic_ids) - res['triage_ignored_match_based_ids'] = _atd_write_list(_atd_write_string)(self.triage_ignored_match_based_ids) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'TriageIgnored': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class Direct: - """Original type: transitivity = [ ... | Direct | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Direct' - - @staticmethod - def to_json() -> Any: - return 'direct' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class Transitive: - """Original type: transitivity = [ ... | Transitive | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Transitive' - - @staticmethod - def to_json() -> Any: - return 'transitive' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class Unknown: - """Original type: transitivity = [ ... | Unknown | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Unknown' - - @staticmethod - def to_json() -> Any: - return 'unknown' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class Transitivity: - """Original type: transitivity = [ ... ]""" - - value: Union[Direct, Transitive, Unknown] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Transitivity': - if isinstance(x, str): - if x == 'direct': - return cls(Direct()) - if x == 'transitive': - return cls(Transitive()) - if x == 'unknown': - return cls(Unknown()) - _atd_bad_json('Transitivity', x) - _atd_bad_json('Transitivity', x) + """Original type: triage_ignored = { ... }""" + + triage_ignored_syntactic_ids: List[str] = field(default_factory=lambda: []) + triage_ignored_match_based_ids: List[str] = field(default_factory=lambda: []) + + @classmethod + def from_json(cls, x: Any) -> 'TriageIgnored': + if isinstance(x, dict): + return cls( + triage_ignored_syntactic_ids=_atd_read_list(_atd_read_string)(x['triage_ignored_syntactic_ids']) if 'triage_ignored_syntactic_ids' in x else [], + triage_ignored_match_based_ids=_atd_read_list(_atd_read_string)(x['triage_ignored_match_based_ids']) if 'triage_ignored_match_based_ids' in x else [], + ) + else: + _atd_bad_json('TriageIgnored', x) def to_json(self) -> Any: - return self.value.to_json() + res: Dict[str, Any] = {} + res['triage_ignored_syntactic_ids'] = _atd_write_list(_atd_write_string)(self.triage_ignored_syntactic_ids) + res['triage_ignored_match_based_ids'] = _atd_write_list(_atd_write_string)(self.triage_ignored_match_based_ids) + return res @classmethod - def from_json_string(cls, x: str) -> 'Transitivity': + def from_json_string(cls, x: str) -> 'TriageIgnored': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: @@ -3139,664 +3599,396 @@ class Tag: @classmethod def from_json(cls, x: Any) -> 'Tag': - return cls(_atd_read_string(x)) - - def to_json(self) -> Any: - return _atd_write_string(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Tag': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True, order=True) -class LockfileParsing: - """Original type: resolution_method = [ ... | LockfileParsing | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LockfileParsing' - - @staticmethod - def to_json() -> Any: - return 'LockfileParsing' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True, order=True) -class DynamicResolution: - """Original type: resolution_method = [ ... | DynamicResolution | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DynamicResolution' - - @staticmethod - def to_json() -> Any: - return 'DynamicResolution' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True, order=True) -class ResolutionMethod: - """Original type: resolution_method = [ ... ]""" - - value: Union[LockfileParsing, DynamicResolution] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ResolutionMethod': - if isinstance(x, str): - if x == 'LockfileParsing': - return cls(LockfileParsing()) - if x == 'DynamicResolution': - return cls(DynamicResolution()) - _atd_bad_json('ResolutionMethod', x) - _atd_bad_json('ResolutionMethod', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ResolutionMethod': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class RequirementsIn: - """Original type: manifest_kind = [ ... | RequirementsIn | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RequirementsIn' - - @staticmethod - def to_json() -> Any: - return 'RequirementsIn' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class PackageJson: - """Original type: manifest_kind = [ ... | PackageJson | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PackageJson' - - @staticmethod - def to_json() -> Any: - return 'PackageJson' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class Gemfile: - """Original type: manifest_kind = [ ... | Gemfile | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Gemfile' - - @staticmethod - def to_json() -> Any: - return 'Gemfile' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class GoMod_: - """Original type: manifest_kind = [ ... | GoMod | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'GoMod_' - - @staticmethod - def to_json() -> Any: - return 'GoMod' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class CargoToml: - """Original type: manifest_kind = [ ... | CargoToml | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CargoToml' - - @staticmethod - def to_json() -> Any: - return 'CargoToml' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class PomXml: - """Original type: manifest_kind = [ ... | PomXml | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PomXml' - - @staticmethod - def to_json() -> Any: - return 'PomXml' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class BuildGradle: - """Original type: manifest_kind = [ ... | BuildGradle | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BuildGradle' - - @staticmethod - def to_json() -> Any: - return 'BuildGradle' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class SettingsGradle: - """Original type: manifest_kind = [ ... | SettingsGradle | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'SettingsGradle' - - @staticmethod - def to_json() -> Any: - return 'SettingsGradle' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class ComposerJson: - """Original type: manifest_kind = [ ... | ComposerJson | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ComposerJson' - - @staticmethod - def to_json() -> Any: - return 'ComposerJson' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class NugetManifestJson: - """Original type: manifest_kind = [ ... | NugetManifestJson | ... ]""" + return cls(_atd_read_string(x)) - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NugetManifestJson' + def to_json(self) -> Any: + return _atd_write_string(self.value) - @staticmethod - def to_json() -> Any: - return 'NugetManifestJson' + @classmethod + def from_json_string(cls, x: str) -> 'Tag': + return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class PubspecYaml: - """Original type: manifest_kind = [ ... | PubspecYaml | ... ]""" +@dataclass(frozen=True, order=True) +class LockfileParsing: + """Original type: resolution_method = [ ... | LockfileParsing | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'PubspecYaml' + return 'LockfileParsing' @staticmethod def to_json() -> Any: - return 'PubspecYaml' + return 'LockfileParsing' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class PackageSwift: - """Original type: manifest_kind = [ ... | PackageSwift | ... ]""" +@dataclass(frozen=True, order=True) +class DynamicResolution: + """Original type: resolution_method = [ ... | DynamicResolution | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'PackageSwift' + return 'DynamicResolution' @staticmethod def to_json() -> Any: - return 'PackageSwift' + return 'DynamicResolution' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class MixExs: - """Original type: manifest_kind = [ ... | MixExs | ... ]""" +@dataclass(frozen=True, order=True) +class ResolutionMethod: + """Original type: resolution_method = [ ... ]""" + + value: Union[LockfileParsing, DynamicResolution] @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'MixExs' + return self.value.kind - @staticmethod - def to_json() -> Any: - return 'MixExs' + @classmethod + def from_json(cls, x: Any) -> 'ResolutionMethod': + if isinstance(x, str): + if x == 'LockfileParsing': + return cls(LockfileParsing()) + if x == 'DynamicResolution': + return cls(DynamicResolution()) + _atd_bad_json('ResolutionMethod', x) + _atd_bad_json('ResolutionMethod', x) + + def to_json(self) -> Any: + return self.value.to_json() + + @classmethod + def from_json_string(cls, x: str) -> 'ResolutionMethod': + return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Pipfile: - """Original type: manifest_kind = [ ... | Pipfile | ... ]""" +class RequirementsIn: + """Original type: manifest_kind = [ ... | RequirementsIn | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Pipfile' + return 'RequirementsIn' @staticmethod def to_json() -> Any: - return 'Pipfile' + return 'RequirementsIn' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class PyprojectToml: - """Original type: manifest_kind = [ ... | PyprojectToml | ... ]""" +class PackageJson: + """Original type: manifest_kind = [ ... | PackageJson | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'PyprojectToml' + return 'PackageJson' @staticmethod def to_json() -> Any: - return 'PyprojectToml' + return 'PackageJson' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class ConanFileTxt: - """Original type: manifest_kind = [ ... | ConanFileTxt | ... ]""" +class Gemfile: + """Original type: manifest_kind = [ ... | Gemfile | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'ConanFileTxt' + return 'Gemfile' @staticmethod def to_json() -> Any: - return 'ConanFileTxt' + return 'Gemfile' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class ConanFilePy: - """Original type: manifest_kind = [ ... | ConanFilePy | ... ]""" +class GoMod_: + """Original type: manifest_kind = [ ... | GoMod | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'ConanFilePy' + return 'GoMod_' @staticmethod def to_json() -> Any: - return 'ConanFilePy' + return 'GoMod' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Csproj: - """Original type: manifest_kind = [ ... | Csproj | ... ]""" +class CargoToml: + """Original type: manifest_kind = [ ... | CargoToml | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Csproj' + return 'CargoToml' @staticmethod def to_json() -> Any: - return 'Csproj' + return 'CargoToml' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class ManifestKind: - """Original type: manifest_kind = [ ... ]""" - - value: Union[RequirementsIn, PackageJson, Gemfile, GoMod_, CargoToml, PomXml, BuildGradle, SettingsGradle, ComposerJson, NugetManifestJson, PubspecYaml, PackageSwift, MixExs, Pipfile, PyprojectToml, ConanFileTxt, ConanFilePy, Csproj] +class PomXml: + """Original type: manifest_kind = [ ... | PomXml | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ManifestKind': - if isinstance(x, str): - if x == 'RequirementsIn': - return cls(RequirementsIn()) - if x == 'PackageJson': - return cls(PackageJson()) - if x == 'Gemfile': - return cls(Gemfile()) - if x == 'GoMod': - return cls(GoMod_()) - if x == 'CargoToml': - return cls(CargoToml()) - if x == 'PomXml': - return cls(PomXml()) - if x == 'BuildGradle': - return cls(BuildGradle()) - if x == 'SettingsGradle': - return cls(SettingsGradle()) - if x == 'ComposerJson': - return cls(ComposerJson()) - if x == 'NugetManifestJson': - return cls(NugetManifestJson()) - if x == 'PubspecYaml': - return cls(PubspecYaml()) - if x == 'PackageSwift': - return cls(PackageSwift()) - if x == 'MixExs': - return cls(MixExs()) - if x == 'Pipfile': - return cls(Pipfile()) - if x == 'PyprojectToml': - return cls(PyprojectToml()) - if x == 'ConanFileTxt': - return cls(ConanFileTxt()) - if x == 'ConanFilePy': - return cls(ConanFilePy()) - if x == 'Csproj': - return cls(Csproj()) - _atd_bad_json('ManifestKind', x) - _atd_bad_json('ManifestKind', x) - - def to_json(self) -> Any: - return self.value.to_json() + return 'PomXml' - @classmethod - def from_json_string(cls, x: str) -> 'ManifestKind': - return cls.from_json(json.loads(x)) + @staticmethod + def to_json() -> Any: + return 'PomXml' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Npm: - """Original type: ecosystem = [ ... | Npm | ... ]""" +class BuildGradle: + """Original type: manifest_kind = [ ... | BuildGradle | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Npm' + return 'BuildGradle' @staticmethod def to_json() -> Any: - return 'npm' + return 'BuildGradle' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Pypi: - """Original type: ecosystem = [ ... | Pypi | ... ]""" +class SettingsGradle: + """Original type: manifest_kind = [ ... | SettingsGradle | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Pypi' + return 'SettingsGradle' @staticmethod def to_json() -> Any: - return 'pypi' + return 'SettingsGradle' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Gem: - """Original type: ecosystem = [ ... | Gem | ... ]""" +class ComposerJson: + """Original type: manifest_kind = [ ... | ComposerJson | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Gem' + return 'ComposerJson' @staticmethod def to_json() -> Any: - return 'gem' + return 'ComposerJson' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Gomod: - """Original type: ecosystem = [ ... | Gomod | ... ]""" +class NugetManifestJson: + """Original type: manifest_kind = [ ... | NugetManifestJson | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Gomod' + return 'NugetManifestJson' @staticmethod def to_json() -> Any: - return 'gomod' + return 'NugetManifestJson' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Cargo: - """Original type: ecosystem = [ ... | Cargo | ... ]""" +class PubspecYaml: + """Original type: manifest_kind = [ ... | PubspecYaml | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Cargo' + return 'PubspecYaml' @staticmethod def to_json() -> Any: - return 'cargo' + return 'PubspecYaml' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Maven: - """Original type: ecosystem = [ ... | Maven | ... ]""" +class PackageSwift: + """Original type: manifest_kind = [ ... | PackageSwift | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Maven' + return 'PackageSwift' @staticmethod def to_json() -> Any: - return 'maven' + return 'PackageSwift' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Composer: - """Original type: ecosystem = [ ... | Composer | ... ]""" +class MixExs: + """Original type: manifest_kind = [ ... | MixExs | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Composer' + return 'MixExs' @staticmethod def to_json() -> Any: - return 'composer' + return 'MixExs' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Nuget: - """Original type: ecosystem = [ ... | Nuget | ... ]""" +class Pipfile: + """Original type: manifest_kind = [ ... | Pipfile | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Nuget' + return 'Pipfile' @staticmethod def to_json() -> Any: - return 'nuget' + return 'Pipfile' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Pub: - """Original type: ecosystem = [ ... | Pub | ... ]""" +class PyprojectToml: + """Original type: manifest_kind = [ ... | PyprojectToml | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Pub' + return 'PyprojectToml' @staticmethod def to_json() -> Any: - return 'pub' + return 'PyprojectToml' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class SwiftPM: - """Original type: ecosystem = [ ... | SwiftPM | ... ]""" +class ConanFileTxt: + """Original type: manifest_kind = [ ... | ConanFileTxt | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'SwiftPM' + return 'ConanFileTxt' @staticmethod def to_json() -> Any: - return 'swiftpm' + return 'ConanFileTxt' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Mix: - """Original type: ecosystem = [ ... | Mix | ... ]""" +class ConanFilePy: + """Original type: manifest_kind = [ ... | ConanFilePy | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Mix' + return 'ConanFilePy' @staticmethod def to_json() -> Any: - return 'mix' + return 'ConanFilePy' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Hex: - """Original type: ecosystem = [ ... | Hex | ... ]""" +class Csproj: + """Original type: manifest_kind = [ ... | Csproj | ... ]""" @property def kind(self) -> str: """Name of the class representing this variant.""" - return 'Hex' + return 'Csproj' @staticmethod def to_json() -> Any: - return 'hex' + return 'Csproj' def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @dataclass(frozen=True) -class Ecosystem: - """Original type: ecosystem = [ ... ]""" +class ManifestKind: + """Original type: manifest_kind = [ ... ]""" - value: Union[Npm, Pypi, Gem, Gomod, Cargo, Maven, Composer, Nuget, Pub, SwiftPM, Mix, Hex] + value: Union[RequirementsIn, PackageJson, Gemfile, GoMod_, CargoToml, PomXml, BuildGradle, SettingsGradle, ComposerJson, NugetManifestJson, PubspecYaml, PackageSwift, MixExs, Pipfile, PyprojectToml, ConanFileTxt, ConanFilePy, Csproj] @property def kind(self) -> str: @@ -3804,40 +3996,52 @@ def kind(self) -> str: return self.value.kind @classmethod - def from_json(cls, x: Any) -> 'Ecosystem': + def from_json(cls, x: Any) -> 'ManifestKind': if isinstance(x, str): - if x == 'npm': - return cls(Npm()) - if x == 'pypi': - return cls(Pypi()) - if x == 'gem': - return cls(Gem()) - if x == 'gomod': - return cls(Gomod()) - if x == 'cargo': - return cls(Cargo()) - if x == 'maven': - return cls(Maven()) - if x == 'composer': - return cls(Composer()) - if x == 'nuget': - return cls(Nuget()) - if x == 'pub': - return cls(Pub()) - if x == 'swiftpm': - return cls(SwiftPM()) - if x == 'mix': - return cls(Mix()) - if x == 'hex': - return cls(Hex()) - _atd_bad_json('Ecosystem', x) - _atd_bad_json('Ecosystem', x) + if x == 'RequirementsIn': + return cls(RequirementsIn()) + if x == 'PackageJson': + return cls(PackageJson()) + if x == 'Gemfile': + return cls(Gemfile()) + if x == 'GoMod': + return cls(GoMod_()) + if x == 'CargoToml': + return cls(CargoToml()) + if x == 'PomXml': + return cls(PomXml()) + if x == 'BuildGradle': + return cls(BuildGradle()) + if x == 'SettingsGradle': + return cls(SettingsGradle()) + if x == 'ComposerJson': + return cls(ComposerJson()) + if x == 'NugetManifestJson': + return cls(NugetManifestJson()) + if x == 'PubspecYaml': + return cls(PubspecYaml()) + if x == 'PackageSwift': + return cls(PackageSwift()) + if x == 'MixExs': + return cls(MixExs()) + if x == 'Pipfile': + return cls(Pipfile()) + if x == 'PyprojectToml': + return cls(PyprojectToml()) + if x == 'ConanFileTxt': + return cls(ConanFileTxt()) + if x == 'ConanFilePy': + return cls(ConanFilePy()) + if x == 'Csproj': + return cls(Csproj()) + _atd_bad_json('ManifestKind', x) + _atd_bad_json('ManifestKind', x) def to_json(self) -> Any: return self.value.to_json() @classmethod - def from_json_string(cls, x: str) -> 'Ecosystem': + def from_json_string(cls, x: str) -> 'ManifestKind': return cls.from_json(json.loads(x)) def to_json_string(self, **kw: Any) -> str: @@ -5630,206 +5834,6 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class DependencyChild: - """Original type: dependency_child = { ... }""" - - package: str - version: str - - @classmethod - def from_json(cls, x: Any) -> 'DependencyChild': - if isinstance(x, dict): - return cls( - package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('DependencyChild', 'package'), - version=_atd_read_string(x['version']) if 'version' in x else _atd_missing_json_field('DependencyChild', 'version'), - ) - else: - _atd_bad_json('DependencyChild', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['package'] = _atd_write_string(self.package) - res['version'] = _atd_write_string(self.version) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'DependencyChild': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FoundDependency: - """Original type: found_dependency = { ... }""" - - package: str - version: str - ecosystem: Ecosystem - allowed_hashes: Dict[str, List[str]] - transitivity: Transitivity - resolved_url: Optional[str] = None - manifest_path: Optional[Fpath] = None - lockfile_path: Optional[Fpath] = None - line_number: Optional[int] = None - children: Optional[List[DependencyChild]] = None - git_ref: Optional[str] = None - - @classmethod - def from_json(cls, x: Any) -> 'FoundDependency': - if isinstance(x, dict): - return cls( - package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('FoundDependency', 'package'), - version=_atd_read_string(x['version']) if 'version' in x else _atd_missing_json_field('FoundDependency', 'version'), - ecosystem=Ecosystem.from_json(x['ecosystem']) if 'ecosystem' in x else _atd_missing_json_field('FoundDependency', 'ecosystem'), - allowed_hashes=_atd_read_assoc_object_into_dict(_atd_read_list(_atd_read_string))(x['allowed_hashes']) if 'allowed_hashes' in x else _atd_missing_json_field('FoundDependency', 'allowed_hashes'), - transitivity=Transitivity.from_json(x['transitivity']) if 'transitivity' in x else _atd_missing_json_field('FoundDependency', 'transitivity'), - resolved_url=_atd_read_string(x['resolved_url']) if 'resolved_url' in x else None, - manifest_path=Fpath.from_json(x['manifest_path']) if 'manifest_path' in x else None, - lockfile_path=Fpath.from_json(x['lockfile_path']) if 'lockfile_path' in x else None, - line_number=_atd_read_int(x['line_number']) if 'line_number' in x else None, - children=_atd_read_list(DependencyChild.from_json)(x['children']) if 'children' in x else None, - git_ref=_atd_read_string(x['git_ref']) if 'git_ref' in x else None, - ) - else: - _atd_bad_json('FoundDependency', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['package'] = _atd_write_string(self.package) - res['version'] = _atd_write_string(self.version) - res['ecosystem'] = (lambda x: x.to_json())(self.ecosystem) - res['allowed_hashes'] = _atd_write_assoc_dict_to_object(_atd_write_list(_atd_write_string))(self.allowed_hashes) - res['transitivity'] = (lambda x: x.to_json())(self.transitivity) - if self.resolved_url is not None: - res['resolved_url'] = _atd_write_string(self.resolved_url) - if self.manifest_path is not None: - res['manifest_path'] = (lambda x: x.to_json())(self.manifest_path) - if self.lockfile_path is not None: - res['lockfile_path'] = (lambda x: x.to_json())(self.lockfile_path) - if self.line_number is not None: - res['line_number'] = _atd_write_int(self.line_number) - if self.children is not None: - res['children'] = _atd_write_list((lambda x: x.to_json()))(self.children) - if self.git_ref is not None: - res['git_ref'] = _atd_write_string(self.git_ref) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'FoundDependency': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DependencyPattern: - """Original type: dependency_pattern = { ... }""" - - ecosystem: Ecosystem - package: str - semver_range: str - - @classmethod - def from_json(cls, x: Any) -> 'DependencyPattern': - if isinstance(x, dict): - return cls( - ecosystem=Ecosystem.from_json(x['ecosystem']) if 'ecosystem' in x else _atd_missing_json_field('DependencyPattern', 'ecosystem'), - package=_atd_read_string(x['package']) if 'package' in x else _atd_missing_json_field('DependencyPattern', 'package'), - semver_range=_atd_read_string(x['semver_range']) if 'semver_range' in x else _atd_missing_json_field('DependencyPattern', 'semver_range'), - ) - else: - _atd_bad_json('DependencyPattern', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['ecosystem'] = (lambda x: x.to_json())(self.ecosystem) - res['package'] = _atd_write_string(self.package) - res['semver_range'] = _atd_write_string(self.semver_range) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'DependencyPattern': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DependencyMatch: - """Original type: dependency_match = { ... }""" - - dependency_pattern: DependencyPattern - found_dependency: FoundDependency - lockfile: Fpath - - @classmethod - def from_json(cls, x: Any) -> 'DependencyMatch': - if isinstance(x, dict): - return cls( - dependency_pattern=DependencyPattern.from_json(x['dependency_pattern']) if 'dependency_pattern' in x else _atd_missing_json_field('DependencyMatch', 'dependency_pattern'), - found_dependency=FoundDependency.from_json(x['found_dependency']) if 'found_dependency' in x else _atd_missing_json_field('DependencyMatch', 'found_dependency'), - lockfile=Fpath.from_json(x['lockfile']) if 'lockfile' in x else _atd_missing_json_field('DependencyMatch', 'lockfile'), - ) - else: - _atd_bad_json('DependencyMatch', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['dependency_pattern'] = (lambda x: x.to_json())(self.dependency_pattern) - res['found_dependency'] = (lambda x: x.to_json())(self.found_dependency) - res['lockfile'] = (lambda x: x.to_json())(self.lockfile) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'DependencyMatch': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ScaInfo: - """Original type: sca_info = { ... }""" - - reachable: bool - reachability_rule: bool - sca_finding_schema: int - dependency_match: DependencyMatch - - @classmethod - def from_json(cls, x: Any) -> 'ScaInfo': - if isinstance(x, dict): - return cls( - reachable=_atd_read_bool(x['reachable']) if 'reachable' in x else _atd_missing_json_field('ScaInfo', 'reachable'), - reachability_rule=_atd_read_bool(x['reachability_rule']) if 'reachability_rule' in x else _atd_missing_json_field('ScaInfo', 'reachability_rule'), - sca_finding_schema=_atd_read_int(x['sca_finding_schema']) if 'sca_finding_schema' in x else _atd_missing_json_field('ScaInfo', 'sca_finding_schema'), - dependency_match=DependencyMatch.from_json(x['dependency_match']) if 'dependency_match' in x else _atd_missing_json_field('ScaInfo', 'dependency_match'), - ) - else: - _atd_bad_json('ScaInfo', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['reachable'] = _atd_write_bool(self.reachable) - res['reachability_rule'] = _atd_write_bool(self.reachability_rule) - res['sca_finding_schema'] = _atd_write_int(self.sca_finding_schema) - res['dependency_match'] = (lambda x: x.to_json())(self.dependency_match) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'ScaInfo': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - @dataclass(frozen=True) class SarifFormatReturn: """Original type: sarif_format_return = { ... }""" @@ -6726,7 +6730,7 @@ class CliMatchExtra: fix: Optional[str] = None fixed_lines: Optional[List[str]] = None is_ignored: Optional[bool] = None - sca_info: Optional[ScaInfo] = None + sca_info: Optional[ScaMatch] = None validation_state: Optional[ValidationState] = None historical_info: Optional[HistoricalInfo] = None dataflow_trace: Optional[MatchDataflowTrace] = None @@ -6746,7 +6750,7 @@ def from_json(cls, x: Any) -> 'CliMatchExtra': fix=_atd_read_string(x['fix']) if 'fix' in x else None, fixed_lines=_atd_read_list(_atd_read_string)(x['fixed_lines']) if 'fixed_lines' in x else None, is_ignored=_atd_read_bool(x['is_ignored']) if 'is_ignored' in x else None, - sca_info=ScaInfo.from_json(x['sca_info']) if 'sca_info' in x else None, + sca_info=ScaMatch.from_json(x['sca_info']) if 'sca_info' in x else None, validation_state=ValidationState.from_json(x['validation_state']) if 'validation_state' in x else None, historical_info=HistoricalInfo.from_json(x['historical_info']) if 'historical_info' in x else None, dataflow_trace=MatchDataflowTrace.from_json(x['dataflow_trace']) if 'dataflow_trace' in x else None, @@ -7233,7 +7237,7 @@ class Finding: match_based_id: Optional[str] = None hashes: Optional[FindingHashes] = None fixed_lines: Optional[List[str]] = None - sca_info: Optional[ScaInfo] = None + sca_info: Optional[ScaMatch] = None dataflow_trace: Optional[MatchDataflowTrace] = None validation_state: Optional[ValidationState] = None historical_info: Optional[HistoricalInfo] = None @@ -7259,7 +7263,7 @@ def from_json(cls, x: Any) -> 'Finding': match_based_id=_atd_read_string(x['match_based_id']) if 'match_based_id' in x else None, hashes=FindingHashes.from_json(x['hashes']) if 'hashes' in x else None, fixed_lines=_atd_read_list(_atd_read_string)(x['fixed_lines']) if 'fixed_lines' in x else None, - sca_info=ScaInfo.from_json(x['sca_info']) if 'sca_info' in x else None, + sca_info=ScaMatch.from_json(x['sca_info']) if 'sca_info' in x else None, dataflow_trace=MatchDataflowTrace.from_json(x['dataflow_trace']) if 'dataflow_trace' in x else None, validation_state=ValidationState.from_json(x['validation_state']) if 'validation_state' in x else None, historical_info=HistoricalInfo.from_json(x['historical_info']) if 'historical_info' in x else None, diff --git a/semgrep_output_v1.ts b/semgrep_output_v1.ts index 6cbd09b..d3bc45e 100644 --- a/semgrep_output_v1.ts +++ b/semgrep_output_v1.ts @@ -100,7 +100,7 @@ export type CliMatchExtra = { fingerprint: string; lines: string; is_ignored?: boolean; - sca_info?: ScaInfo; + sca_info?: ScaMatch; validation_state?: ValidationState; historical_info?: HistoricalInfo; dataflow_trace?: MatchDataflowTrace; @@ -187,7 +187,7 @@ export type Transitivity = | { kind: 'Transitive' /* JSON: "transitive" */ } | { kind: 'Unknown' /* JSON: "unknown" */ } -export type ScaInfo = { +export type ScaMatch = { reachable: boolean; reachability_rule: boolean; sca_finding_schema: number /*int*/; @@ -195,12 +195,12 @@ export type ScaInfo = { } export type DependencyMatch = { - dependency_pattern: DependencyPattern; + dependency_pattern: ScaPattern; found_dependency: FoundDependency; lockfile: Fpath; } -export type DependencyPattern = { +export type ScaPattern = { ecosystem: Ecosystem; package_: string; semver_range: string; @@ -623,7 +623,7 @@ export type Finding = { metadata: RawJson; is_blocking: boolean; fixed_lines?: string[]; - sca_info?: ScaInfo; + sca_info?: ScaMatch; dataflow_trace?: MatchDataflowTrace; validation_state?: ValidationState; historical_info?: HistoricalInfo; @@ -813,14 +813,15 @@ export type CoreMatch = { } export type CoreMatchExtra = { + metavars: Metavars; + engine_kind: EngineOfFinding; + is_ignored: boolean; message?: string; metadata?: RawJson; severity?: MatchSeverity; - metavars: Metavars; fix?: string; dataflow_trace?: MatchDataflowTrace; - engine_kind: EngineOfFinding; - is_ignored: boolean; + sca_match?: ScaMatch; validation_state?: ValidationState; historical_info?: HistoricalInfo; extra_extra?: RawJson; @@ -1322,7 +1323,7 @@ export function writeCliMatchExtra(x: CliMatchExtra, context: any = x): any { 'fingerprint': _atd_write_required_field('CliMatchExtra', 'fingerprint', _atd_write_string, x.fingerprint, x), 'lines': _atd_write_required_field('CliMatchExtra', 'lines', _atd_write_string, x.lines, x), 'is_ignored': _atd_write_optional_field(_atd_write_bool, x.is_ignored, x), - 'sca_info': _atd_write_optional_field(writeScaInfo, x.sca_info, x), + 'sca_info': _atd_write_optional_field(writeScaMatch, x.sca_info, x), 'validation_state': _atd_write_optional_field(writeValidationState, x.validation_state, x), 'historical_info': _atd_write_optional_field(writeHistoricalInfo, x.historical_info, x), 'dataflow_trace': _atd_write_optional_field(writeMatchDataflowTrace, x.dataflow_trace, x), @@ -1342,7 +1343,7 @@ export function readCliMatchExtra(x: any, context: any = x): CliMatchExtra { fingerprint: _atd_read_required_field('CliMatchExtra', 'fingerprint', _atd_read_string, x['fingerprint'], x), lines: _atd_read_required_field('CliMatchExtra', 'lines', _atd_read_string, x['lines'], x), is_ignored: _atd_read_optional_field(_atd_read_bool, x['is_ignored'], x), - sca_info: _atd_read_optional_field(readScaInfo, x['sca_info'], x), + sca_info: _atd_read_optional_field(readScaMatch, x['sca_info'], x), validation_state: _atd_read_optional_field(readValidationState, x['validation_state'], x), historical_info: _atd_read_optional_field(readHistoricalInfo, x['historical_info'], x), dataflow_trace: _atd_read_optional_field(readMatchDataflowTrace, x['dataflow_trace'], x), @@ -1648,27 +1649,27 @@ export function readTransitivity(x: any, context: any = x): Transitivity { } } -export function writeScaInfo(x: ScaInfo, context: any = x): any { +export function writeScaMatch(x: ScaMatch, context: any = x): any { return { - 'reachable': _atd_write_required_field('ScaInfo', 'reachable', _atd_write_bool, x.reachable, x), - 'reachability_rule': _atd_write_required_field('ScaInfo', 'reachability_rule', _atd_write_bool, x.reachability_rule, x), - 'sca_finding_schema': _atd_write_required_field('ScaInfo', 'sca_finding_schema', _atd_write_int, x.sca_finding_schema, x), - 'dependency_match': _atd_write_required_field('ScaInfo', 'dependency_match', writeDependencyMatch, x.dependency_match, x), + 'reachable': _atd_write_required_field('ScaMatch', 'reachable', _atd_write_bool, x.reachable, x), + 'reachability_rule': _atd_write_required_field('ScaMatch', 'reachability_rule', _atd_write_bool, x.reachability_rule, x), + 'sca_finding_schema': _atd_write_required_field('ScaMatch', 'sca_finding_schema', _atd_write_int, x.sca_finding_schema, x), + 'dependency_match': _atd_write_required_field('ScaMatch', 'dependency_match', writeDependencyMatch, x.dependency_match, x), }; } -export function readScaInfo(x: any, context: any = x): ScaInfo { +export function readScaMatch(x: any, context: any = x): ScaMatch { return { - reachable: _atd_read_required_field('ScaInfo', 'reachable', _atd_read_bool, x['reachable'], x), - reachability_rule: _atd_read_required_field('ScaInfo', 'reachability_rule', _atd_read_bool, x['reachability_rule'], x), - sca_finding_schema: _atd_read_required_field('ScaInfo', 'sca_finding_schema', _atd_read_int, x['sca_finding_schema'], x), - dependency_match: _atd_read_required_field('ScaInfo', 'dependency_match', readDependencyMatch, x['dependency_match'], x), + reachable: _atd_read_required_field('ScaMatch', 'reachable', _atd_read_bool, x['reachable'], x), + reachability_rule: _atd_read_required_field('ScaMatch', 'reachability_rule', _atd_read_bool, x['reachability_rule'], x), + sca_finding_schema: _atd_read_required_field('ScaMatch', 'sca_finding_schema', _atd_read_int, x['sca_finding_schema'], x), + dependency_match: _atd_read_required_field('ScaMatch', 'dependency_match', readDependencyMatch, x['dependency_match'], x), }; } export function writeDependencyMatch(x: DependencyMatch, context: any = x): any { return { - 'dependency_pattern': _atd_write_required_field('DependencyMatch', 'dependency_pattern', writeDependencyPattern, x.dependency_pattern, x), + 'dependency_pattern': _atd_write_required_field('DependencyMatch', 'dependency_pattern', writeScaPattern, x.dependency_pattern, x), 'found_dependency': _atd_write_required_field('DependencyMatch', 'found_dependency', writeFoundDependency, x.found_dependency, x), 'lockfile': _atd_write_required_field('DependencyMatch', 'lockfile', writeFpath, x.lockfile, x), }; @@ -1676,25 +1677,25 @@ export function writeDependencyMatch(x: DependencyMatch, context: any = x): any export function readDependencyMatch(x: any, context: any = x): DependencyMatch { return { - dependency_pattern: _atd_read_required_field('DependencyMatch', 'dependency_pattern', readDependencyPattern, x['dependency_pattern'], x), + dependency_pattern: _atd_read_required_field('DependencyMatch', 'dependency_pattern', readScaPattern, x['dependency_pattern'], x), found_dependency: _atd_read_required_field('DependencyMatch', 'found_dependency', readFoundDependency, x['found_dependency'], x), lockfile: _atd_read_required_field('DependencyMatch', 'lockfile', readFpath, x['lockfile'], x), }; } -export function writeDependencyPattern(x: DependencyPattern, context: any = x): any { +export function writeScaPattern(x: ScaPattern, context: any = x): any { return { - 'ecosystem': _atd_write_required_field('DependencyPattern', 'ecosystem', writeEcosystem, x.ecosystem, x), - 'package': _atd_write_required_field('DependencyPattern', 'package', _atd_write_string, x.package_, x), - 'semver_range': _atd_write_required_field('DependencyPattern', 'semver_range', _atd_write_string, x.semver_range, x), + 'ecosystem': _atd_write_required_field('ScaPattern', 'ecosystem', writeEcosystem, x.ecosystem, x), + 'package': _atd_write_required_field('ScaPattern', 'package', _atd_write_string, x.package_, x), + 'semver_range': _atd_write_required_field('ScaPattern', 'semver_range', _atd_write_string, x.semver_range, x), }; } -export function readDependencyPattern(x: any, context: any = x): DependencyPattern { +export function readScaPattern(x: any, context: any = x): ScaPattern { return { - ecosystem: _atd_read_required_field('DependencyPattern', 'ecosystem', readEcosystem, x['ecosystem'], x), - package_: _atd_read_required_field('DependencyPattern', 'package', _atd_read_string, x['package'], x), - semver_range: _atd_read_required_field('DependencyPattern', 'semver_range', _atd_read_string, x['semver_range'], x), + ecosystem: _atd_read_required_field('ScaPattern', 'ecosystem', readEcosystem, x['ecosystem'], x), + package_: _atd_read_required_field('ScaPattern', 'package', _atd_read_string, x['package'], x), + semver_range: _atd_read_required_field('ScaPattern', 'semver_range', _atd_read_string, x['semver_range'], x), }; } @@ -2909,7 +2910,7 @@ export function writeFinding(x: Finding, context: any = x): any { 'metadata': _atd_write_required_field('Finding', 'metadata', writeRawJson, x.metadata, x), 'is_blocking': _atd_write_required_field('Finding', 'is_blocking', _atd_write_bool, x.is_blocking, x), 'fixed_lines': _atd_write_optional_field(_atd_write_array(_atd_write_string), x.fixed_lines, x), - 'sca_info': _atd_write_optional_field(writeScaInfo, x.sca_info, x), + 'sca_info': _atd_write_optional_field(writeScaMatch, x.sca_info, x), 'dataflow_trace': _atd_write_optional_field(writeMatchDataflowTrace, x.dataflow_trace, x), 'validation_state': _atd_write_optional_field(writeValidationState, x.validation_state, x), 'historical_info': _atd_write_optional_field(writeHistoricalInfo, x.historical_info, x), @@ -2935,7 +2936,7 @@ export function readFinding(x: any, context: any = x): Finding { metadata: _atd_read_required_field('Finding', 'metadata', readRawJson, x['metadata'], x), is_blocking: _atd_read_required_field('Finding', 'is_blocking', _atd_read_bool, x['is_blocking'], x), fixed_lines: _atd_read_optional_field(_atd_read_array(_atd_read_string), x['fixed_lines'], x), - sca_info: _atd_read_optional_field(readScaInfo, x['sca_info'], x), + sca_info: _atd_read_optional_field(readScaMatch, x['sca_info'], x), dataflow_trace: _atd_read_optional_field(readMatchDataflowTrace, x['dataflow_trace'], x), validation_state: _atd_read_optional_field(readValidationState, x['validation_state'], x), historical_info: _atd_read_optional_field(readHistoricalInfo, x['historical_info'], x), @@ -3477,14 +3478,15 @@ export function readCoreMatch(x: any, context: any = x): CoreMatch { export function writeCoreMatchExtra(x: CoreMatchExtra, context: any = x): any { return { + 'metavars': _atd_write_required_field('CoreMatchExtra', 'metavars', writeMetavars, x.metavars, x), + 'engine_kind': _atd_write_required_field('CoreMatchExtra', 'engine_kind', writeEngineOfFinding, x.engine_kind, x), + 'is_ignored': _atd_write_required_field('CoreMatchExtra', 'is_ignored', _atd_write_bool, x.is_ignored, x), 'message': _atd_write_optional_field(_atd_write_string, x.message, x), 'metadata': _atd_write_optional_field(writeRawJson, x.metadata, x), 'severity': _atd_write_optional_field(writeMatchSeverity, x.severity, x), - 'metavars': _atd_write_required_field('CoreMatchExtra', 'metavars', writeMetavars, x.metavars, x), 'fix': _atd_write_optional_field(_atd_write_string, x.fix, x), 'dataflow_trace': _atd_write_optional_field(writeMatchDataflowTrace, x.dataflow_trace, x), - 'engine_kind': _atd_write_required_field('CoreMatchExtra', 'engine_kind', writeEngineOfFinding, x.engine_kind, x), - 'is_ignored': _atd_write_required_field('CoreMatchExtra', 'is_ignored', _atd_write_bool, x.is_ignored, x), + 'sca_match': _atd_write_optional_field(writeScaMatch, x.sca_match, x), 'validation_state': _atd_write_optional_field(writeValidationState, x.validation_state, x), 'historical_info': _atd_write_optional_field(writeHistoricalInfo, x.historical_info, x), 'extra_extra': _atd_write_optional_field(writeRawJson, x.extra_extra, x), @@ -3493,14 +3495,15 @@ export function writeCoreMatchExtra(x: CoreMatchExtra, context: any = x): any { export function readCoreMatchExtra(x: any, context: any = x): CoreMatchExtra { return { + metavars: _atd_read_required_field('CoreMatchExtra', 'metavars', readMetavars, x['metavars'], x), + engine_kind: _atd_read_required_field('CoreMatchExtra', 'engine_kind', readEngineOfFinding, x['engine_kind'], x), + is_ignored: _atd_read_required_field('CoreMatchExtra', 'is_ignored', _atd_read_bool, x['is_ignored'], x), message: _atd_read_optional_field(_atd_read_string, x['message'], x), metadata: _atd_read_optional_field(readRawJson, x['metadata'], x), severity: _atd_read_optional_field(readMatchSeverity, x['severity'], x), - metavars: _atd_read_required_field('CoreMatchExtra', 'metavars', readMetavars, x['metavars'], x), fix: _atd_read_optional_field(_atd_read_string, x['fix'], x), dataflow_trace: _atd_read_optional_field(readMatchDataflowTrace, x['dataflow_trace'], x), - engine_kind: _atd_read_required_field('CoreMatchExtra', 'engine_kind', readEngineOfFinding, x['engine_kind'], x), - is_ignored: _atd_read_required_field('CoreMatchExtra', 'is_ignored', _atd_read_bool, x['is_ignored'], x), + sca_match: _atd_read_optional_field(readScaMatch, x['sca_match'], x), validation_state: _atd_read_optional_field(readValidationState, x['validation_state'], x), historical_info: _atd_read_optional_field(readHistoricalInfo, x['historical_info'], x), extra_extra: _atd_read_optional_field(readRawJson, x['extra_extra'], x), diff --git a/semgrep_output_v1_j.ml b/semgrep_output_v1_j.ml index 9d81914..910138c 100644 --- a/semgrep_output_v1_j.ml +++ b/semgrep_output_v1_j.ml @@ -3,6 +3,13 @@ type datetime = Semgrep_output_v1_t.datetime +type dependency_child = Semgrep_output_v1_t.dependency_child = { + package: string; + version: string +} + +type ecosystem = Semgrep_output_v1_t.ecosystem [@@deriving show,eq] + type fpath = Semgrep_output_v1_t.fpath [@@deriving show, eq] type match_severity = Semgrep_output_v1_t.match_severity @@ -60,6 +67,12 @@ type raw_json = Yojson.Basic.t type rule_id = Semgrep_output_v1_t.rule_id [@@deriving show] +type sca_pattern = Semgrep_output_v1_t.sca_pattern = { + ecosystem: ecosystem; + package: string; + semver_range: string +} + type sha1 = Semgrep_output_v1_t.sha1 type historical_info = Semgrep_output_v1_t.historical_info = { @@ -83,6 +96,35 @@ type metavar_value = Semgrep_output_v1_t.metavar_value = { type metavars = Semgrep_output_v1_t.metavars +type transitivity = Semgrep_output_v1_t.transitivity [@@deriving show,eq] + +type found_dependency = Semgrep_output_v1_t.found_dependency = { + package: string; + version: string; + ecosystem: ecosystem; + allowed_hashes: (string * string list) list; + resolved_url: string option; + transitivity: transitivity; + manifest_path: fpath option; + lockfile_path: fpath option; + line_number: int option; + children: dependency_child list option; + git_ref: string option +} + +type dependency_match = Semgrep_output_v1_t.dependency_match = { + dependency_pattern: sca_pattern; + found_dependency: found_dependency; + lockfile: fpath +} + +type sca_match = Semgrep_output_v1_t.sca_match = { + reachable: bool; + reachability_rule: bool; + sca_finding_schema: int; + dependency_match: dependency_match +} + type validation_state = Semgrep_output_v1_t.validation_state [@@deriving show, eq] @@ -99,14 +141,15 @@ type match_dataflow_trace = Semgrep_output_v1_t.match_dataflow_trace = { } type core_match_extra = Semgrep_output_v1_t.core_match_extra = { + metavars: metavars; + engine_kind: engine_of_finding; + is_ignored: bool; message: string option; metadata: raw_json option; severity: match_severity option; - metavars: metavars; fix: string option; dataflow_trace: match_dataflow_trace option; - engine_kind: engine_of_finding; - is_ignored: bool; + sca_match: sca_match option; validation_state: validation_state option; historical_info: historical_info option; extra_extra: raw_json option @@ -175,8 +218,6 @@ type triage_ignored = Semgrep_output_v1_t.triage_ignored = { triage_ignored_match_based_ids: string list } -type transitivity = Semgrep_output_v1_t.transitivity [@@deriving show,eq] - type todo = Semgrep_output_v1_t.todo type matching_diagnosis = Semgrep_output_v1_t.matching_diagnosis = { @@ -262,8 +303,6 @@ type resolution_method = Semgrep_output_v1_t.resolution_method type manifest_kind = Semgrep_output_v1_t.manifest_kind [@@deriving show, eq] -type ecosystem = Semgrep_output_v1_t.ecosystem [@@deriving show,eq] - type dependency_source_file_kind = Semgrep_output_v1_t.dependency_source_file_kind [@@deriving show] @@ -450,44 +489,6 @@ type scan_config = Semgrep_output_v1_t.scan_config = { type sca_parser_name = Semgrep_output_v1_t.sca_parser_name -type dependency_child = Semgrep_output_v1_t.dependency_child = { - package: string; - version: string -} - -type found_dependency = Semgrep_output_v1_t.found_dependency = { - package: string; - version: string; - ecosystem: ecosystem; - allowed_hashes: (string * string list) list; - resolved_url: string option; - transitivity: transitivity; - manifest_path: fpath option; - lockfile_path: fpath option; - line_number: int option; - children: dependency_child list option; - git_ref: string option -} - -type dependency_pattern = Semgrep_output_v1_t.dependency_pattern = { - ecosystem: ecosystem; - package: string; - semver_range: string -} - -type dependency_match = Semgrep_output_v1_t.dependency_match = { - dependency_pattern: dependency_pattern; - found_dependency: found_dependency; - lockfile: fpath -} - -type sca_info = Semgrep_output_v1_t.sca_info = { - reachable: bool; - reachability_rule: bool; - sca_finding_schema: int; - dependency_match: dependency_match -} - type sarif_format_return = Semgrep_output_v1_t.sarif_format_return = { output: string; format_time_seconds: float @@ -565,7 +566,7 @@ type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { fingerprint: string; lines: string; is_ignored: bool option; - sca_info: sca_info option; + sca_info: sca_match option; validation_state: validation_state option; historical_info: historical_info option; dataflow_trace: match_dataflow_trace option; @@ -649,7 +650,7 @@ type finding = Semgrep_output_v1_t.finding = { metadata: raw_json; is_blocking: bool; fixed_lines: string list option; - sca_info: sca_info option; + sca_info: sca_match option; dataflow_trace: match_dataflow_trace option; validation_state: validation_state option; historical_info: historical_info option; @@ -889,6 +890,79 @@ type ci_scan_complete_response = } [@@deriving show] +let write__int_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + Yojson.Safe.write_int + ) +) +let string_of__int_option ?(len = 1024) x = + let ob = Buffer.create len in + write__int_option ob x; + Buffer.contents ob +let read__int_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_int + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_int + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _int_option_of_string s = + read__int_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__string_list = ( + Atdgen_runtime.Oj_run.write_list ( + Yojson.Safe.write_string + ) +) +let string_of__string_list ?(len = 1024) x = + let ob = Buffer.create len in + write__string_list ob x; + Buffer.contents ob +let read__string_list = ( + Atdgen_runtime.Oj_run.read_list ( + Atdgen_runtime.Oj_run.read_string + ) +) +let _string_list_of_string s = + read__string_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__string_option = ( Atdgen_runtime.Oj_run.write_std_option ( Yojson.Safe.write_string @@ -1003,6 +1077,26 @@ let read__x_93e0d04 = ( ) let _x_93e0d04_of_string s = read__x_93e0d04 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_b85b97f = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write__string_list + ) +) +let string_of__x_b85b97f ?(len = 1024) x = + let ob = Buffer.create len in + write__x_b85b97f ob x; + Buffer.contents ob +let read__x_b85b97f = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read__string_list + ) +) +let _x_b85b97f_of_string s = + read__x_b85b97f (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__x_f9d958d = ( fun ob x -> ( let x = ( ATD_string_wrap.Sha1.unwrap ) x in ( @@ -1034,121 +1128,195 @@ let read_datetime = ( ) let datetime_of_string s = read_datetime (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_fpath = ( - write__x_45497b3 -) -let string_of_fpath ?(len = 1024) x = - let ob = Buffer.create len in - write_fpath ob x; - Buffer.contents ob -let read_fpath = ( - read__x_45497b3 -) -let fpath_of_string s = - read_fpath (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_match_severity = ( - fun ob x -> - match x with - | `Error -> Buffer.add_string ob "\"ERROR\"" - | `Warning -> Buffer.add_string ob "\"WARNING\"" - | `Experiment -> Buffer.add_string ob "\"EXPERIMENT\"" - | `Inventory -> Buffer.add_string ob "\"INVENTORY\"" - | `Critical -> Buffer.add_string ob "\"CRITICAL\"" - | `High -> Buffer.add_string ob "\"HIGH\"" - | `Medium -> Buffer.add_string ob "\"MEDIUM\"" - | `Low -> Buffer.add_string ob "\"LOW\"" - | `Info -> Buffer.add_string ob "\"INFO\"" +let write_dependency_child : _ -> dependency_child -> _ = ( + fun ob (x : dependency_child) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"package\":"; + ( + Yojson.Safe.write_string + ) + ob x.package; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"version\":"; + ( + Yojson.Safe.write_string + ) + ob x.version; + Buffer.add_char ob '}'; ) -let string_of_match_severity ?(len = 1024) x = +let string_of_dependency_child ?(len = 1024) x = let ob = Buffer.create len in - write_match_severity ob x; + write_dependency_child ob x; Buffer.contents ob -let read_match_severity = ( +let read_dependency_child = ( fun p lb -> Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ERROR" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Error - | "WARNING" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Warning - | "EXPERIMENT" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Experiment - | "INVENTORY" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Inventory - | "CRITICAL" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Critical - | "HIGH" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `High - | "MEDIUM" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Medium - | "LOW" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Low - | "INFO" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Info - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "ERROR" -> - `Error - | "WARNING" -> - `Warning - | "EXPERIMENT" -> - `Experiment - | "INVENTORY" -> - `Inventory - | "CRITICAL" -> - `Critical - | "HIGH" -> - `High - | "MEDIUM" -> - `Medium - | "LOW" -> - `Low - | "INFO" -> - `Info - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + Yojson.Safe.read_lcurl p lb; + let field_package = ref (None) in + let field_version = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 7 then ( + match String.unsafe_get s pos with + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_package := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 1 -> + field_version := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 7 then ( + match String.unsafe_get s pos with + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_package := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 1 -> + field_version := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); + version = (match !field_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "version"); + } + : dependency_child) + ) ) -let match_severity_of_string s = - read_match_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__match_severity_option = ( +let dependency_child_of_string s = + read_dependency_child (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_child_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_dependency_child + ) +) +let string_of__dependency_child_list ?(len = 1024) x = + let ob = Buffer.create len in + write__dependency_child_list ob x; + Buffer.contents ob +let read__dependency_child_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_dependency_child + ) +) +let _dependency_child_list_of_string s = + read__dependency_child_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_child_list_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_match_severity + write__dependency_child_list ) ) -let string_of__match_severity_option ?(len = 1024) x = +let string_of__dependency_child_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__match_severity_option ob x; + write__dependency_child_list_option ob x; Buffer.contents ob -let read__match_severity_option = ( +let read__dependency_child_list_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -1161,7 +1329,7 @@ let read__match_severity_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_match_severity + read__dependency_child_list ) p lb in Yojson.Safe.read_space p lb; @@ -1184,7 +1352,7 @@ let read__match_severity_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_match_severity + read__dependency_child_list ) p lb in Yojson.Safe.read_space p lb; @@ -1194,373 +1362,294 @@ let read__match_severity_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _match_severity_option_of_string s = - read__match_severity_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_matching_operation : _ -> matching_operation -> _ = ( - fun ob (x : matching_operation) -> +let _dependency_child_list_option_of_string s = + read__dependency_child_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ecosystem = ( + fun ob x -> match x with - | And -> Buffer.add_string ob "\"And\"" - | Or -> Buffer.add_string ob "\"Or\"" - | Inside -> Buffer.add_string ob "\"Inside\"" - | Anywhere -> Buffer.add_string ob "\"Anywhere\"" - | XPat x -> - Buffer.add_string ob "[\"XPat\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | Negation -> Buffer.add_string ob "\"Negation\"" - | Filter x -> - Buffer.add_string ob "[\"Filter\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | Taint -> Buffer.add_string ob "\"Taint\"" - | TaintSource -> Buffer.add_string ob "\"TaintSource\"" - | TaintSink -> Buffer.add_string ob "\"TaintSink\"" - | TaintSanitizer -> Buffer.add_string ob "\"TaintSanitizer\"" - | EllipsisAndStmts -> Buffer.add_string ob "\"EllipsisAndStmts\"" - | ClassHeaderAndElems -> Buffer.add_string ob "\"ClassHeaderAndElems\"" + | `Npm -> Buffer.add_string ob "\"npm\"" + | `Pypi -> Buffer.add_string ob "\"pypi\"" + | `Gem -> Buffer.add_string ob "\"gem\"" + | `Gomod -> Buffer.add_string ob "\"gomod\"" + | `Cargo -> Buffer.add_string ob "\"cargo\"" + | `Maven -> Buffer.add_string ob "\"maven\"" + | `Composer -> Buffer.add_string ob "\"composer\"" + | `Nuget -> Buffer.add_string ob "\"nuget\"" + | `Pub -> Buffer.add_string ob "\"pub\"" + | `SwiftPM -> Buffer.add_string ob "\"swiftpm\"" + | `Mix -> Buffer.add_string ob "\"mix\"" + | `Hex -> Buffer.add_string ob "\"hex\"" ) -let string_of_matching_operation ?(len = 1024) x = +let string_of_ecosystem ?(len = 1024) x = let ob = Buffer.create len in - write_matching_operation ob x; + write_ecosystem ob x; Buffer.contents ob -let read_matching_operation = ( +let read_ecosystem = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "And" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (And : matching_operation) - | "Or" -> + | "npm" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Or : matching_operation) - | "Inside" -> + `Npm + | "pypi" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Inside : matching_operation) - | "Anywhere" -> + `Pypi + | "gem" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Anywhere : matching_operation) - | "XPat" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in + `Gem + | "gomod" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (XPat x : matching_operation) - | "Negation" -> + `Gomod + | "cargo" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Negation : matching_operation) - | "Filter" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in + `Cargo + | "maven" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Filter x : matching_operation) - | "Taint" -> + `Maven + | "composer" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Taint : matching_operation) - | "TaintSource" -> + `Composer + | "nuget" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (TaintSource : matching_operation) - | "TaintSink" -> + `Nuget + | "pub" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (TaintSink : matching_operation) - | "TaintSanitizer" -> + `Pub + | "swiftpm" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (TaintSanitizer : matching_operation) - | "EllipsisAndStmts" -> + `SwiftPM + | "mix" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (EllipsisAndStmts : matching_operation) - | "ClassHeaderAndElems" -> + `Mix + | "hex" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (ClassHeaderAndElems : matching_operation) + `Hex | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "And" -> - (And : matching_operation) - | "Or" -> - (Or : matching_operation) - | "Inside" -> - (Inside : matching_operation) - | "Anywhere" -> - (Anywhere : matching_operation) - | "Negation" -> - (Negation : matching_operation) - | "Taint" -> - (Taint : matching_operation) - | "TaintSource" -> - (TaintSource : matching_operation) - | "TaintSink" -> - (TaintSink : matching_operation) - | "TaintSanitizer" -> - (TaintSanitizer : matching_operation) - | "EllipsisAndStmts" -> - (EllipsisAndStmts : matching_operation) - | "ClassHeaderAndElems" -> - (ClassHeaderAndElems : matching_operation) + | "npm" -> + `Npm + | "pypi" -> + `Pypi + | "gem" -> + `Gem + | "gomod" -> + `Gomod + | "cargo" -> + `Cargo + | "maven" -> + `Maven + | "composer" -> + `Composer + | "nuget" -> + `Nuget + | "pub" -> + `Pub + | "swiftpm" -> + `SwiftPM + | "mix" -> + `Mix + | "hex" -> + `Hex | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "XPat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let ecosystem_of_string s = + read_ecosystem (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_fpath = ( + write__x_45497b3 +) +let string_of_fpath ?(len = 1024) x = + let ob = Buffer.create len in + write_fpath ob x; + Buffer.contents ob +let read_fpath = ( + read__x_45497b3 +) +let fpath_of_string s = + read_fpath (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__fpath_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_fpath + ) +) +let string_of__fpath_option ?(len = 1024) x = + let ob = Buffer.create len in + write__fpath_option ob x; + Buffer.contents ob +let read__fpath_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + read_fpath ) p lb in Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (XPat x : matching_operation) - | "Filter" -> + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_string + read_fpath ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Filter x : matching_operation) + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let matching_operation_of_string s = - read_matching_operation (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_position : _ -> position -> _ = ( - fun ob (x : position) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"line\":"; - ( - Yojson.Safe.write_int - ) - ob x.line; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"col\":"; - ( - Yojson.Safe.write_int - ) - ob x.col; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"offset\":"; - ( - Yojson.Safe.write_int - ) - ob x.offset; - Buffer.add_char ob '}'; +let _fpath_option_of_string s = + read__fpath_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_match_severity = ( + fun ob x -> + match x with + | `Error -> Buffer.add_string ob "\"ERROR\"" + | `Warning -> Buffer.add_string ob "\"WARNING\"" + | `Experiment -> Buffer.add_string ob "\"EXPERIMENT\"" + | `Inventory -> Buffer.add_string ob "\"INVENTORY\"" + | `Critical -> Buffer.add_string ob "\"CRITICAL\"" + | `High -> Buffer.add_string ob "\"HIGH\"" + | `Medium -> Buffer.add_string ob "\"MEDIUM\"" + | `Low -> Buffer.add_string ob "\"LOW\"" + | `Info -> Buffer.add_string ob "\"INFO\"" ) -let string_of_position ?(len = 1024) x = +let string_of_match_severity ?(len = 1024) x = let ob = Buffer.create len in - write_position ob x; + write_match_severity ob x; Buffer.contents ob -let read_position = ( +let read_match_severity = ( fun p lb -> Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_line = ref (None) in - let field_col = ref (None) in - let field_offset = ref (0) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'f' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_col := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_offset := ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'f' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_col := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_offset := ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); - col = (match !field_col with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "col"); - offset = !field_offset; - } - : position) - ) + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "ERROR" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Error + | "WARNING" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Warning + | "EXPERIMENT" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Experiment + | "INVENTORY" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Inventory + | "CRITICAL" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Critical + | "HIGH" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `High + | "MEDIUM" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Medium + | "LOW" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Low + | "INFO" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Info + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "ERROR" -> + `Error + | "WARNING" -> + `Warning + | "EXPERIMENT" -> + `Experiment + | "INVENTORY" -> + `Inventory + | "CRITICAL" -> + `Critical + | "HIGH" -> + `High + | "MEDIUM" -> + `Medium + | "LOW" -> + `Low + | "INFO" -> + `Info + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let position_of_string s = - read_position (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__position_option = ( +let match_severity_of_string s = + read_match_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__match_severity_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_position + write_match_severity ) ) -let string_of__position_option ?(len = 1024) x = +let string_of__match_severity_option ?(len = 1024) x = let ob = Buffer.create len in - write__position_option ob x; + write__match_severity_option ob x; Buffer.contents ob -let read__position_option = ( +let read__match_severity_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -1573,7 +1662,7 @@ let read__position_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_position + read_match_severity ) p lb in Yojson.Safe.read_space p lb; @@ -1596,7 +1685,7 @@ let read__position_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_position + read_match_severity ) p lb in Yojson.Safe.read_space p lb; @@ -1606,52 +1695,211 @@ let read__position_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _position_option_of_string s = - read__position_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_location : _ -> location -> _ = ( - fun ob (x : location) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x.path; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"start\":"; - ( - write_position - ) - ob x.start; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"end\":"; - ( - write_position - ) - ob x.end_; - Buffer.add_char ob '}'; -) -let string_of_location ?(len = 1024) x = - let ob = Buffer.create len in - write_location ob x; - Buffer.contents ob -let read_location = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_path = ref (None) in - let field_start = ref (None) in - let field_end_ = ref (None) in +let _match_severity_option_of_string s = + read__match_severity_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_matching_operation : _ -> matching_operation -> _ = ( + fun ob (x : matching_operation) -> + match x with + | And -> Buffer.add_string ob "\"And\"" + | Or -> Buffer.add_string ob "\"Or\"" + | Inside -> Buffer.add_string ob "\"Inside\"" + | Anywhere -> Buffer.add_string ob "\"Anywhere\"" + | XPat x -> + Buffer.add_string ob "[\"XPat\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | Negation -> Buffer.add_string ob "\"Negation\"" + | Filter x -> + Buffer.add_string ob "[\"Filter\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | Taint -> Buffer.add_string ob "\"Taint\"" + | TaintSource -> Buffer.add_string ob "\"TaintSource\"" + | TaintSink -> Buffer.add_string ob "\"TaintSink\"" + | TaintSanitizer -> Buffer.add_string ob "\"TaintSanitizer\"" + | EllipsisAndStmts -> Buffer.add_string ob "\"EllipsisAndStmts\"" + | ClassHeaderAndElems -> Buffer.add_string ob "\"ClassHeaderAndElems\"" +) +let string_of_matching_operation ?(len = 1024) x = + let ob = Buffer.create len in + write_matching_operation ob x; + Buffer.contents ob +let read_matching_operation = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "And" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (And : matching_operation) + | "Or" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Or : matching_operation) + | "Inside" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Inside : matching_operation) + | "Anywhere" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Anywhere : matching_operation) + | "XPat" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (XPat x : matching_operation) + | "Negation" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Negation : matching_operation) + | "Filter" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Filter x : matching_operation) + | "Taint" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Taint : matching_operation) + | "TaintSource" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TaintSource : matching_operation) + | "TaintSink" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TaintSink : matching_operation) + | "TaintSanitizer" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TaintSanitizer : matching_operation) + | "EllipsisAndStmts" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (EllipsisAndStmts : matching_operation) + | "ClassHeaderAndElems" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (ClassHeaderAndElems : matching_operation) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "And" -> + (And : matching_operation) + | "Or" -> + (Or : matching_operation) + | "Inside" -> + (Inside : matching_operation) + | "Anywhere" -> + (Anywhere : matching_operation) + | "Negation" -> + (Negation : matching_operation) + | "Taint" -> + (Taint : matching_operation) + | "TaintSource" -> + (TaintSource : matching_operation) + | "TaintSink" -> + (TaintSink : matching_operation) + | "TaintSanitizer" -> + (TaintSanitizer : matching_operation) + | "EllipsisAndStmts" -> + (EllipsisAndStmts : matching_operation) + | "ClassHeaderAndElems" -> + (ClassHeaderAndElems : matching_operation) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "XPat" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (XPat x : matching_operation) + | "Filter" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Filter x : matching_operation) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let matching_operation_of_string s = + read_matching_operation (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_position : _ -> position -> _ = ( + fun ob (x : position) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"line\":"; + ( + Yojson.Safe.write_int + ) + ob x.line; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"col\":"; + ( + Yojson.Safe.write_int + ) + ob x.col; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"offset\":"; + ( + Yojson.Safe.write_int + ) + ob x.offset; + Buffer.add_char ob '}'; +) +let string_of_position ?(len = 1024) x = + let ob = Buffer.create len in + write_position ob x; + Buffer.contents ob +let read_position = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_line = ref (None) in + let field_col = ref (None) in + let field_offset = ref (0) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -1662,24 +1910,24 @@ let read_location = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 2 + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' then ( + 1 ) else ( -1 ) ) | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 1 + | 6 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'f' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( + 2 ) else ( -1 @@ -1694,29 +1942,29 @@ let read_location = ( ( match i with | 0 -> - field_path := ( + field_line := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_start := ( + field_col := ( Some ( ( - read_position + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_end_ := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_offset := ( ( - read_position + Atdgen_runtime.Oj_run.read_int ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -1731,24 +1979,24 @@ let read_location = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 2 + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' then ( + 1 ) else ( -1 ) ) | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 1 + | 6 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'f' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( + 2 ) else ( -1 @@ -1763,18 +2011,271 @@ let read_location = ( ( match i with | 0 -> - field_path := ( + field_line := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_start := ( + field_col := ( Some ( ( - read_position + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_offset := ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); + col = (match !field_col with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "col"); + offset = !field_offset; + } + : position) + ) +) +let position_of_string s = + read_position (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__position_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_position + ) +) +let string_of__position_option ?(len = 1024) x = + let ob = Buffer.create len in + write__position_option ob x; + Buffer.contents ob +let read__position_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_position + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_position + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _position_option_of_string s = + read__position_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_location : _ -> location -> _ = ( + fun ob (x : location) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path\":"; + ( + write_fpath + ) + ob x.path; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"start\":"; + ( + write_position + ) + ob x.start; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"end\":"; + ( + write_position + ) + ob x.end_; + Buffer.add_char ob '}'; +) +let string_of_location ?(len = 1024) x = + let ob = Buffer.create len in + write_location ob x; + Buffer.contents ob +let read_location = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_path = ref (None) in + let field_start = ref (None) in + let field_end_ = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 2 + ) + else ( + -1 + ) + ) + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 0 + ) + else ( + -1 + ) + ) + | 5 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 1 -> + field_start := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 2 -> + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 2 + ) + else ( + -1 + ) + ) + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 0 + ) + else ( + -1 + ) + ) + | 5 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 1 -> + field_start := ( + Some ( + ( + read_position ) p lb ) ); @@ -2465,8 +2966,204 @@ let read_rule_id = ( ) let rule_id_of_string s = read_rule_id (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sha1 = ( - write__x_f9d958d +let write_sca_pattern : _ -> sca_pattern -> _ = ( + fun ob (x : sca_pattern) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ecosystem\":"; + ( + write_ecosystem + ) + ob x.ecosystem; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"package\":"; + ( + Yojson.Safe.write_string + ) + ob x.package; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"semver_range\":"; + ( + Yojson.Safe.write_string + ) + ob x.semver_range; + Buffer.add_char ob '}'; +) +let string_of_sca_pattern ?(len = 1024) x = + let ob = Buffer.create len in + write_sca_pattern ob x; + Buffer.contents ob +let read_sca_pattern = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_ecosystem = ref (None) in + let field_package = ref (None) in + let field_semver_range = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 1 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 0 + ) + else ( + -1 + ) + ) + | 12 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = 'e' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); + | 1 -> + field_package := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_semver_range := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 1 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 0 + ) + else ( + -1 + ) + ) + | 12 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = 'e' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); + | 1 -> + field_package := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_semver_range := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); + package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); + semver_range = (match !field_semver_range with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "semver_range"); + } + : sca_pattern) + ) +) +let sca_pattern_of_string s = + read_sca_pattern (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_sha1 = ( + write__x_f9d958d ) let string_of_sha1 ?(len = 1024) x = let ob = Buffer.create len in @@ -3347,53 +4044,46 @@ let read_metavars = ( ) let metavars_of_string s = read_metavars (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_validation_state = ( +let write_transitivity = ( fun ob x -> match x with - | `Confirmed_valid -> Buffer.add_string ob "\"CONFIRMED_VALID\"" - | `Confirmed_invalid -> Buffer.add_string ob "\"CONFIRMED_INVALID\"" - | `Validation_error -> Buffer.add_string ob "\"VALIDATION_ERROR\"" - | `No_validator -> Buffer.add_string ob "\"NO_VALIDATOR\"" + | `Direct -> Buffer.add_string ob "\"direct\"" + | `Transitive -> Buffer.add_string ob "\"transitive\"" + | `Unknown -> Buffer.add_string ob "\"unknown\"" ) -let string_of_validation_state ?(len = 1024) x = +let string_of_transitivity ?(len = 1024) x = let ob = Buffer.create len in - write_validation_state ob x; + write_transitivity ob x; Buffer.contents ob -let read_validation_state = ( +let read_transitivity = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "CONFIRMED_VALID" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Confirmed_valid - | "CONFIRMED_INVALID" -> + | "direct" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Confirmed_invalid - | "VALIDATION_ERROR" -> + `Direct + | "transitive" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Validation_error - | "NO_VALIDATOR" -> + `Transitive + | "unknown" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `No_validator + `Unknown | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "CONFIRMED_VALID" -> - `Confirmed_valid - | "CONFIRMED_INVALID" -> - `Confirmed_invalid - | "VALIDATION_ERROR" -> - `Validation_error - | "NO_VALIDATOR" -> - `No_validator + | "direct" -> + `Direct + | "transitive" -> + `Transitive + | "unknown" -> + `Unknown | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) @@ -3403,2502 +4093,144 @@ let read_validation_state = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let validation_state_of_string s = - read_validation_state (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__validation_state_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_validation_state - ) -) -let string_of__validation_state_option ?(len = 1024) x = - let ob = Buffer.create len in - write__validation_state_option ob x; - Buffer.contents ob -let read__validation_state_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_validation_state - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_validation_state - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _validation_state_option_of_string s = - read__validation_state_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let rec write_match_call_trace : _ -> match_call_trace -> _ = ( - fun ob (x : match_call_trace) -> - match x with - | CliLoc x -> - Buffer.add_string ob "[\"CliLoc\","; - ( - write_loc_and_content - ) ob x; - Buffer.add_char ob ']' - | CliCall x -> - Buffer.add_string ob "[\"CliCall\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_loc_and_content - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__match_intermediate_var_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_match_call_trace - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_match_call_trace ?(len = 1024) x = - let ob = Buffer.create len in - write_match_call_trace ob x; - Buffer.contents ob -let rec read_match_call_trace = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "CliLoc" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_loc_and_content - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (CliLoc x : match_call_trace) - | "CliCall" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_loc_and_content - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__match_intermediate_var_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_match_call_trace - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (CliCall x : match_call_trace) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "CliLoc" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_loc_and_content - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (CliLoc x : match_call_trace) - | "CliCall" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_loc_and_content - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__match_intermediate_var_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_match_call_trace - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (CliCall x : match_call_trace) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and match_call_trace_of_string s = - read_match_call_trace (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__match_call_trace_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_match_call_trace - ) -) -let string_of__match_call_trace_option ?(len = 1024) x = - let ob = Buffer.create len in - write__match_call_trace_option ob x; - Buffer.contents ob -let read__match_call_trace_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_match_call_trace - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_match_call_trace - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _match_call_trace_option_of_string s = - read__match_call_trace_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_match_dataflow_trace : _ -> match_dataflow_trace -> _ = ( - fun ob (x : match_dataflow_trace) -> - Buffer.add_char ob '{'; - let is_first = ref true in - (match x.taint_source with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"taint_source\":"; - ( - write_match_call_trace - ) - ob x; - ); - (match x.intermediate_vars with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"intermediate_vars\":"; - ( - write__match_intermediate_var_list - ) - ob x; - ); - (match x.taint_sink with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"taint_sink\":"; - ( - write_match_call_trace - ) - ob x; - ); - Buffer.add_char ob '}'; -) -let string_of_match_dataflow_trace ?(len = 1024) x = - let ob = Buffer.create len in - write_match_dataflow_trace ob x; - Buffer.contents ob -let read_match_dataflow_trace = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_taint_source = ref (None) in - let field_intermediate_vars = ref (None) in - let field_taint_sink = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 10 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'k' then ( - 2 - ) - else ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'v' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_taint_source := ( - Some ( - ( - read_match_call_trace - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_intermediate_vars := ( - Some ( - ( - read__match_intermediate_var_list - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_taint_sink := ( - Some ( - ( - read_match_call_trace - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 10 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'k' then ( - 2 - ) - else ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'v' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_taint_source := ( - Some ( - ( - read_match_call_trace - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_intermediate_vars := ( - Some ( - ( - read__match_intermediate_var_list - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_taint_sink := ( - Some ( - ( - read_match_call_trace - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - taint_source = !field_taint_source; - intermediate_vars = !field_intermediate_vars; - taint_sink = !field_taint_sink; - } - : match_dataflow_trace) - ) -) -let match_dataflow_trace_of_string s = - read_match_dataflow_trace (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__match_dataflow_trace_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_match_dataflow_trace - ) -) -let string_of__match_dataflow_trace_option ?(len = 1024) x = - let ob = Buffer.create len in - write__match_dataflow_trace_option ob x; - Buffer.contents ob -let read__match_dataflow_trace_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_match_dataflow_trace - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_match_dataflow_trace - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _match_dataflow_trace_option_of_string s = - read__match_dataflow_trace_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_core_match_extra : _ -> core_match_extra -> _ = ( - fun ob (x : core_match_extra) -> - Buffer.add_char ob '{'; - let is_first = ref true in - (match x.message with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.metadata with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metadata\":"; - ( - write_raw_json - ) - ob x; - ); - (match x.severity with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"severity\":"; - ( - write_match_severity - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metavars\":"; - ( - write_metavars - ) - ob x.metavars; - (match x.fix with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fix\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.dataflow_trace with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dataflow_trace\":"; - ( - write_match_dataflow_trace - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_kind\":"; - ( - write_engine_of_finding - ) - ob x.engine_kind; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"is_ignored\":"; - ( - Yojson.Safe.write_bool - ) - ob x.is_ignored; - (match x.validation_state with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"validation_state\":"; - ( - write_validation_state - ) - ob x; - ); - (match x.historical_info with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"historical_info\":"; - ( - write_historical_info - ) - ob x; - ); - (match x.extra_extra with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"extra_extra\":"; - ( - write_raw_json - ) - ob x; - ); - Buffer.add_char ob '}'; -) -let string_of_core_match_extra ?(len = 1024) x = - let ob = Buffer.create len in - write_core_match_extra ob x; - Buffer.contents ob -let read_core_match_extra = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_message = ref (None) in - let field_metadata = ref (None) in - let field_severity = ref (None) in - let field_metavars = ref (None) in - let field_fix = ref (None) in - let field_dataflow_trace = ref (None) in - let field_engine_kind = ref (None) in - let field_is_ignored = ref (None) in - let field_validation_state = ref (None) in - let field_historical_info = ref (None) in - let field_extra_extra = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( - 4 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - match String.unsafe_get s (pos+4) with - | 'd' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( - 1 - ) - else ( - -1 - ) - ) - | 'v' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( - 7 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'e' then ( - match String.unsafe_get s (pos+1) with - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( - 10 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( - 5 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metadata := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_severity := ( - Some ( - ( - read_match_severity - ) p lb - ) - ); - ) - | 3 -> - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( - Some ( - ( - read_match_dataflow_trace - ) p lb - ) - ); - ) - | 6 -> - field_engine_kind := ( - Some ( - ( - read_engine_of_finding - ) p lb - ) - ); - | 7 -> - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( - Some ( - ( - read_validation_state - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( - Some ( - ( - read_historical_info - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra_extra := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( - 4 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - match String.unsafe_get s (pos+4) with - | 'd' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( - 1 - ) - else ( - -1 - ) - ) - | 'v' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( - 7 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'e' then ( - match String.unsafe_get s (pos+1) with - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( - 10 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( - 5 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metadata := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_severity := ( - Some ( - ( - read_match_severity - ) p lb - ) - ); - ) - | 3 -> - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( - Some ( - ( - read_match_dataflow_trace - ) p lb - ) - ); - ) - | 6 -> - field_engine_kind := ( - Some ( - ( - read_engine_of_finding - ) p lb - ) - ); - | 7 -> - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( - Some ( - ( - read_validation_state - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( - Some ( - ( - read_historical_info - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra_extra := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - message = !field_message; - metadata = !field_metadata; - severity = !field_severity; - metavars = (match !field_metavars with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metavars"); - fix = !field_fix; - dataflow_trace = !field_dataflow_trace; - engine_kind = (match !field_engine_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_kind"); - is_ignored = (match !field_is_ignored with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_ignored"); - validation_state = !field_validation_state; - historical_info = !field_historical_info; - extra_extra = !field_extra_extra; - } - : core_match_extra) - ) -) -let core_match_extra_of_string s = - read_core_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_core_match : _ -> core_match -> _ = ( - fun ob (x : core_match) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"check_id\":"; - ( - write_rule_id - ) - ob x.check_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x.path; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"start\":"; - ( - write_position - ) - ob x.start; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"end\":"; - ( - write_position - ) - ob x.end_; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"extra\":"; - ( - write_core_match_extra - ) - ob x.extra; - Buffer.add_char ob '}'; -) -let string_of_core_match ?(len = 1024) x = - let ob = Buffer.create len in - write_core_match ob x; - Buffer.contents ob -let read_core_match = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_check_id = ref (None) in - let field_path = ref (None) in - let field_start = ref (None) in - let field_end_ = ref (None) in - let field_extra = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 3 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) - ) - | 5 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_check_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - | 1 -> - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | 2 -> - field_start := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 4 -> - field_extra := ( - Some ( - ( - read_core_match_extra - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 3 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) - ) - | 5 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_check_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - | 1 -> - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | 2 -> - field_start := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 4 -> - field_extra := ( - Some ( - ( - read_core_match_extra - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - check_id = (match !field_check_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "check_id"); - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); - start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); - end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); - extra = (match !field_extra with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "extra"); - } - : core_match) - ) -) -let core_match_of_string s = - read_core_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__core_match_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_core_match - ) -) -let string_of__core_match_list ?(len = 1024) x = - let ob = Buffer.create len in - write__core_match_list ob x; - Buffer.contents ob -let read__core_match_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_core_match - ) -) -let _core_match_list_of_string s = - read__core_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__core_match_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__core_match_list - ) -) -let string_of__core_match_list_option ?(len = 1024) x = - let ob = Buffer.create len in - write__core_match_list_option ob x; - Buffer.contents ob -let read__core_match_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__core_match_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__core_match_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _core_match_list_option_of_string s = - read__core_match_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_matching_explanation_extra : _ -> matching_explanation_extra -> _ = ( - fun ob (x : matching_explanation_extra) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"before_negation_matches\":"; - ( - write__core_match_list_option - ) - ob x.before_negation_matches; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"before_filter_matches\":"; - ( - write__core_match_list_option - ) - ob x.before_filter_matches; - Buffer.add_char ob '}'; -) -let string_of_matching_explanation_extra ?(len = 1024) x = - let ob = Buffer.create len in - write_matching_explanation_extra ob x; - Buffer.contents ob -let read_matching_explanation_extra = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_before_negation_matches = ref (None) in - let field_before_filter_matches = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 21 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 23 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'h' && String.unsafe_get s (pos+21) = 'e' && String.unsafe_get s (pos+22) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_before_negation_matches := ( - Some ( - ( - read__core_match_list_option - ) p lb - ) - ); - | 1 -> - field_before_filter_matches := ( - Some ( - ( - read__core_match_list_option - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 21 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 23 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'h' && String.unsafe_get s (pos+21) = 'e' && String.unsafe_get s (pos+22) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_before_negation_matches := ( - Some ( - ( - read__core_match_list_option - ) p lb - ) - ); - | 1 -> - field_before_filter_matches := ( - Some ( - ( - read__core_match_list_option - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - before_negation_matches = (match !field_before_negation_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "before_negation_matches"); - before_filter_matches = (match !field_before_filter_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "before_filter_matches"); - } - : matching_explanation_extra) - ) -) -let matching_explanation_extra_of_string s = - read_matching_explanation_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__matching_explanation_extra_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_matching_explanation_extra - ) -) -let string_of__matching_explanation_extra_option ?(len = 1024) x = - let ob = Buffer.create len in - write__matching_explanation_extra_option ob x; - Buffer.contents ob -let read__matching_explanation_extra_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_matching_explanation_extra - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_matching_explanation_extra - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _matching_explanation_extra_option_of_string s = - read__matching_explanation_extra_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let rec write__matching_explanation_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_matching_explanation - ) -) ob x -and string_of__matching_explanation_list ?(len = 1024) x = - let ob = Buffer.create len in - write__matching_explanation_list ob x; - Buffer.contents ob -and write_matching_explanation : _ -> matching_explanation -> _ = ( - fun ob (x : matching_explanation) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"op\":"; - ( - write_matching_operation - ) - ob x.op; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"children\":"; - ( - write__matching_explanation_list - ) - ob x.children; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"matches\":"; - ( - write__core_match_list - ) - ob x.matches; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"loc\":"; - ( - write_location - ) - ob x.loc; - (match x.extra with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"extra\":"; - ( - write_matching_explanation_extra - ) - ob x; - ); - Buffer.add_char ob '}'; -) -and string_of_matching_explanation ?(len = 1024) x = - let ob = Buffer.create len in - write_matching_explanation ob x; - Buffer.contents ob -let rec read__matching_explanation_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_matching_explanation - ) -) p lb -and _matching_explanation_list_of_string s = - read__matching_explanation_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_matching_explanation = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_op = ref (None) in - let field_children = ref (None) in - let field_matches = ref (None) in - let field_loc = ref (None) in - let field_extra = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 2 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'p' then ( - 0 - ) - else ( - -1 - ) - ) - | 3 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' then ( - 3 - ) - else ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_op := ( - Some ( - ( - read_matching_operation - ) p lb - ) - ); - | 1 -> - field_children := ( - Some ( - ( - read__matching_explanation_list - ) p lb - ) - ); - | 2 -> - field_matches := ( - Some ( - ( - read__core_match_list - ) p lb - ) - ); - | 3 -> - field_loc := ( - Some ( - ( - read_location - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra := ( - Some ( - ( - read_matching_explanation_extra - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 2 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'p' then ( - 0 - ) - else ( - -1 - ) - ) - | 3 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' then ( - 3 - ) - else ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_op := ( - Some ( - ( - read_matching_operation - ) p lb - ) - ); - | 1 -> - field_children := ( - Some ( - ( - read__matching_explanation_list - ) p lb - ) - ); - | 2 -> - field_matches := ( - Some ( - ( - read__core_match_list - ) p lb - ) - ); - | 3 -> - field_loc := ( - Some ( - ( - read_location - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra := ( - Some ( - ( - read_matching_explanation_extra - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - op = (match !field_op with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "op"); - children = (match !field_children with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "children"); - matches = (match !field_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matches"); - loc = (match !field_loc with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "loc"); - extra = !field_extra; - } - : matching_explanation) - ) -) -and matching_explanation_of_string s = - read_matching_explanation (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_893d00a = ( - fun ob x -> ( - let x = ( Xlang.unwrap ) x in ( - Yojson.Safe.write_string - ) ob x) -) -let string_of__x_893d00a ?(len = 1024) x = - let ob = Buffer.create len in - write__x_893d00a ob x; - Buffer.contents ob -let read__x_893d00a = ( - fun p lb -> - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb in - ( Xlang.wrap ) x -) -let _x_893d00a_of_string s = - read__x_893d00a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_xlang = ( - write__x_893d00a -) -let string_of_xlang ?(len = 1024) x = - let ob = Buffer.create len in - write_xlang ob x; - Buffer.contents ob -let read_xlang = ( - read__x_893d00a -) -let xlang_of_string s = - read_xlang (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_version = ( - Yojson.Safe.write_string -) -let string_of_version ?(len = 1024) x = - let ob = Buffer.create len in - write_version ob x; - Buffer.contents ob -let read_version = ( - Atdgen_runtime.Oj_run.read_string -) -let version_of_string s = - read_version (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_cb4d315 = ( - fun ob x -> ( - let x = ( ATD_string_wrap.Uuidm.unwrap ) x in ( - Yojson.Safe.write_string - ) ob x) -) -let string_of__x_cb4d315 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_cb4d315 ob x; - Buffer.contents ob -let read__x_cb4d315 = ( - fun p lb -> - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb in - ( ATD_string_wrap.Uuidm.wrap ) x -) -let _x_cb4d315_of_string s = - read__x_cb4d315 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_uuid = ( - write__x_cb4d315 -) -let string_of_uuid ?(len = 1024) x = - let ob = Buffer.create len in - write_uuid ob x; - Buffer.contents ob -let read_uuid = ( - read__x_cb4d315 -) -let uuid_of_string s = - read_uuid (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_6b0f513 = ( - fun ob x -> ( - let x = ( ATD_string_wrap.Uri.unwrap ) x in ( - Yojson.Safe.write_string - ) ob x) -) -let string_of__x_6b0f513 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_6b0f513 ob x; - Buffer.contents ob -let read__x_6b0f513 = ( - fun p lb -> - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb in - ( ATD_string_wrap.Uri.wrap ) x -) -let _x_6b0f513_of_string s = - read__x_6b0f513 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_uri = ( - write__x_6b0f513 -) -let string_of_uri ?(len = 1024) x = - let ob = Buffer.create len in - write_uri ob x; - Buffer.contents ob -let read_uri = ( - read__x_6b0f513 -) -let uri_of_string s = - read_uri (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_snippet : _ -> snippet -> _ = ( - fun ob (x : snippet) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"line\":"; - ( - Yojson.Safe.write_int - ) - ob x.line; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"text\":"; - ( - Yojson.Safe.write_string - ) - ob x.text; - Buffer.add_char ob '}'; -) -let string_of_snippet ?(len = 1024) x = - let ob = Buffer.create len in - write_snippet ob x; - Buffer.contents ob -let read_snippet = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_line = ref (None) in - let field_text = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_text := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_text := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); - text = (match !field_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "text"); - } - : snippet) - ) -) -let snippet_of_string s = - read_snippet (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_killing_parent_kind = ( - fun ob x -> - match x with - | `And -> Buffer.add_string ob "\"And\"" - | `Inside -> Buffer.add_string ob "\"Inside\"" - | `Negation -> Buffer.add_string ob "\"Negation\"" - | `Filter x -> - Buffer.add_string ob "[\"Filter\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_killing_parent_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_killing_parent_kind ob x; - Buffer.contents ob -let read_killing_parent_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "And" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `And - | "Inside" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Inside - | "Negation" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Negation - | "Filter" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Filter x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "And" -> - `And - | "Inside" -> - `Inside - | "Negation" -> - `Negation - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Filter" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Filter x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let killing_parent_kind_of_string s = - read_killing_parent_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_killing_parent : _ -> killing_parent -> _ = ( - fun ob (x : killing_parent) -> +let transitivity_of_string s = + read_transitivity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_found_dependency : _ -> found_dependency -> _ = ( + fun ob (x : found_dependency) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"killing_parent_kind\":"; + Buffer.add_string ob "\"package\":"; ( - write_killing_parent_kind + Yojson.Safe.write_string ) - ob x.killing_parent_kind; + ob x.package; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"snippet\":"; + Buffer.add_string ob "\"version\":"; ( - write_snippet + Yojson.Safe.write_string ) - ob x.snippet; + ob x.version; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ecosystem\":"; + ( + write_ecosystem + ) + ob x.ecosystem; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"allowed_hashes\":"; + ( + write__x_b85b97f + ) + ob x.allowed_hashes; + (match x.resolved_url with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"resolved_url\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"transitivity\":"; + ( + write_transitivity + ) + ob x.transitivity; + (match x.manifest_path with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"manifest_path\":"; + ( + write_fpath + ) + ob x; + ); + (match x.lockfile_path with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lockfile_path\":"; + ( + write_fpath + ) + ob x; + ); + (match x.line_number with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"line_number\":"; + ( + Yojson.Safe.write_int + ) + ob x; + ); + (match x.children with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"children\":"; + ( + write__dependency_child_list + ) + ob x; + ); + (match x.git_ref with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"git_ref\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_killing_parent ?(len = 1024) x = +let string_of_found_dependency ?(len = 1024) x = let ob = Buffer.create len in - write_killing_parent ob x; + write_found_dependency ob x; Buffer.contents ob -let read_killing_parent = ( +let read_found_dependency = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_killing_parent_kind = ref (None) in - let field_snippet = ref (None) in + let field_package = ref (None) in + let field_version = ref (None) in + let field_ecosystem = ref (None) in + let field_allowed_hashes = ref (None) in + let field_resolved_url = ref (None) in + let field_transitivity = ref (None) in + let field_manifest_path = ref (None) in + let field_lockfile_path = ref (None) in + let field_line_number = ref (None) in + let field_children = ref (None) in + let field_git_ref = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -5909,16 +4241,106 @@ let read_killing_parent = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 7 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 't' then ( - 1 + match String.unsafe_get s pos with + | 'g' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'f' then ( + 10 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( + 9 ) else ( -1 ) ) - | 19 -> ( - if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'k' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'd' then ( - 0 + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 2 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'b' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' then ( + 8 + ) + else ( + -1 + ) + ) + | 12 -> ( + match String.unsafe_get s pos with + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'u' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'l' then ( + 4 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 13 -> ( + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( + 7 + ) + else ( + -1 + ) + ) + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( + 6 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'w' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 3 ) else ( -1 @@ -5933,21 +4355,105 @@ let read_killing_parent = ( ( match i with | 0 -> - field_killing_parent_kind := ( + field_package := ( Some ( ( - read_killing_parent_kind + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_snippet := ( + field_version := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); + | 3 -> + field_allowed_hashes := ( + Some ( + ( + read__x_b85b97f + ) p lb + ) + ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_resolved_url := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 5 -> + field_transitivity := ( + Some ( + ( + read_transitivity ) p lb ) ); + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_manifest_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_lockfile_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_line_number := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_children := ( + Some ( + ( + read__dependency_child_list + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_git_ref := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -5962,16 +4468,106 @@ let read_killing_parent = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 7 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 't' then ( - 1 + match String.unsafe_get s pos with + | 'g' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'f' then ( + 10 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( + 9 ) else ( -1 ) ) - | 19 -> ( - if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'k' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'd' then ( - 0 + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 2 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'b' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' then ( + 8 + ) + else ( + -1 + ) + ) + | 12 -> ( + match String.unsafe_get s pos with + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'u' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'l' then ( + 4 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 13 -> ( + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( + 7 + ) + else ( + -1 + ) + ) + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( + 6 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'w' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 3 ) else ( -1 @@ -5986,21 +4582,105 @@ let read_killing_parent = ( ( match i with | 0 -> - field_killing_parent_kind := ( + field_package := ( Some ( ( - read_killing_parent_kind + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_snippet := ( + field_version := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); + | 3 -> + field_allowed_hashes := ( + Some ( + ( + read__x_b85b97f + ) p lb + ) + ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_resolved_url := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 5 -> + field_transitivity := ( + Some ( + ( + read_transitivity ) p lb ) ); + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_manifest_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_lockfile_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_line_number := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_children := ( + Some ( + ( + read__dependency_child_list + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_git_ref := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -6010,127 +4690,67 @@ let read_killing_parent = ( with Yojson.End_of_object -> ( ( { - killing_parent_kind = (match !field_killing_parent_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "killing_parent_kind"); - snippet = (match !field_snippet with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "snippet"); + package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); + version = (match !field_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "version"); + ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); + allowed_hashes = (match !field_allowed_hashes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "allowed_hashes"); + resolved_url = !field_resolved_url; + transitivity = (match !field_transitivity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "transitivity"); + manifest_path = !field_manifest_path; + lockfile_path = !field_lockfile_path; + line_number = !field_line_number; + children = !field_children; + git_ref = !field_git_ref; } - : killing_parent) - ) -) -let killing_parent_of_string s = - read_killing_parent (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__killing_parent_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_killing_parent - ) -) -let string_of__killing_parent_list ?(len = 1024) x = - let ob = Buffer.create len in - write__killing_parent_list ob x; - Buffer.contents ob -let read__killing_parent_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_killing_parent - ) -) -let _killing_parent_list_of_string s = - read__killing_parent_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_unexpected_no_match_diagnosis_kind = ( - fun ob x -> - match x with - | `Never_matched -> Buffer.add_string ob "\"Never_matched\"" - | `Killed_by_nodes x -> - Buffer.add_string ob "[\"Killed_by_nodes\","; - ( - write__killing_parent_list - ) ob x; - Buffer.add_char ob ']' -) -let string_of_unexpected_no_match_diagnosis_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_unexpected_no_match_diagnosis_kind ob x; - Buffer.contents ob -let read_unexpected_no_match_diagnosis_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Never_matched" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Never_matched - | "Killed_by_nodes" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__killing_parent_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Killed_by_nodes x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Never_matched" -> - `Never_matched - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Killed_by_nodes" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__killing_parent_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Killed_by_nodes x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + : found_dependency) + ) ) -let unexpected_no_match_diagnosis_kind_of_string s = - read_unexpected_no_match_diagnosis_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_unexpected_no_match_diagnosis : _ -> unexpected_no_match_diagnosis -> _ = ( - fun ob (x : unexpected_no_match_diagnosis) -> +let found_dependency_of_string s = + read_found_dependency (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_dependency_match : _ -> dependency_match -> _ = ( + fun ob (x : dependency_match) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"line\":"; + Buffer.add_string ob "\"dependency_pattern\":"; ( - Yojson.Safe.write_int + write_sca_pattern ) - ob x.line; + ob x.dependency_pattern; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"kind\":"; + Buffer.add_string ob "\"found_dependency\":"; ( - write_unexpected_no_match_diagnosis_kind + write_found_dependency ) - ob x.kind; + ob x.found_dependency; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lockfile\":"; + ( + write_fpath + ) + ob x.lockfile; Buffer.add_char ob '}'; ) -let string_of_unexpected_no_match_diagnosis ?(len = 1024) x = +let string_of_dependency_match ?(len = 1024) x = let ob = Buffer.create len in - write_unexpected_no_match_diagnosis ob x; + write_dependency_match ob x; Buffer.contents ob -let read_unexpected_no_match_diagnosis = ( +let read_dependency_match = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_line = ref (None) in - let field_kind = ref (None) in + let field_dependency_pattern = ref (None) in + let field_found_dependency = ref (None) in + let field_lockfile = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -6139,49 +4759,60 @@ let read_unexpected_no_match_diagnosis = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 1 - ) - else ( - -1 - ) + match len with + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' then ( + 2 ) - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 16 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'y' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 'n' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_line := ( + field_dependency_pattern := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_sca_pattern ) p lb ) ); | 1 -> - field_kind := ( + field_found_dependency := ( Some ( ( - read_unexpected_no_match_diagnosis_kind + read_found_dependency + ) p lb + ) + ); + | 2 -> + field_lockfile := ( + Some ( + ( + read_fpath ) p lb ) ); @@ -6197,49 +4828,60 @@ let read_unexpected_no_match_diagnosis = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 1 - ) - else ( - -1 - ) + match len with + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' then ( + 2 ) - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 16 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'y' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 'n' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_line := ( + field_dependency_pattern := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_sca_pattern ) p lb ) ); | 1 -> - field_kind := ( + field_found_dependency := ( Some ( ( - read_unexpected_no_match_diagnosis_kind + read_found_dependency + ) p lb + ) + ); + | 2 -> + field_lockfile := ( + Some ( + ( + read_fpath ) p lb ) ); @@ -6252,112 +4894,69 @@ let read_unexpected_no_match_diagnosis = ( with Yojson.End_of_object -> ( ( { - line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); - kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); + dependency_pattern = (match !field_dependency_pattern with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_pattern"); + found_dependency = (match !field_found_dependency with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "found_dependency"); + lockfile = (match !field_lockfile with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lockfile"); } - : unexpected_no_match_diagnosis) + : dependency_match) ) ) -let unexpected_no_match_diagnosis_of_string s = - read_unexpected_no_match_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_originating_node_kind = ( - fun ob x -> - match x with - | `Focus -> Buffer.add_string ob "\"Focus\"" - | `Xpattern -> Buffer.add_string ob "\"Xpattern\"" -) -let string_of_originating_node_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_originating_node_kind ob x; - Buffer.contents ob -let read_originating_node_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Focus" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Focus - | "Xpattern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Xpattern - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Focus" -> - `Focus - | "Xpattern" -> - `Xpattern - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let originating_node_kind_of_string s = - read_originating_node_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_unexpected_match_diagnosis : _ -> unexpected_match_diagnosis -> _ = ( - fun ob (x : unexpected_match_diagnosis) -> +let dependency_match_of_string s = + read_dependency_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_sca_match : _ -> sca_match -> _ = ( + fun ob (x : sca_match) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"matched_text\":"; + Buffer.add_string ob "\"reachable\":"; ( - write_snippet + Yojson.Safe.write_bool ) - ob x.matched_text; + ob x.reachable; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"originating_kind\":"; + Buffer.add_string ob "\"reachability_rule\":"; ( - write_originating_node_kind + Yojson.Safe.write_bool ) - ob x.originating_kind; + ob x.reachability_rule; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"originating_text\":"; + Buffer.add_string ob "\"sca_finding_schema\":"; ( - write_snippet + Yojson.Safe.write_int ) - ob x.originating_text; + ob x.sca_finding_schema; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"killing_parents\":"; + Buffer.add_string ob "\"dependency_match\":"; ( - write__killing_parent_list + write_dependency_match ) - ob x.killing_parents; + ob x.dependency_match; Buffer.add_char ob '}'; ) -let string_of_unexpected_match_diagnosis ?(len = 1024) x = +let string_of_sca_match ?(len = 1024) x = let ob = Buffer.create len in - write_unexpected_match_diagnosis ob x; + write_sca_match ob x; Buffer.contents ob -let read_unexpected_match_diagnosis = ( +let read_sca_match = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_matched_text = ref (None) in - let field_originating_kind = ref (None) in - let field_originating_text = ref (None) in - let field_killing_parents = ref (None) in + let field_reachable = ref (None) in + let field_reachability_rule = ref (None) in + let field_sca_finding_schema = ref (None) in + let field_dependency_match = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -6366,45 +4965,34 @@ let read_unexpected_match_diagnosis = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 12 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' && String.unsafe_get s (pos+11) = 't' then ( + match len with + | 9 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'e' then ( 0 ) else ( -1 ) ) - | 15 -> ( - if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' then ( 3 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' then ( - match String.unsafe_get s (pos+12) with - | 'k' -> ( - if String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'd' then ( - 1 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'e' then ( + 1 + ) + else ( + -1 + ) + ) + | 18 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' then ( + 2 ) else ( -1 @@ -6419,34 +5007,34 @@ let read_unexpected_match_diagnosis = ( ( match i with | 0 -> - field_matched_text := ( + field_reachable := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 1 -> - field_originating_kind := ( + field_reachability_rule := ( Some ( ( - read_originating_node_kind + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 2 -> - field_originating_text := ( + field_sca_finding_schema := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 3 -> - field_killing_parents := ( + field_dependency_match := ( Some ( ( - read__killing_parent_list + read_dependency_match ) p lb ) ); @@ -6463,44 +5051,33 @@ let read_unexpected_match_diagnosis = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 12 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' && String.unsafe_get s (pos+11) = 't' then ( + | 9 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'e' then ( 0 ) else ( -1 ) ) - | 15 -> ( - if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' then ( 3 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' then ( - match String.unsafe_get s (pos+12) with - | 'k' -> ( - if String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'd' then ( - 1 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'e' then ( + 1 + ) + else ( + -1 + ) + ) + | 18 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' then ( + 2 ) else ( -1 @@ -6515,34 +5092,34 @@ let read_unexpected_match_diagnosis = ( ( match i with | 0 -> - field_matched_text := ( + field_reachable := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 1 -> - field_originating_kind := ( + field_reachability_rule := ( Some ( ( - read_originating_node_kind + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 2 -> - field_originating_text := ( + field_sca_finding_schema := ( Some ( ( - read_snippet + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 3 -> - field_killing_parents := ( + field_dependency_match := ( Some ( ( - read__killing_parent_list + read_dependency_match ) p lb ) ); @@ -6555,324 +5132,500 @@ let read_unexpected_match_diagnosis = ( with Yojson.End_of_object -> ( ( { - matched_text = (match !field_matched_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matched_text"); - originating_kind = (match !field_originating_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "originating_kind"); - originating_text = (match !field_originating_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "originating_text"); - killing_parents = (match !field_killing_parents with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "killing_parents"); + reachable = (match !field_reachable with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reachable"); + reachability_rule = (match !field_reachability_rule with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reachability_rule"); + sca_finding_schema = (match !field_sca_finding_schema with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "sca_finding_schema"); + dependency_match = (match !field_dependency_match with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_match"); } - : unexpected_match_diagnosis) + : sca_match) ) ) -let unexpected_match_diagnosis_of_string s = - read_unexpected_match_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_list = ( - Atdgen_runtime.Oj_run.write_list ( - Yojson.Safe.write_string +let sca_match_of_string s = + read_sca_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__sca_match_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_sca_match ) ) -let string_of__string_list ?(len = 1024) x = +let string_of__sca_match_option ?(len = 1024) x = let ob = Buffer.create len in - write__string_list ob x; + write__sca_match_option ob x; Buffer.contents ob -let read__string_list = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_string +let read__sca_match_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_sca_match + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_sca_match + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _sca_match_option_of_string s = + read__sca_match_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_validation_state = ( + fun ob x -> + match x with + | `Confirmed_valid -> Buffer.add_string ob "\"CONFIRMED_VALID\"" + | `Confirmed_invalid -> Buffer.add_string ob "\"CONFIRMED_INVALID\"" + | `Validation_error -> Buffer.add_string ob "\"VALIDATION_ERROR\"" + | `No_validator -> Buffer.add_string ob "\"NO_VALIDATOR\"" +) +let string_of_validation_state ?(len = 1024) x = + let ob = Buffer.create len in + write_validation_state ob x; + Buffer.contents ob +let read_validation_state = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "CONFIRMED_VALID" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Confirmed_valid + | "CONFIRMED_INVALID" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Confirmed_invalid + | "VALIDATION_ERROR" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Validation_error + | "NO_VALIDATOR" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `No_validator + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "CONFIRMED_VALID" -> + `Confirmed_valid + | "CONFIRMED_INVALID" -> + `Confirmed_invalid + | "VALIDATION_ERROR" -> + `Validation_error + | "NO_VALIDATOR" -> + `No_validator + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let validation_state_of_string s = + read_validation_state (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__validation_state_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_validation_state ) ) -let _string_list_of_string s = - read__string_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_triage_ignored : _ -> triage_ignored -> _ = ( - fun ob (x : triage_ignored) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; - ( - write__string_list - ) - ob x.triage_ignored_syntactic_ids; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; - ( - write__string_list - ) - ob x.triage_ignored_match_based_ids; - Buffer.add_char ob '}'; +let string_of__validation_state_option ?(len = 1024) x = + let ob = Buffer.create len in + write__validation_state_option ob x; + Buffer.contents ob +let read__validation_state_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_validation_state + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_validation_state + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _validation_state_option_of_string s = + read__validation_state_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let rec write_match_call_trace : _ -> match_call_trace -> _ = ( + fun ob (x : match_call_trace) -> + match x with + | CliLoc x -> + Buffer.add_string ob "[\"CliLoc\","; + ( + write_loc_and_content + ) ob x; + Buffer.add_char ob ']' + | CliCall x -> + Buffer.add_string ob "[\"CliCall\","; + ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _, _ = x in + ( + write_loc_and_content + ) ob x + ); + Buffer.add_char ob ','; + (let _, x, _ = x in + ( + write__match_intermediate_var_list + ) ob x + ); + Buffer.add_char ob ','; + (let _, _, x = x in + ( + write_match_call_trace + ) ob x + ); + Buffer.add_char ob ']'; + ) ob x; + Buffer.add_char ob ']' ) -let string_of_triage_ignored ?(len = 1024) x = +and string_of_match_call_trace ?(len = 1024) x = let ob = Buffer.create len in - write_triage_ignored ob x; + write_match_call_trace ob x; Buffer.contents ob -let read_triage_ignored = ( +let rec read_match_call_trace = ( fun p lb -> Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_triage_ignored_syntactic_ids = ref ([]) in - let field_triage_ignored_match_based_ids = ref ([]) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( - ( - read__string_list + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "CliLoc" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_loc_and_content ) p lb - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( - ( - read__string_list + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (CliLoc x : match_call_trace) + | "CliCall" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_loc_and_content + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read__match_intermediate_var_list + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x2 = + let x = + ( + read_match_call_trace + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1, x2) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (CliCall x : match_call_trace) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "CliLoc" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_loc_and_content + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (CliLoc x : match_call_trace) + | "CliCall" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_loc_and_content + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read__match_intermediate_var_list + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x2 = + let x = + ( + read_match_call_trace + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1, x2) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); ) p lb - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( - ( - read__string_list - ) p lb - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( - ( - read__string_list - ) p lb - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; - triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; - } - : triage_ignored) - ) + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (CliCall x : match_call_trace) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let triage_ignored_of_string s = - read_triage_ignored (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_transitivity = ( - fun ob x -> - match x with - | `Direct -> Buffer.add_string ob "\"direct\"" - | `Transitive -> Buffer.add_string ob "\"transitive\"" - | `Unknown -> Buffer.add_string ob "\"unknown\"" +and match_call_trace_of_string s = + read_match_call_trace (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__match_call_trace_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_match_call_trace + ) ) -let string_of_transitivity ?(len = 1024) x = +let string_of__match_call_trace_option ?(len = 1024) x = let ob = Buffer.create len in - write_transitivity ob x; + write__match_call_trace_option ob x; Buffer.contents ob -let read_transitivity = ( +let read__match_call_trace_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "direct" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Direct - | "transitive" -> + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Transitive - | "unknown" -> + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_match_call_trace + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Unknown + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "direct" -> - `Direct - | "transitive" -> - `Transitive - | "unknown" -> - `Unknown + | "None" -> + (None : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_match_call_trace + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let transitivity_of_string s = - read_transitivity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_todo = ( - Yojson.Safe.write_int -) -let string_of_todo ?(len = 1024) x = - let ob = Buffer.create len in - write_todo ob x; - Buffer.contents ob -let read_todo = ( - Atdgen_runtime.Oj_run.read_int -) -let todo_of_string s = - read_todo (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__unexpected_no_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_unexpected_no_match_diagnosis - ) -) -let string_of__unexpected_no_match_diagnosis_list ?(len = 1024) x = - let ob = Buffer.create len in - write__unexpected_no_match_diagnosis_list ob x; - Buffer.contents ob -let read__unexpected_no_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_unexpected_no_match_diagnosis - ) -) -let _unexpected_no_match_diagnosis_list_of_string s = - read__unexpected_no_match_diagnosis_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__unexpected_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_unexpected_match_diagnosis - ) -) -let string_of__unexpected_match_diagnosis_list ?(len = 1024) x = - let ob = Buffer.create len in - write__unexpected_match_diagnosis_list ob x; - Buffer.contents ob -let read__unexpected_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_unexpected_match_diagnosis - ) -) -let _unexpected_match_diagnosis_list_of_string s = - read__unexpected_match_diagnosis_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_matching_diagnosis : _ -> matching_diagnosis -> _ = ( - fun ob (x : matching_diagnosis) -> +let _match_call_trace_option_of_string s = + read__match_call_trace_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_match_dataflow_trace : _ -> match_dataflow_trace -> _ = ( + fun ob (x : match_dataflow_trace) -> Buffer.add_char ob '{'; let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"target\":"; - ( - write_fpath - ) - ob x.target; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"unexpected_match_diagnoses\":"; - ( - write__unexpected_match_diagnosis_list - ) - ob x.unexpected_match_diagnoses; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"unexpected_no_match_diagnoses\":"; - ( - write__unexpected_no_match_diagnosis_list - ) - ob x.unexpected_no_match_diagnoses; + (match x.taint_source with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"taint_source\":"; + ( + write_match_call_trace + ) + ob x; + ); + (match x.intermediate_vars with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"intermediate_vars\":"; + ( + write__match_intermediate_var_list + ) + ob x; + ); + (match x.taint_sink with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"taint_sink\":"; + ( + write_match_call_trace + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_matching_diagnosis ?(len = 1024) x = +let string_of_match_dataflow_trace ?(len = 1024) x = let ob = Buffer.create len in - write_matching_diagnosis ob x; + write_match_dataflow_trace ob x; Buffer.contents ob -let read_matching_diagnosis = ( +let read_match_dataflow_trace = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_target = ref (None) in - let field_unexpected_match_diagnoses = ref (None) in - let field_unexpected_no_match_diagnoses = ref (None) in + let field_taint_source = ref (None) in + let field_intermediate_vars = ref (None) in + let field_taint_sink = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -6882,253 +5635,68 @@ let read_matching_diagnosis = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 6 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | 26 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'd' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'g' && String.unsafe_get s (pos+21) = 'n' && String.unsafe_get s (pos+22) = 'o' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 29 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'd' && String.unsafe_get s (pos+21) = 'i' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'o' && String.unsafe_get s (pos+26) = 's' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 's' then ( + | 10 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'k' then ( 2 ) else ( -1 ) ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_target := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | 1 -> - field_unexpected_match_diagnoses := ( - Some ( - ( - read__unexpected_match_diagnosis_list - ) p lb - ) - ); - | 2 -> - field_unexpected_no_match_diagnoses := ( - Some ( - ( - read__unexpected_no_match_diagnosis_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 6 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | 26 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'd' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'g' && String.unsafe_get s (pos+21) = 'n' && String.unsafe_get s (pos+22) = 'o' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 29 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'd' && String.unsafe_get s (pos+21) = 'i' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'o' && String.unsafe_get s (pos+26) = 's' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 's' then ( - 2 - ) - else ( - -1 - ) + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'e' then ( + 0 ) - | _ -> ( + else ( -1 ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_target := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | 1 -> - field_unexpected_match_diagnoses := ( - Some ( - ( - read__unexpected_match_diagnosis_list - ) p lb - ) - ); - | 2 -> - field_unexpected_no_match_diagnoses := ( - Some ( - ( - read__unexpected_no_match_diagnosis_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - target = (match !field_target with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "target"); - unexpected_match_diagnoses = (match !field_unexpected_match_diagnoses with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unexpected_match_diagnoses"); - unexpected_no_match_diagnoses = (match !field_unexpected_no_match_diagnoses with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unexpected_no_match_diagnoses"); - } - : matching_diagnosis) - ) -) -let matching_diagnosis_of_string s = - read_matching_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__int_list = ( - Atdgen_runtime.Oj_run.write_list ( - Yojson.Safe.write_int - ) -) -let string_of__int_list ?(len = 1024) x = - let ob = Buffer.create len in - write__int_list ob x; - Buffer.contents ob -let read__int_list = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_int - ) -) -let _int_list_of_string s = - read__int_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_expected_reported : _ -> expected_reported -> _ = ( - fun ob (x : expected_reported) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"expected_lines\":"; - ( - write__int_list - ) - ob x.expected_lines; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"reported_lines\":"; - ( - write__int_list - ) - ob x.reported_lines; - Buffer.add_char ob '}'; -) -let string_of_expected_reported ?(len = 1024) x = - let ob = Buffer.create len in - write_expected_reported ob x; - Buffer.contents ob -let read_expected_reported = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_expected_lines = ref (None) in - let field_reported_lines = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 14 then ( - match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 1 - ) - else ( - -1 - ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'v' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 's' then ( + 1 ) - | _ -> ( + else ( -1 ) - ) - else ( - -1 - ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_expected_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_taint_source := ( + Some ( + ( + read_match_call_trace + ) p lb + ) + ); + ) | 1 -> - field_reported_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_intermediate_vars := ( + Some ( + ( + read__match_intermediate_var_list + ) p lb + ) + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_taint_sink := ( + Some ( + ( + read_match_call_trace + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -7141,52 +5709,69 @@ let read_expected_reported = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 14 then ( - match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 0 - ) - else ( - -1 - ) + match len with + | 10 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'k' then ( + 2 ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'e' then ( + 0 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'v' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_expected_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_taint_source := ( + Some ( + ( + read_match_call_trace + ) p lb + ) + ); + ) | 1 -> - field_reported_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_intermediate_vars := ( + Some ( + ( + read__match_intermediate_var_list + ) p lb + ) + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_taint_sink := ( + Some ( + ( + read_match_call_trace + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -7196,60 +5781,25 @@ let read_expected_reported = ( with Yojson.End_of_object -> ( ( { - expected_lines = (match !field_expected_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "expected_lines"); - reported_lines = (match !field_reported_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reported_lines"); + taint_source = !field_taint_source; + intermediate_vars = !field_intermediate_vars; + taint_sink = !field_taint_sink; } - : expected_reported) + : match_dataflow_trace) ) ) -let expected_reported_of_string s = - read_expected_reported (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_0629659 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - write_expected_reported - ) -) -let string_of__x_0629659 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_0629659 ob x; - Buffer.contents ob -let read__x_0629659 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read_expected_reported - ) -) -let _x_0629659_of_string s = - read__x_0629659 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__todo_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_todo - ) -) -let string_of__todo_list ?(len = 1024) x = - let ob = Buffer.create len in - write__todo_list ob x; - Buffer.contents ob -let read__todo_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_todo - ) -) -let _todo_list_of_string s = - read__todo_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__matching_diagnosis_option = ( +let match_dataflow_trace_of_string s = + read_match_dataflow_trace (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__match_dataflow_trace_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_matching_diagnosis + write_match_dataflow_trace ) ) -let string_of__matching_diagnosis_option ?(len = 1024) x = +let string_of__match_dataflow_trace_option ?(len = 1024) x = let ob = Buffer.create len in - write__matching_diagnosis_option ob x; + write__match_dataflow_trace_option ob x; Buffer.contents ob -let read__matching_diagnosis_option = ( +let read__match_dataflow_trace_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -7262,7 +5812,7 @@ let read__matching_diagnosis_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_matching_diagnosis + read_match_dataflow_trace ) p lb in Yojson.Safe.read_space p lb; @@ -7285,7 +5835,7 @@ let read__matching_diagnosis_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_matching_diagnosis + read_match_dataflow_trace ) p lb in Yojson.Safe.read_space p lb; @@ -7295,64 +5845,160 @@ let read__matching_diagnosis_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _matching_diagnosis_option_of_string s = - read__matching_diagnosis_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_rule_result : _ -> rule_result -> _ = ( - fun ob (x : rule_result) -> +let _match_dataflow_trace_option_of_string s = + read__match_dataflow_trace_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_core_match_extra : _ -> core_match_extra -> _ = ( + fun ob (x : core_match_extra) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"passed\":"; + Buffer.add_string ob "\"metavars\":"; ( - Yojson.Safe.write_bool + write_metavars ) - ob x.passed; + ob x.metavars; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"matches\":"; + Buffer.add_string ob "\"engine_kind\":"; ( - write__x_0629659 + write_engine_of_finding ) - ob x.matches; + ob x.engine_kind; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"errors\":"; + Buffer.add_string ob "\"is_ignored\":"; ( - write__todo_list + Yojson.Safe.write_bool ) - ob x.errors; - (match x.diagnosis with None -> () | Some x -> + ob x.is_ignored; + (match x.message with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"message\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.metadata with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"metadata\":"; + ( + write_raw_json + ) + ob x; + ); + (match x.severity with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"severity\":"; + ( + write_match_severity + ) + ob x; + ); + (match x.fix with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"diagnosis\":"; + Buffer.add_string ob "\"fix\":"; ( - write_matching_diagnosis + Yojson.Safe.write_string + ) + ob x; + ); + (match x.dataflow_trace with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dataflow_trace\":"; + ( + write_match_dataflow_trace + ) + ob x; + ); + (match x.sca_match with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"sca_match\":"; + ( + write_sca_match + ) + ob x; + ); + (match x.validation_state with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"validation_state\":"; + ( + write_validation_state + ) + ob x; + ); + (match x.historical_info with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"historical_info\":"; + ( + write_historical_info + ) + ob x; + ); + (match x.extra_extra with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra_extra\":"; + ( + write_raw_json ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_rule_result ?(len = 1024) x = +let string_of_core_match_extra ?(len = 1024) x = let ob = Buffer.create len in - write_rule_result ob x; + write_core_match_extra ob x; Buffer.contents ob -let read_rule_result = ( +let read_core_match_extra = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_passed = ref (None) in - let field_matches = ref (None) in - let field_errors = ref (None) in - let field_diagnosis = ref (None) in + let field_metavars = ref (None) in + let field_engine_kind = ref (None) in + let field_is_ignored = ref (None) in + let field_message = ref (None) in + let field_metadata = ref (None) in + let field_severity = ref (None) in + let field_fix = ref (None) in + let field_dataflow_trace = ref (None) in + let field_sca_match = ref (None) in + let field_validation_state = ref (None) in + let field_historical_info = ref (None) in + let field_extra_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -7362,19 +6008,54 @@ let read_rule_result = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 6 -> ( + | 3 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 6 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | 8 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( - 2 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + match String.unsafe_get s (pos+4) with + | 'd' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( - 0 + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( + 5 ) else ( -1 @@ -7384,17 +6065,68 @@ let read_rule_result = ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( - 1 + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' then ( + 8 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 's' then ( - 3 + | 10 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( + 2 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'e' then ( + match String.unsafe_get s (pos+1) with + | 'n' -> ( + if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( + 11 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( + 7 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( + 10 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( + 9 ) else ( -1 @@ -7409,35 +6141,115 @@ let read_rule_result = ( ( match i with | 0 -> - field_passed := ( + field_metavars := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_metavars ) p lb ) ); | 1 -> - field_matches := ( + field_engine_kind := ( Some ( ( - read__x_0629659 + read_engine_of_finding ) p lb ) ); | 2 -> - field_errors := ( + field_is_ignored := ( Some ( ( - read__todo_list + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_diagnosis := ( + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metadata := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_severity := ( + Some ( + ( + read_match_severity + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_match := ( Some ( ( - read_matching_diagnosis + read_sca_match + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) p lb + ) + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra_extra := ( + Some ( + ( + read_raw_json ) p lb ) ); @@ -7455,19 +6267,54 @@ let read_rule_result = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 6 -> ( + | 3 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 6 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | 8 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( - 2 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + match String.unsafe_get s (pos+4) with + | 'd' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( - 0 + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( + 5 ) else ( -1 @@ -7477,17 +6324,68 @@ let read_rule_result = ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( - 1 + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' then ( + 8 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 's' then ( - 3 + | 10 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( + 2 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'e' then ( + match String.unsafe_get s (pos+1) with + | 'n' -> ( + if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( + 11 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( + 7 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( + 10 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( + 9 ) else ( -1 @@ -7502,140 +6400,119 @@ let read_rule_result = ( ( match i with | 0 -> - field_passed := ( + field_metavars := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_metavars ) p lb ) ); | 1 -> - field_matches := ( + field_engine_kind := ( Some ( ( - read__x_0629659 + read_engine_of_finding ) p lb ) ); | 2 -> - field_errors := ( + field_is_ignored := ( Some ( ( - read__todo_list + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_diagnosis := ( + field_message := ( Some ( ( - read_matching_diagnosis + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | _ -> ( - Yojson.Safe.skip_json p lb + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metadata := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - passed = (match !field_passed with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "passed"); - matches = (match !field_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matches"); - errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); - diagnosis = !field_diagnosis; - } - : rule_result) - ) -) -let rule_result_of_string s = - read_rule_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_fixtest_result : _ -> fixtest_result -> _ = ( - fun ob (x : fixtest_result) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"passed\":"; - ( - Yojson.Safe.write_bool - ) - ob x.passed; - Buffer.add_char ob '}'; -) -let string_of_fixtest_result ?(len = 1024) x = - let ob = Buffer.create len in - write_fixtest_result ob x; - Buffer.contents ob -let read_fixtest_result = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_passed = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 6 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_passed := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_severity := ( + Some ( + ( + read_match_severity + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_match := ( + Some ( + ( + read_sca_match + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) p lb + ) + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra_extra := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 6 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_passed := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -7645,84 +6522,88 @@ let read_fixtest_result = ( with Yojson.End_of_object -> ( ( { - passed = (match !field_passed with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "passed"); + metavars = (match !field_metavars with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metavars"); + engine_kind = (match !field_engine_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_kind"); + is_ignored = (match !field_is_ignored with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_ignored"); + message = !field_message; + metadata = !field_metadata; + severity = !field_severity; + fix = !field_fix; + dataflow_trace = !field_dataflow_trace; + sca_match = !field_sca_match; + validation_state = !field_validation_state; + historical_info = !field_historical_info; + extra_extra = !field_extra_extra; } - : fixtest_result) + : core_match_extra) ) ) -let fixtest_result_of_string s = - read_fixtest_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_config_error_reason = ( - fun ob x -> - match x with - | `UnparsableRule -> Buffer.add_string ob "\"unparsable_rule\"" -) -let string_of_config_error_reason ?(len = 1024) x = - let ob = Buffer.create len in - write_config_error_reason ob x; - Buffer.contents ob -let read_config_error_reason = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "unparsable_rule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `UnparsableRule - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "unparsable_rule" -> - `UnparsableRule - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let config_error_reason_of_string s = - read_config_error_reason (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_config_error : _ -> config_error -> _ = ( - fun ob (x : config_error) -> +let core_match_extra_of_string s = + read_core_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_core_match : _ -> core_match -> _ = ( + fun ob (x : core_match) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"file\":"; + Buffer.add_string ob "\"check_id\":"; + ( + write_rule_id + ) + ob x.check_id; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path\":"; ( write_fpath ) - ob x.file; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"reason\":"; + Buffer.add_string ob "\"start\":"; ( - write_config_error_reason + write_position ) - ob x.reason; + ob x.start; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"end\":"; + ( + write_position + ) + ob x.end_; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra\":"; + ( + write_core_match_extra + ) + ob x.extra; Buffer.add_char ob '}'; ) -let string_of_config_error ?(len = 1024) x = +let string_of_core_match ?(len = 1024) x = let ob = Buffer.create len in - write_config_error ob x; + write_core_match ob x; Buffer.contents ob -let read_config_error = ( +let read_core_match = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_file = ref (None) in - let field_reason = ref (None) in + let field_check_id = ref (None) in + let field_path = ref (None) in + let field_start = ref (None) in + let field_end_ = ref (None) in + let field_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -7732,43 +6613,97 @@ let read_config_error = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( - 0 + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 3 ) else ( -1 ) ) - | 6 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 1 ) else ( -1 ) ) + | 5 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_file := ( + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_check_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + | 1 -> + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 2 -> + field_start := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 3 -> + field_end_ := ( Some ( ( - read_fpath + read_position ) p lb ) ); - | 1 -> - field_reason := ( + | 4 -> + field_extra := ( Some ( ( - read_config_error_reason + read_core_match_extra ) p lb ) ); @@ -7785,22 +6720,52 @@ let read_config_error = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( - 0 + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 3 ) else ( -1 ) ) - | 6 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 1 ) else ( -1 ) ) + | 5 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -7810,137 +6775,42 @@ let read_config_error = ( ( match i with | 0 -> - field_file := ( + field_check_id := ( Some ( ( - read_fpath + read_rule_id ) p lb ) ); | 1 -> - field_reason := ( + field_path := ( Some ( ( - read_config_error_reason + read_fpath ) p lb ) ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - file = (match !field_file with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "file"); - reason = (match !field_reason with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reason"); - } - : config_error) - ) -) -let config_error_of_string s = - read_config_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_e141b07 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - write_rule_result - ) -) -let string_of__x_e141b07 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_e141b07 ob x; - Buffer.contents ob -let read__x_e141b07 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read_rule_result - ) -) -let _x_e141b07_of_string s = - read__x_e141b07 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_checks : _ -> checks -> _ = ( - fun ob (x : checks) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"checks\":"; - ( - write__x_e141b07 - ) - ob x.checks; - Buffer.add_char ob '}'; -) -let string_of_checks ?(len = 1024) x = - let ob = Buffer.create len in - write_checks ob x; - Buffer.contents ob -let read_checks = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_checks = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = 's' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_checks := ( - Some ( - ( - read__x_e141b07 - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = 's' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_checks := ( + | 2 -> + field_start := ( Some ( ( - read__x_e141b07 + read_position + ) p lb + ) + ); + | 3 -> + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + read_core_match_extra ) p lb ) ); @@ -7953,149 +6823,124 @@ let read_checks = ( with Yojson.End_of_object -> ( ( { - checks = (match !field_checks with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "checks"); + check_id = (match !field_check_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "check_id"); + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); + end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); + extra = (match !field_extra with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "extra"); } - : checks) + : core_match) ) ) -let checks_of_string s = - read_checks (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_fc09e7b = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - write_fixtest_result - ) -) -let string_of__x_fc09e7b ?(len = 1024) x = - let ob = Buffer.create len in - write__x_fc09e7b ob x; - Buffer.contents ob -let read__x_fc09e7b = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read_fixtest_result - ) -) -let _x_fc09e7b_of_string s = - read__x_fc09e7b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_e1142f7 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - write_checks - ) -) -let string_of__x_e1142f7 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_e1142f7 ob x; - Buffer.contents ob -let read__x_e1142f7 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read_checks - ) -) -let _x_e1142f7_of_string s = - read__x_e1142f7 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__fpath_list = ( +let core_match_of_string s = + read_core_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__core_match_list = ( Atdgen_runtime.Oj_run.write_list ( - write_fpath + write_core_match ) ) -let string_of__fpath_list ?(len = 1024) x = +let string_of__core_match_list ?(len = 1024) x = let ob = Buffer.create len in - write__fpath_list ob x; + write__core_match_list ob x; Buffer.contents ob -let read__fpath_list = ( +let read__core_match_list = ( Atdgen_runtime.Oj_run.read_list ( - read_fpath + read_core_match ) ) -let _fpath_list_of_string s = - read__fpath_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__config_error_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_config_error +let _core_match_list_of_string s = + read__core_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__core_match_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__core_match_list ) ) -let string_of__config_error_list ?(len = 1024) x = +let string_of__core_match_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__config_error_list ob x; + write__core_match_list_option ob x; Buffer.contents ob -let read__config_error_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_config_error - ) +let read__core_match_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__core_match_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__core_match_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let _config_error_list_of_string s = - read__config_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_tests_result : _ -> tests_result -> _ = ( - fun ob (x : tests_result) -> +let _core_match_list_option_of_string s = + read__core_match_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_matching_explanation_extra : _ -> matching_explanation_extra -> _ = ( + fun ob (x : matching_explanation_extra) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"results\":"; - ( - write__x_e1142f7 - ) - ob x.results; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fixtest_results\":"; - ( - write__x_fc09e7b - ) - ob x.fixtest_results; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"config_missing_tests\":"; - ( - write__fpath_list - ) - ob x.config_missing_tests; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"config_missing_fixtests\":"; + Buffer.add_string ob "\"before_negation_matches\":"; ( - write__fpath_list + write__core_match_list_option ) - ob x.config_missing_fixtests; + ob x.before_negation_matches; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"config_with_errors\":"; + Buffer.add_string ob "\"before_filter_matches\":"; ( - write__config_error_list + write__core_match_list_option ) - ob x.config_with_errors; + ob x.before_filter_matches; Buffer.add_char ob '}'; ) -let string_of_tests_result ?(len = 1024) x = +let string_of_matching_explanation_extra ?(len = 1024) x = let ob = Buffer.create len in - write_tests_result ob x; + write_matching_explanation_extra ob x; Buffer.contents ob -let read_tests_result = ( +let read_matching_explanation_extra = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_results = ref (None) in - let field_fixtest_results = ref (None) in - let field_config_missing_tests = ref (None) in - let field_config_missing_fixtests = ref (None) in - let field_config_with_errors = ref (None) in + let field_before_negation_matches = ref (None) in + let field_before_filter_matches = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -8105,41 +6950,17 @@ let read_tests_result = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'u' && String.unsafe_get s (pos+12) = 'l' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + | 21 -> ( + if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( 1 ) else ( -1 ) ) - | 18 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | 20 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 's' then ( - 2 - ) - else ( - -1 - ) - ) | 23 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'f' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'x' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 's' then ( - 3 + if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'h' && String.unsafe_get s (pos+21) = 'e' && String.unsafe_get s (pos+22) = 's' then ( + 0 ) else ( -1 @@ -8154,42 +6975,18 @@ let read_tests_result = ( ( match i with | 0 -> - field_results := ( + field_before_negation_matches := ( Some ( ( - read__x_e1142f7 + read__core_match_list_option ) p lb ) ); | 1 -> - field_fixtest_results := ( - Some ( - ( - read__x_fc09e7b - ) p lb - ) - ); - | 2 -> - field_config_missing_tests := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); - | 3 -> - field_config_missing_fixtests := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); - | 4 -> - field_config_with_errors := ( + field_before_filter_matches := ( Some ( ( - read__config_error_list + read__core_match_list_option ) p lb ) ); @@ -8206,41 +7003,17 @@ let read_tests_result = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'u' && String.unsafe_get s (pos+12) = 'l' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + | 21 -> ( + if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( 1 ) else ( -1 ) ) - | 18 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | 20 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 's' then ( - 2 - ) - else ( - -1 - ) - ) | 23 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'f' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'x' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 's' then ( - 3 + if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'h' && String.unsafe_get s (pos+21) = 'e' && String.unsafe_get s (pos+22) = 's' then ( + 0 ) else ( -1 @@ -8251,46 +7024,22 @@ let read_tests_result = ( ) in let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_results := ( - Some ( - ( - read__x_e1142f7 - ) p lb - ) - ); - | 1 -> - field_fixtest_results := ( - Some ( - ( - read__x_fc09e7b - ) p lb - ) - ); - | 2 -> - field_config_missing_tests := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); - | 3 -> - field_config_missing_fixtests := ( + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_before_negation_matches := ( Some ( ( - read__fpath_list + read__core_match_list_option ) p lb ) ); - | 4 -> - field_config_with_errors := ( + | 1 -> + field_before_filter_matches := ( Some ( ( - read__config_error_list + read__core_match_list_option ) p lb ) ); @@ -8303,258 +7052,153 @@ let read_tests_result = ( with Yojson.End_of_object -> ( ( { - results = (match !field_results with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "results"); - fixtest_results = (match !field_fixtest_results with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fixtest_results"); - config_missing_tests = (match !field_config_missing_tests with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_missing_tests"); - config_missing_fixtests = (match !field_config_missing_fixtests with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_missing_fixtests"); - config_with_errors = (match !field_config_with_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_with_errors"); + before_negation_matches = (match !field_before_negation_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "before_negation_matches"); + before_filter_matches = (match !field_before_filter_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "before_filter_matches"); } - : tests_result) + : matching_explanation_extra) ) ) -let tests_result_of_string s = - read_tests_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_product = ( - fun ob x -> - match x with - | `SAST -> Buffer.add_string ob "\"sast\"" - | `SCA -> Buffer.add_string ob "\"sca\"" - | `Secrets -> Buffer.add_string ob "\"secrets\"" +let matching_explanation_extra_of_string s = + read_matching_explanation_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__matching_explanation_extra_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_matching_explanation_extra + ) ) -let string_of_product ?(len = 1024) x = +let string_of__matching_explanation_extra_option ?(len = 1024) x = let ob = Buffer.create len in - write_product ob x; + write__matching_explanation_extra_option ob x; Buffer.contents ob -let read_product = ( +let read__matching_explanation_extra_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "sast" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SAST - | "sca" -> + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `SCA - | "secrets" -> + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_matching_explanation_extra + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Secrets + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "sast" -> - `SAST - | "sca" -> - `SCA - | "secrets" -> - `Secrets + | "None" -> + (None : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let product_of_string s = - read_product (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_lockfile_kind : _ -> lockfile_kind -> _ = ( - fun ob (x : lockfile_kind) -> - match x with - | PipRequirementsTxt -> Buffer.add_string ob "\"PipRequirementsTxt\"" - | PoetryLock -> Buffer.add_string ob "\"PoetryLock\"" - | PipfileLock -> Buffer.add_string ob "\"PipfileLock\"" - | UvLock -> Buffer.add_string ob "\"UvLock\"" - | NpmPackageLockJson -> Buffer.add_string ob "\"NpmPackageLockJson\"" - | YarnLock -> Buffer.add_string ob "\"YarnLock\"" - | PnpmLock -> Buffer.add_string ob "\"PnpmLock\"" - | GemfileLock -> Buffer.add_string ob "\"GemfileLock\"" - | GoMod -> Buffer.add_string ob "\"GoMod\"" - | CargoLock -> Buffer.add_string ob "\"CargoLock\"" - | MavenDepTree -> Buffer.add_string ob "\"MavenDepTree\"" - | GradleLockfile -> Buffer.add_string ob "\"GradleLockfile\"" - | ComposerLock -> Buffer.add_string ob "\"ComposerLock\"" - | NugetPackagesLockJson -> Buffer.add_string ob "\"NugetPackagesLockJson\"" - | PubspecLock -> Buffer.add_string ob "\"PubspecLock\"" - | SwiftPackageResolved -> Buffer.add_string ob "\"SwiftPackageResolved\"" - | MixLock -> Buffer.add_string ob "\"MixLock\"" - | ConanLock -> Buffer.add_string ob "\"ConanLock\"" -) -let string_of_lockfile_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_lockfile_kind ob x; - Buffer.contents ob -let read_lockfile_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "PipRequirementsTxt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PipRequirementsTxt : lockfile_kind) - | "PoetryLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PoetryLock : lockfile_kind) - | "PipfileLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PipfileLock : lockfile_kind) - | "UvLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (UvLock : lockfile_kind) - | "NpmPackageLockJson" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (NpmPackageLockJson : lockfile_kind) - | "YarnLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (YarnLock : lockfile_kind) - | "PnpmLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PnpmLock : lockfile_kind) - | "GemfileLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (GemfileLock : lockfile_kind) - | "GoMod" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (GoMod : lockfile_kind) - | "CargoLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (CargoLock : lockfile_kind) - | "MavenDepTree" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (MavenDepTree : lockfile_kind) - | "GradleLockfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (GradleLockfile : lockfile_kind) - | "ComposerLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (ComposerLock : lockfile_kind) - | "NugetPackagesLockJson" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (NugetPackagesLockJson : lockfile_kind) - | "PubspecLock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PubspecLock : lockfile_kind) - | "SwiftPackageResolved" -> + | "Some" -> Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SwiftPackageResolved : lockfile_kind) - | "MixLock" -> + Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (MixLock : lockfile_kind) - | "ConanLock" -> + let x = ( + read_matching_explanation_extra + ) p lb + in Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (ConanLock : lockfile_kind) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "PipRequirementsTxt" -> - (PipRequirementsTxt : lockfile_kind) - | "PoetryLock" -> - (PoetryLock : lockfile_kind) - | "PipfileLock" -> - (PipfileLock : lockfile_kind) - | "UvLock" -> - (UvLock : lockfile_kind) - | "NpmPackageLockJson" -> - (NpmPackageLockJson : lockfile_kind) - | "YarnLock" -> - (YarnLock : lockfile_kind) - | "PnpmLock" -> - (PnpmLock : lockfile_kind) - | "GemfileLock" -> - (GemfileLock : lockfile_kind) - | "GoMod" -> - (GoMod : lockfile_kind) - | "CargoLock" -> - (CargoLock : lockfile_kind) - | "MavenDepTree" -> - (MavenDepTree : lockfile_kind) - | "GradleLockfile" -> - (GradleLockfile : lockfile_kind) - | "ComposerLock" -> - (ComposerLock : lockfile_kind) - | "NugetPackagesLockJson" -> - (NugetPackagesLockJson : lockfile_kind) - | "PubspecLock" -> - (PubspecLock : lockfile_kind) - | "SwiftPackageResolved" -> - (SwiftPackageResolved : lockfile_kind) - | "MixLock" -> - (MixLock : lockfile_kind) - | "ConanLock" -> - (ConanLock : lockfile_kind) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with + Yojson.Safe.read_rbr p lb; + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let lockfile_kind_of_string s = - read_lockfile_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_lockfile : _ -> lockfile -> _ = ( - fun ob (x : lockfile) -> +let _matching_explanation_extra_option_of_string s = + read__matching_explanation_extra_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let rec write__matching_explanation_list ob x = ( + Atdgen_runtime.Oj_run.write_list ( + write_matching_explanation + ) +) ob x +and string_of__matching_explanation_list ?(len = 1024) x = + let ob = Buffer.create len in + write__matching_explanation_list ob x; + Buffer.contents ob +and write_matching_explanation : _ -> matching_explanation -> _ = ( + fun ob (x : matching_explanation) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"kind\":"; + Buffer.add_string ob "\"op\":"; + ( + write_matching_operation + ) + ob x.op; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"children\":"; + ( + write__matching_explanation_list + ) + ob x.children; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"matches\":"; ( - write_lockfile_kind + write__core_match_list ) - ob x.kind; + ob x.matches; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; + Buffer.add_string ob "\"loc\":"; ( - write_fpath + write_location ) - ob x.path; + ob x.loc; + (match x.extra with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra\":"; + ( + write_matching_explanation_extra + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_lockfile ?(len = 1024) x = +and string_of_matching_explanation ?(len = 1024) x = let ob = Buffer.create len in - write_lockfile ob x; + write_matching_explanation ob x; Buffer.contents ob -let read_lockfile = ( +let rec read__matching_explanation_list p lb = ( + Atdgen_runtime.Oj_run.read_list ( + read_matching_explanation + ) +) p lb +and _matching_explanation_list_of_string s = + read__matching_explanation_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +and read_matching_explanation = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_kind = ref (None) in - let field_path = ref (None) in + let field_op = ref (None) in + let field_children = ref (None) in + let field_matches = ref (None) in + let field_loc = ref (None) in + let field_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -8563,52 +7207,97 @@ let read_lockfile = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 2 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'p' then ( + 0 ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 3 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' then ( + 3 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 5 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_kind := ( + field_op := ( Some ( ( - read_lockfile_kind + read_matching_operation ) p lb ) ); | 1 -> - field_path := ( + field_children := ( Some ( ( - read_fpath + read__matching_explanation_list + ) p lb + ) + ); + | 2 -> + field_matches := ( + Some ( + ( + read__core_match_list + ) p lb + ) + ); + | 3 -> + field_loc := ( + Some ( + ( + read_location ) p lb ) ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra := ( + Some ( + ( + read_matching_explanation_extra + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -8621,52 +7310,97 @@ let read_lockfile = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 2 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'p' then ( + 0 ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 3 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' then ( + 3 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 5 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_kind := ( + field_op := ( Some ( ( - read_lockfile_kind + read_matching_operation ) p lb ) ); | 1 -> - field_path := ( + field_children := ( Some ( ( - read_fpath + read__matching_explanation_list + ) p lb + ) + ); + | 2 -> + field_matches := ( + Some ( + ( + read__core_match_list + ) p lb + ) + ); + | 3 -> + field_loc := ( + Some ( + ( + read_location ) p lb ) ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra := ( + Some ( + ( + read_matching_explanation_extra + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -8676,143 +7410,156 @@ let read_lockfile = ( with Yojson.End_of_object -> ( ( { - kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + op = (match !field_op with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "op"); + children = (match !field_children with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "children"); + matches = (match !field_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matches"); + loc = (match !field_loc with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "loc"); + extra = !field_extra; } - : lockfile) + : matching_explanation) ) ) -let lockfile_of_string s = - read_lockfile (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__product_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_product - ) +and matching_explanation_of_string s = + read_matching_explanation (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_893d00a = ( + fun ob x -> ( + let x = ( Xlang.unwrap ) x in ( + Yojson.Safe.write_string + ) ob x) +) +let string_of__x_893d00a ?(len = 1024) x = + let ob = Buffer.create len in + write__x_893d00a ob x; + Buffer.contents ob +let read__x_893d00a = ( + fun p lb -> + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb in + ( Xlang.wrap ) x ) -let string_of__product_list ?(len = 1024) x = +let _x_893d00a_of_string s = + read__x_893d00a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_xlang = ( + write__x_893d00a +) +let string_of_xlang ?(len = 1024) x = let ob = Buffer.create len in - write__product_list ob x; + write_xlang ob x; Buffer.contents ob -let read__product_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_product - ) +let read_xlang = ( + read__x_893d00a ) -let _product_list_of_string s = - read__product_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__lockfile_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_lockfile - ) +let xlang_of_string s = + read_xlang (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_version = ( + Yojson.Safe.write_string ) -let string_of__lockfile_option ?(len = 1024) x = +let string_of_version ?(len = 1024) x = let ob = Buffer.create len in - write__lockfile_option ob x; + write_version ob x; Buffer.contents ob -let read__lockfile_option = ( +let read_version = ( + Atdgen_runtime.Oj_run.read_string +) +let version_of_string s = + read_version (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_cb4d315 = ( + fun ob x -> ( + let x = ( ATD_string_wrap.Uuidm.unwrap ) x in ( + Yojson.Safe.write_string + ) ob x) +) +let string_of__x_cb4d315 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_cb4d315 ob x; + Buffer.contents ob +let read__x_cb4d315 = ( fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_lockfile - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_lockfile - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb in + ( ATD_string_wrap.Uuidm.wrap ) x ) -let _lockfile_option_of_string s = - read__lockfile_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_code_target : _ -> code_target -> _ = ( - fun ob (x : code_target) -> +let _x_cb4d315_of_string s = + read__x_cb4d315 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_uuid = ( + write__x_cb4d315 +) +let string_of_uuid ?(len = 1024) x = + let ob = Buffer.create len in + write_uuid ob x; + Buffer.contents ob +let read_uuid = ( + read__x_cb4d315 +) +let uuid_of_string s = + read_uuid (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_6b0f513 = ( + fun ob x -> ( + let x = ( ATD_string_wrap.Uri.unwrap ) x in ( + Yojson.Safe.write_string + ) ob x) +) +let string_of__x_6b0f513 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_6b0f513 ob x; + Buffer.contents ob +let read__x_6b0f513 = ( + fun p lb -> + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb in + ( ATD_string_wrap.Uri.wrap ) x +) +let _x_6b0f513_of_string s = + read__x_6b0f513 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_uri = ( + write__x_6b0f513 +) +let string_of_uri ?(len = 1024) x = + let ob = Buffer.create len in + write_uri ob x; + Buffer.contents ob +let read_uri = ( + read__x_6b0f513 +) +let uri_of_string s = + read_uri (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_snippet : _ -> snippet -> _ = ( + fun ob (x : snippet) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x.path; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"analyzer\":"; + Buffer.add_string ob "\"line\":"; ( - write_xlang + Yojson.Safe.write_int ) - ob x.analyzer; + ob x.line; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"products\":"; + Buffer.add_string ob "\"text\":"; ( - write__product_list + Yojson.Safe.write_string ) - ob x.products; - (match x.lockfile_target with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"lockfile_target\":"; - ( - write_lockfile - ) - ob x; - ); + ob x.text; Buffer.add_char ob '}'; ) -let string_of_code_target ?(len = 1024) x = +let string_of_snippet ?(len = 1024) x = let ob = Buffer.create len in - write_code_target ob x; + write_snippet ob x; Buffer.contents ob -let read_code_target = ( +let read_snippet = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_path = ref (None) in - let field_analyzer = ref (None) in - let field_products = ref (None) in - let field_lockfile_target = ref (None) in + let field_line = ref (None) in + let field_text = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -8821,87 +7568,52 @@ let read_code_target = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 0 - ) - else ( - -1 + if len = 4 then ( + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'a' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'z' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' then ( - 1 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 't' then ( - 3 + | 't' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_path := ( + field_line := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_analyzer := ( - Some ( - ( - read_xlang - ) p lb - ) - ); - | 2 -> - field_products := ( + field_text := ( Some ( ( - read__product_list + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lockfile_target := ( - Some ( - ( - read_lockfile - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -8914,87 +7626,52 @@ let read_code_target = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 0 - ) - else ( - -1 + if len = 4 then ( + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'a' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'z' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' then ( - 1 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 't' then ( - 3 + | 't' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_path := ( + field_line := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_analyzer := ( - Some ( - ( - read_xlang - ) p lb - ) - ); - | 2 -> - field_products := ( + field_text := ( Some ( ( - read__product_list + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lockfile_target := ( - Some ( - ( - read_lockfile - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -9004,206 +7681,125 @@ let read_code_target = ( with Yojson.End_of_object -> ( ( { - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); - analyzer = (match !field_analyzer with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "analyzer"); - products = (match !field_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "products"); - lockfile_target = !field_lockfile_target; + line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); + text = (match !field_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "text"); } - : code_target) + : snippet) ) ) -let code_target_of_string s = - read_code_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_target = ( +let snippet_of_string s = + read_snippet (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_killing_parent_kind = ( fun ob x -> match x with - | `CodeTarget x -> - Buffer.add_string ob "[\"CodeTarget\","; - ( - write_code_target - ) ob x; - Buffer.add_char ob ']' - | `LockfileTarget x -> - Buffer.add_string ob "[\"LockfileTarget\","; + | `And -> Buffer.add_string ob "\"And\"" + | `Inside -> Buffer.add_string ob "\"Inside\"" + | `Negation -> Buffer.add_string ob "\"Negation\"" + | `Filter x -> + Buffer.add_string ob "[\"Filter\","; ( - write_lockfile + Yojson.Safe.write_string ) ob x; Buffer.add_char ob ']' ) -let string_of_target ?(len = 1024) x = +let string_of_killing_parent_kind ?(len = 1024) x = let ob = Buffer.create len in - write_target ob x; + write_killing_parent_kind ob x; Buffer.contents ob -let read_target = ( +let read_killing_parent_kind = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "CodeTarget" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_code_target - ) p lb - in + | "And" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `CodeTarget x - | "LockfileTarget" -> + `And + | "Inside" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Inside + | "Negation" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Negation + | "Filter" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_lockfile + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `LockfileTarget x + `Filter x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "CodeTarget" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_code_target - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CodeTarget x - | "LockfileTarget" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_lockfile - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `LockfileTarget x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let target_of_string s = - read_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__target_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_target - ) -) -let string_of__target_list ?(len = 1024) x = - let ob = Buffer.create len in - write__target_list ob x; - Buffer.contents ob -let read__target_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_target - ) -) -let _target_list_of_string s = - read__target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_targets = ( - write__target_list -) -let string_of_targets ?(len = 1024) x = - let ob = Buffer.create len in - write_targets ob x; - Buffer.contents ob -let read_targets = ( - read__target_list -) -let targets_of_string s = - read_targets (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__float_list = ( - Atdgen_runtime.Oj_run.write_list ( - Yojson.Safe.write_std_float - ) -) -let string_of__float_list ?(len = 1024) x = - let ob = Buffer.create len in - write__float_list ob x; - Buffer.contents ob -let read__float_list = ( - Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_number - ) + | "And" -> + `And + | "Inside" -> + `Inside + | "Negation" -> + `Negation + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Filter" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Filter x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let _float_list_of_string s = - read__float_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_target_times : _ -> target_times -> _ = ( - fun ob (x : target_times) -> +let killing_parent_kind_of_string s = + read_killing_parent_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_killing_parent : _ -> killing_parent -> _ = ( + fun ob (x : killing_parent) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x.path; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"num_bytes\":"; - ( - Yojson.Safe.write_int - ) - ob x.num_bytes; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"match_times\":"; - ( - write__float_list - ) - ob x.match_times; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"parse_times\":"; + Buffer.add_string ob "\"killing_parent_kind\":"; ( - write__float_list + write_killing_parent_kind ) - ob x.parse_times; + ob x.killing_parent_kind; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"run_time\":"; + Buffer.add_string ob "\"snippet\":"; ( - Yojson.Safe.write_std_float + write_snippet ) - ob x.run_time; + ob x.snippet; Buffer.add_char ob '}'; ) -let string_of_target_times ?(len = 1024) x = +let string_of_killing_parent ?(len = 1024) x = let ob = Buffer.create len in - write_target_times ob x; + write_killing_parent ob x; Buffer.contents ob -let read_target_times = ( +let read_killing_parent = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_path = ref (None) in - let field_num_bytes = ref (None) in - let field_match_times = ref (None) in - let field_parse_times = ref (None) in - let field_run_time = ref (None) in + let field_killing_parent_kind = ref (None) in + let field_snippet = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -9213,52 +7809,22 @@ let read_target_times = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( - 4 + | 7 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 't' then ( + 1 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 's' then ( - 1 + | 19 -> ( + if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'k' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'd' then ( + 0 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | _ -> ( -1 ) @@ -9268,42 +7834,18 @@ let read_target_times = ( ( match i with | 0 -> - field_path := ( + field_killing_parent_kind := ( Some ( ( - read_fpath + read_killing_parent_kind ) p lb ) ); | 1 -> - field_num_bytes := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - field_match_times := ( - Some ( - ( - read__float_list - ) p lb - ) - ); - | 3 -> - field_parse_times := ( - Some ( - ( - read__float_list - ) p lb - ) - ); - | 4 -> - field_run_time := ( + field_snippet := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read_snippet ) p lb ) ); @@ -9320,52 +7862,22 @@ let read_target_times = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( - 4 + | 7 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 't' then ( + 1 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 's' then ( - 1 + | 19 -> ( + if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'k' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'd' then ( + 0 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | _ -> ( -1 ) @@ -9375,42 +7887,18 @@ let read_target_times = ( ( match i with | 0 -> - field_path := ( + field_killing_parent_kind := ( Some ( ( - read_fpath + read_killing_parent_kind ) p lb ) ); | 1 -> - field_num_bytes := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - field_match_times := ( - Some ( - ( - read__float_list - ) p lb - ) - ); - | 3 -> - field_parse_times := ( - Some ( - ( - read__float_list - ) p lb - ) - ); - | 4 -> - field_run_time := ( + field_snippet := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read_snippet ) p lb ) ); @@ -9423,332 +7911,289 @@ let read_target_times = ( with Yojson.End_of_object -> ( ( { - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); - num_bytes = (match !field_num_bytes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "num_bytes"); - match_times = (match !field_match_times with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "match_times"); - parse_times = (match !field_parse_times with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "parse_times"); - run_time = (match !field_run_time with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "run_time"); + killing_parent_kind = (match !field_killing_parent_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "killing_parent_kind"); + snippet = (match !field_snippet with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "snippet"); } - : target_times) + : killing_parent) ) ) -let target_times_of_string s = - read_target_times (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_tag = ( - Yojson.Safe.write_string +let killing_parent_of_string s = + read_killing_parent (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__killing_parent_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_killing_parent + ) ) -let string_of_tag ?(len = 1024) x = +let string_of__killing_parent_list ?(len = 1024) x = let ob = Buffer.create len in - write_tag ob x; + write__killing_parent_list ob x; Buffer.contents ob -let read_tag = ( - Atdgen_runtime.Oj_run.read_string +let read__killing_parent_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_killing_parent + ) ) -let tag_of_string s = - read_tag (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_resolution_method = ( +let _killing_parent_list_of_string s = + read__killing_parent_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_unexpected_no_match_diagnosis_kind = ( fun ob x -> match x with - | `LockfileParsing -> Buffer.add_string ob "\"LockfileParsing\"" - | `DynamicResolution -> Buffer.add_string ob "\"DynamicResolution\"" + | `Never_matched -> Buffer.add_string ob "\"Never_matched\"" + | `Killed_by_nodes x -> + Buffer.add_string ob "[\"Killed_by_nodes\","; + ( + write__killing_parent_list + ) ob x; + Buffer.add_char ob ']' ) -let string_of_resolution_method ?(len = 1024) x = +let string_of_unexpected_no_match_diagnosis_kind ?(len = 1024) x = let ob = Buffer.create len in - write_resolution_method ob x; + write_unexpected_no_match_diagnosis_kind ob x; Buffer.contents ob -let read_resolution_method = ( +let read_unexpected_no_match_diagnosis_kind = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "LockfileParsing" -> + | "Never_matched" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `LockfileParsing - | "DynamicResolution" -> + `Never_matched + | "Killed_by_nodes" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__killing_parent_list + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `DynamicResolution + `Killed_by_nodes x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "LockfileParsing" -> - `LockfileParsing - | "DynamicResolution" -> - `DynamicResolution + | "Never_matched" -> + `Never_matched | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with + | "Killed_by_nodes" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__killing_parent_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Killed_by_nodes x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let resolution_method_of_string s = - read_resolution_method (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_manifest_kind = ( - fun ob x -> - match x with - | `RequirementsIn -> Buffer.add_string ob "\"RequirementsIn\"" - | `PackageJson -> Buffer.add_string ob "\"PackageJson\"" - | `Gemfile -> Buffer.add_string ob "\"Gemfile\"" - | `GoMod -> Buffer.add_string ob "\"GoMod\"" - | `CargoToml -> Buffer.add_string ob "\"CargoToml\"" - | `PomXml -> Buffer.add_string ob "\"PomXml\"" - | `BuildGradle -> Buffer.add_string ob "\"BuildGradle\"" - | `SettingsGradle -> Buffer.add_string ob "\"SettingsGradle\"" - | `ComposerJson -> Buffer.add_string ob "\"ComposerJson\"" - | `NugetManifestJson -> Buffer.add_string ob "\"NugetManifestJson\"" - | `PubspecYaml -> Buffer.add_string ob "\"PubspecYaml\"" - | `PackageSwift -> Buffer.add_string ob "\"PackageSwift\"" - | `MixExs -> Buffer.add_string ob "\"MixExs\"" - | `Pipfile -> Buffer.add_string ob "\"Pipfile\"" - | `PyprojectToml -> Buffer.add_string ob "\"PyprojectToml\"" - | `ConanFileTxt -> Buffer.add_string ob "\"ConanFileTxt\"" - | `ConanFilePy -> Buffer.add_string ob "\"ConanFilePy\"" - | `Csproj -> Buffer.add_string ob "\"Csproj\"" +let unexpected_no_match_diagnosis_kind_of_string s = + read_unexpected_no_match_diagnosis_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_unexpected_no_match_diagnosis : _ -> unexpected_no_match_diagnosis -> _ = ( + fun ob (x : unexpected_no_match_diagnosis) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"line\":"; + ( + Yojson.Safe.write_int + ) + ob x.line; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"kind\":"; + ( + write_unexpected_no_match_diagnosis_kind + ) + ob x.kind; + Buffer.add_char ob '}'; ) -let string_of_manifest_kind ?(len = 1024) x = +let string_of_unexpected_no_match_diagnosis ?(len = 1024) x = let ob = Buffer.create len in - write_manifest_kind ob x; + write_unexpected_no_match_diagnosis ob x; Buffer.contents ob -let read_manifest_kind = ( +let read_unexpected_no_match_diagnosis = ( fun p lb -> Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "RequirementsIn" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RequirementsIn - | "PackageJson" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PackageJson - | "Gemfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gemfile - | "GoMod" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `GoMod - | "CargoToml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CargoToml - | "PomXml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PomXml - | "BuildGradle" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BuildGradle - | "SettingsGradle" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SettingsGradle - | "ComposerJson" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ComposerJson - | "NugetManifestJson" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NugetManifestJson - | "PubspecYaml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PubspecYaml - | "PackageSwift" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PackageSwift - | "MixExs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MixExs - | "Pipfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pipfile - | "PyprojectToml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PyprojectToml - | "ConanFileTxt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ConanFileTxt - | "ConanFilePy" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ConanFilePy - | "Csproj" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Csproj - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "RequirementsIn" -> - `RequirementsIn - | "PackageJson" -> - `PackageJson - | "Gemfile" -> - `Gemfile - | "GoMod" -> - `GoMod - | "CargoToml" -> - `CargoToml - | "PomXml" -> - `PomXml - | "BuildGradle" -> - `BuildGradle - | "SettingsGradle" -> - `SettingsGradle - | "ComposerJson" -> - `ComposerJson - | "NugetManifestJson" -> - `NugetManifestJson - | "PubspecYaml" -> - `PubspecYaml - | "PackageSwift" -> - `PackageSwift - | "MixExs" -> - `MixExs - | "Pipfile" -> - `Pipfile - | "PyprojectToml" -> - `PyprojectToml - | "ConanFileTxt" -> - `ConanFileTxt - | "ConanFilePy" -> - `ConanFilePy - | "Csproj" -> - `Csproj - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + Yojson.Safe.read_lcurl p lb; + let field_line = ref (None) in + let field_kind = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_line := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 1 -> + field_kind := ( + Some ( + ( + read_unexpected_no_match_diagnosis_kind + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_line := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 1 -> + field_kind := ( + Some ( + ( + read_unexpected_no_match_diagnosis_kind + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); + kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); + } + : unexpected_no_match_diagnosis) + ) ) -let manifest_kind_of_string s = - read_manifest_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ecosystem = ( +let unexpected_no_match_diagnosis_of_string s = + read_unexpected_no_match_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_originating_node_kind = ( fun ob x -> match x with - | `Npm -> Buffer.add_string ob "\"npm\"" - | `Pypi -> Buffer.add_string ob "\"pypi\"" - | `Gem -> Buffer.add_string ob "\"gem\"" - | `Gomod -> Buffer.add_string ob "\"gomod\"" - | `Cargo -> Buffer.add_string ob "\"cargo\"" - | `Maven -> Buffer.add_string ob "\"maven\"" - | `Composer -> Buffer.add_string ob "\"composer\"" - | `Nuget -> Buffer.add_string ob "\"nuget\"" - | `Pub -> Buffer.add_string ob "\"pub\"" - | `SwiftPM -> Buffer.add_string ob "\"swiftpm\"" - | `Mix -> Buffer.add_string ob "\"mix\"" - | `Hex -> Buffer.add_string ob "\"hex\"" + | `Focus -> Buffer.add_string ob "\"Focus\"" + | `Xpattern -> Buffer.add_string ob "\"Xpattern\"" ) -let string_of_ecosystem ?(len = 1024) x = +let string_of_originating_node_kind ?(len = 1024) x = let ob = Buffer.create len in - write_ecosystem ob x; + write_originating_node_kind ob x; Buffer.contents ob -let read_ecosystem = ( +let read_originating_node_kind = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "npm" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Npm - | "pypi" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pypi - | "gem" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gem - | "gomod" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gomod - | "cargo" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cargo - | "maven" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Maven - | "composer" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Composer - | "nuget" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Nuget - | "pub" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pub - | "swiftpm" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SwiftPM - | "mix" -> + | "Focus" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Mix - | "hex" -> + `Focus + | "Xpattern" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Hex + `Xpattern | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "npm" -> - `Npm - | "pypi" -> - `Pypi - | "gem" -> - `Gem - | "gomod" -> - `Gomod - | "cargo" -> - `Cargo - | "maven" -> - `Maven - | "composer" -> - `Composer - | "nuget" -> - `Nuget - | "pub" -> - `Pub - | "swiftpm" -> - `SwiftPM - | "mix" -> - `Mix - | "hex" -> - `Hex + | "Focus" -> + `Focus + | "Xpattern" -> + `Xpattern | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) @@ -9758,124 +8203,303 @@ let read_ecosystem = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let ecosystem_of_string s = - read_ecosystem (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_source_file_kind = ( - fun ob x -> - match x with - | `Lockfile x -> - Buffer.add_string ob "[\"Lockfile\","; - ( - write_lockfile_kind - ) ob x; - Buffer.add_char ob ']' - | `Manifest x -> - Buffer.add_string ob "[\"Manifest\","; - ( - write_manifest_kind - ) ob x; - Buffer.add_char ob ']' +let originating_node_kind_of_string s = + read_originating_node_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_unexpected_match_diagnosis : _ -> unexpected_match_diagnosis -> _ = ( + fun ob (x : unexpected_match_diagnosis) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"matched_text\":"; + ( + write_snippet + ) + ob x.matched_text; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"originating_kind\":"; + ( + write_originating_node_kind + ) + ob x.originating_kind; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"originating_text\":"; + ( + write_snippet + ) + ob x.originating_text; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"killing_parents\":"; + ( + write__killing_parent_list + ) + ob x.killing_parents; + Buffer.add_char ob '}'; ) -let string_of_dependency_source_file_kind ?(len = 1024) x = +let string_of_unexpected_match_diagnosis ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_source_file_kind ob x; + write_unexpected_match_diagnosis ob x; Buffer.contents ob -let read_dependency_source_file_kind = ( +let read_unexpected_match_diagnosis = ( fun p lb -> Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Lockfile" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_lockfile_kind + Yojson.Safe.read_lcurl p lb; + let field_matched_text = ref (None) in + let field_originating_kind = ref (None) in + let field_originating_text = ref (None) in + let field_killing_parents = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 12 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' && String.unsafe_get s (pos+11) = 't' then ( + 0 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' then ( + match String.unsafe_get s (pos+12) with + | 'k' -> ( + if String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_matched_text := ( + Some ( + ( + read_snippet ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lockfile x - | "Manifest" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_manifest_kind + ) + ); + | 1 -> + field_originating_kind := ( + Some ( + ( + read_originating_node_kind ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Manifest x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Lockfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_lockfile_kind + ) + ); + | 2 -> + field_originating_text := ( + Some ( + ( + read_snippet ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Lockfile x - | "Manifest" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_manifest_kind + ) + ); + | 3 -> + field_killing_parents := ( + Some ( + ( + read__killing_parent_list ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Manifest x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 12 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'x' && String.unsafe_get s (pos+11) = 't' then ( + 0 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'k' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' then ( + match String.unsafe_get s (pos+12) with + | 'k' -> ( + if String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_matched_text := ( + Some ( + ( + read_snippet + ) p lb + ) + ); + | 1 -> + field_originating_kind := ( + Some ( + ( + read_originating_node_kind + ) p lb + ) + ); + | 2 -> + field_originating_text := ( + Some ( + ( + read_snippet + ) p lb + ) + ); + | 3 -> + field_killing_parents := ( + Some ( + ( + read__killing_parent_list + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + matched_text = (match !field_matched_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matched_text"); + originating_kind = (match !field_originating_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "originating_kind"); + originating_text = (match !field_originating_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "originating_text"); + killing_parents = (match !field_killing_parents with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "killing_parents"); + } + : unexpected_match_diagnosis) + ) ) -let dependency_source_file_kind_of_string s = - read_dependency_source_file_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_source_file : _ -> dependency_source_file -> _ = ( - fun ob (x : dependency_source_file) -> +let unexpected_match_diagnosis_of_string s = + read_unexpected_match_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_triage_ignored : _ -> triage_ignored -> _ = ( + fun ob (x : triage_ignored) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"kind\":"; + Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; ( - write_dependency_source_file_kind + write__string_list ) - ob x.kind; + ob x.triage_ignored_syntactic_ids; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; + Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; ( - write_fpath + write__string_list ) - ob x.path; + ob x.triage_ignored_match_based_ids; Buffer.add_char ob '}'; ) -let string_of_dependency_source_file ?(len = 1024) x = +let string_of_triage_ignored ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_source_file ob x; + write_triage_ignored ob x; Buffer.contents ob -let read_dependency_source_file = ( +let read_triage_ignored = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_kind = ref (None) in - let field_path = ref (None) in + let field_triage_ignored_syntactic_ids = ref ([]) in + let field_triage_ignored_match_based_ids = ref ([]) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -9884,52 +8508,47 @@ let read_dependency_source_file = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 0 ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_kind := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( ( - read_dependency_source_file_kind + read__string_list ) p lb - ) - ); + ); + ) | 1 -> - field_path := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( ( - read_fpath + read__string_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -9942,52 +8561,47 @@ let read_dependency_source_file = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 4 then ( - match String.unsafe_get s pos with - | 'k' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 0 ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_kind := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( ( - read_dependency_source_file_kind + read__string_list ) p lb - ) - ); + ); + ) | 1 -> - field_path := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( ( - read_fpath + read__string_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -9997,58 +8611,102 @@ let read_dependency_source_file = ( with Yojson.End_of_object -> ( ( { - kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; + triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; } - : dependency_source_file) + : triage_ignored) ) ) -let dependency_source_file_of_string s = - read_dependency_source_file (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_resolution_stats : _ -> dependency_resolution_stats -> _ = ( - fun ob (x : dependency_resolution_stats) -> +let triage_ignored_of_string s = + read_triage_ignored (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_todo = ( + Yojson.Safe.write_int +) +let string_of_todo ?(len = 1024) x = + let ob = Buffer.create len in + write_todo ob x; + Buffer.contents ob +let read_todo = ( + Atdgen_runtime.Oj_run.read_int +) +let todo_of_string s = + read_todo (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__unexpected_no_match_diagnosis_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_unexpected_no_match_diagnosis + ) +) +let string_of__unexpected_no_match_diagnosis_list ?(len = 1024) x = + let ob = Buffer.create len in + write__unexpected_no_match_diagnosis_list ob x; + Buffer.contents ob +let read__unexpected_no_match_diagnosis_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_unexpected_no_match_diagnosis + ) +) +let _unexpected_no_match_diagnosis_list_of_string s = + read__unexpected_no_match_diagnosis_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__unexpected_match_diagnosis_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_unexpected_match_diagnosis + ) +) +let string_of__unexpected_match_diagnosis_list ?(len = 1024) x = + let ob = Buffer.create len in + write__unexpected_match_diagnosis_list ob x; + Buffer.contents ob +let read__unexpected_match_diagnosis_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_unexpected_match_diagnosis + ) +) +let _unexpected_match_diagnosis_list_of_string s = + read__unexpected_match_diagnosis_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_matching_diagnosis : _ -> matching_diagnosis -> _ = ( + fun ob (x : matching_diagnosis) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"resolution_method\":"; + Buffer.add_string ob "\"target\":"; ( - write_resolution_method + write_fpath ) - ob x.resolution_method; + ob x.target; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_count\":"; + Buffer.add_string ob "\"unexpected_match_diagnoses\":"; ( - Yojson.Safe.write_int + write__unexpected_match_diagnosis_list ) - ob x.dependency_count; + ob x.unexpected_match_diagnoses; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"ecosystem\":"; + Buffer.add_string ob "\"unexpected_no_match_diagnoses\":"; ( - write_ecosystem + write__unexpected_no_match_diagnosis_list ) - ob x.ecosystem; + ob x.unexpected_no_match_diagnoses; Buffer.add_char ob '}'; ) -let string_of_dependency_resolution_stats ?(len = 1024) x = +let string_of_matching_diagnosis ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_resolution_stats ob x; + write_matching_diagnosis ob x; Buffer.contents ob -let read_dependency_resolution_stats = ( +let read_matching_diagnosis = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_resolution_method = ref (None) in - let field_dependency_count = ref (None) in - let field_ecosystem = ref (None) in + let field_target = ref (None) in + let field_unexpected_match_diagnoses = ref (None) in + let field_unexpected_no_match_diagnoses = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -10058,25 +8716,25 @@ let read_dependency_resolution_stats = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 2 + | 6 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( + 0 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( + | 26 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'd' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'g' && String.unsafe_get s (pos+21) = 'n' && String.unsafe_get s (pos+22) = 'o' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 's' then ( 1 ) else ( -1 ) ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'd' then ( - 0 + | 29 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'd' && String.unsafe_get s (pos+21) = 'i' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'o' && String.unsafe_get s (pos+26) = 's' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 's' then ( + 2 ) else ( -1 @@ -10091,26 +8749,26 @@ let read_dependency_resolution_stats = ( ( match i with | 0 -> - field_resolution_method := ( + field_target := ( Some ( ( - read_resolution_method + read_fpath ) p lb ) ); | 1 -> - field_dependency_count := ( + field_unexpected_match_diagnoses := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__unexpected_match_diagnosis_list ) p lb ) ); | 2 -> - field_ecosystem := ( + field_unexpected_no_match_diagnoses := ( Some ( ( - read_ecosystem + read__unexpected_no_match_diagnosis_list ) p lb ) ); @@ -10127,25 +8785,25 @@ let read_dependency_resolution_stats = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 2 + | 6 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 't' then ( + 0 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( + | 26 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'd' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'g' && String.unsafe_get s (pos+21) = 'n' && String.unsafe_get s (pos+22) = 'o' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 's' then ( 1 ) else ( -1 ) ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'd' then ( - 0 + | 29 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'h' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'd' && String.unsafe_get s (pos+21) = 'i' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'o' && String.unsafe_get s (pos+26) = 's' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 's' then ( + 2 ) else ( -1 @@ -10160,26 +8818,26 @@ let read_dependency_resolution_stats = ( ( match i with | 0 -> - field_resolution_method := ( + field_target := ( Some ( ( - read_resolution_method + read_fpath ) p lb ) ); | 1 -> - field_dependency_count := ( + field_unexpected_match_diagnoses := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__unexpected_match_diagnosis_list ) p lb ) ); | 2 -> - field_ecosystem := ( + field_unexpected_no_match_diagnoses := ( Some ( ( - read_ecosystem + read__unexpected_no_match_diagnosis_list ) p lb ) ); @@ -10192,134 +8850,65 @@ let read_dependency_resolution_stats = ( with Yojson.End_of_object -> ( ( { - resolution_method = (match !field_resolution_method with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "resolution_method"); - dependency_count = (match !field_dependency_count with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_count"); - ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); + target = (match !field_target with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "target"); + unexpected_match_diagnoses = (match !field_unexpected_match_diagnoses with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unexpected_match_diagnoses"); + unexpected_no_match_diagnoses = (match !field_unexpected_no_match_diagnoses with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unexpected_no_match_diagnoses"); } - : dependency_resolution_stats) + : matching_diagnosis) ) ) -let dependency_resolution_stats_of_string s = - read_dependency_resolution_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_source_file_list = ( +let matching_diagnosis_of_string s = + read_matching_diagnosis (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__int_list = ( Atdgen_runtime.Oj_run.write_list ( - write_dependency_source_file + Yojson.Safe.write_int ) ) -let string_of__dependency_source_file_list ?(len = 1024) x = +let string_of__int_list ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_source_file_list ob x; + write__int_list ob x; Buffer.contents ob -let read__dependency_source_file_list = ( +let read__int_list = ( Atdgen_runtime.Oj_run.read_list ( - read_dependency_source_file - ) -) -let _dependency_source_file_list_of_string s = - read__dependency_source_file_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_resolution_stats_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_dependency_resolution_stats + Atdgen_runtime.Oj_run.read_int ) ) -let string_of__dependency_resolution_stats_option ?(len = 1024) x = - let ob = Buffer.create len in - write__dependency_resolution_stats_option ob x; - Buffer.contents ob -let read__dependency_resolution_stats_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_dependency_resolution_stats - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_dependency_resolution_stats - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _dependency_resolution_stats_option_of_string s = - read__dependency_resolution_stats_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_subproject_stats : _ -> subproject_stats -> _ = ( - fun ob (x : subproject_stats) -> +let _int_list_of_string s = + read__int_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_expected_reported : _ -> expected_reported -> _ = ( + fun ob (x : expected_reported) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"subproject_id\":"; + Buffer.add_string ob "\"expected_lines\":"; ( - Yojson.Safe.write_string + write__int_list ) - ob x.subproject_id; + ob x.expected_lines; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_sources\":"; + Buffer.add_string ob "\"reported_lines\":"; ( - write__dependency_source_file_list + write__int_list ) - ob x.dependency_sources; - (match x.resolved_stats with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"resolved_stats\":"; - ( - write_dependency_resolution_stats - ) - ob x; - ); + ob x.reported_lines; Buffer.add_char ob '}'; ) -let string_of_subproject_stats ?(len = 1024) x = +let string_of_expected_reported ?(len = 1024) x = let ob = Buffer.create len in - write_subproject_stats ob x; + write_expected_reported ob x; Buffer.contents ob -let read_subproject_stats = ( +let read_expected_reported = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_subproject_id = ref (None) in - let field_dependency_sources = ref (None) in - let field_resolved_stats = ref (None) in + let field_expected_lines = ref (None) in + let field_reported_lines = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -10328,65 +8917,52 @@ let read_subproject_stats = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 13 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 's' then ( - 2 - ) - else ( - -1 + if len = 14 then ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 18 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' then ( - 1 + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_subproject_id := ( + field_expected_lines := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__int_list ) p lb ) ); | 1 -> - field_dependency_sources := ( + field_reported_lines := ( Some ( ( - read__dependency_source_file_list + read__int_list ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_stats := ( - Some ( - ( - read_dependency_resolution_stats - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -10399,65 +8975,52 @@ let read_subproject_stats = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 13 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 's' then ( - 2 - ) - else ( - -1 + if len = 14 then ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 18 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' then ( - 1 + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_subproject_id := ( + field_expected_lines := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__int_list ) p lb ) ); | 1 -> - field_dependency_sources := ( + field_reported_lines := ( Some ( ( - read__dependency_source_file_list + read__int_list ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_stats := ( - Some ( - ( - read_dependency_resolution_stats - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -10467,55 +9030,163 @@ let read_subproject_stats = ( with Yojson.End_of_object -> ( ( { - subproject_id = (match !field_subproject_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "subproject_id"); - dependency_sources = (match !field_dependency_sources with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_sources"); - resolved_stats = !field_resolved_stats; + expected_lines = (match !field_expected_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "expected_lines"); + reported_lines = (match !field_reported_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reported_lines"); } - : subproject_stats) + : expected_reported) ) ) -let subproject_stats_of_string s = - read_subproject_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__subproject_stats_list = ( +let expected_reported_of_string s = + read_expected_reported (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_0629659 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_expected_reported + ) +) +let string_of__x_0629659 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_0629659 ob x; + Buffer.contents ob +let read__x_0629659 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_expected_reported + ) +) +let _x_0629659_of_string s = + read__x_0629659 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__todo_list = ( Atdgen_runtime.Oj_run.write_list ( - write_subproject_stats + write_todo ) ) -let string_of__subproject_stats_list ?(len = 1024) x = +let string_of__todo_list ?(len = 1024) x = let ob = Buffer.create len in - write__subproject_stats_list ob x; + write__todo_list ob x; Buffer.contents ob -let read__subproject_stats_list = ( +let read__todo_list = ( Atdgen_runtime.Oj_run.read_list ( - read_subproject_stats + read_todo ) ) -let _subproject_stats_list_of_string s = - read__subproject_stats_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_supply_chain_stats : _ -> supply_chain_stats -> _ = ( - fun ob (x : supply_chain_stats) -> +let _todo_list_of_string s = + read__todo_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__matching_diagnosis_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_matching_diagnosis + ) +) +let string_of__matching_diagnosis_option ?(len = 1024) x = + let ob = Buffer.create len in + write__matching_diagnosis_option ob x; + Buffer.contents ob +let read__matching_diagnosis_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_matching_diagnosis + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_matching_diagnosis + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _matching_diagnosis_option_of_string s = + read__matching_diagnosis_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_rule_result : _ -> rule_result -> _ = ( + fun ob (x : rule_result) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"subprojects_stats\":"; + Buffer.add_string ob "\"passed\":"; ( - write__subproject_stats_list + Yojson.Safe.write_bool ) - ob x.subprojects_stats; + ob x.passed; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"matches\":"; + ( + write__x_0629659 + ) + ob x.matches; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"errors\":"; + ( + write__todo_list + ) + ob x.errors; + (match x.diagnosis with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"diagnosis\":"; + ( + write_matching_diagnosis + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_supply_chain_stats ?(len = 1024) x = +let string_of_rule_result ?(len = 1024) x = let ob = Buffer.create len in - write_supply_chain_stats ob x; + write_rule_result ob x; Buffer.contents ob -let read_supply_chain_stats = ( +let read_rule_result = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_subprojects_stats = ref (None) in + let field_passed = ref (None) in + let field_matches = ref (None) in + let field_errors = ref (None) in + let field_diagnosis = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -10524,25 +9195,87 @@ let read_supply_chain_stats = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 17 && String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 's' then ( - 0 - ) - else ( - -1 - ) + match len with + | 6 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_subprojects_stats := ( + field_passed := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 1 -> + field_matches := ( + Some ( + ( + read__x_0629659 + ) p lb + ) + ); + | 2 -> + field_errors := ( Some ( ( - read__subproject_stats_list + read__todo_list ) p lb ) ); + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_diagnosis := ( + Some ( + ( + read_matching_diagnosis + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -10555,305 +9288,275 @@ let read_supply_chain_stats = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 17 && String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 's' then ( - 0 - ) - else ( - -1 - ) + match len with + | 6 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_subprojects_stats := ( + field_passed := ( Some ( ( - read__subproject_stats_list + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - subprojects_stats = (match !field_subprojects_stats with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "subprojects_stats"); - } - : supply_chain_stats) - ) -) -let supply_chain_stats_of_string s = - read_supply_chain_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_skip_reason : _ -> skip_reason -> _ = ( - fun ob (x : skip_reason) -> - match x with - | Always_skipped -> Buffer.add_string ob "\"always_skipped\"" - | Semgrepignore_patterns_match -> Buffer.add_string ob "\"semgrepignore_patterns_match\"" - | Cli_include_flags_do_not_match -> Buffer.add_string ob "\"cli_include_flags_do_not_match\"" - | Cli_exclude_flags_match -> Buffer.add_string ob "\"cli_exclude_flags_match\"" - | Exceeded_size_limit -> Buffer.add_string ob "\"exceeded_size_limit\"" - | Analysis_failed_parser_or_internal_error -> Buffer.add_string ob "\"analysis_failed_parser_or_internal_error\"" - | Excluded_by_config -> Buffer.add_string ob "\"excluded_by_config\"" - | Wrong_language -> Buffer.add_string ob "\"wrong_language\"" - | Too_big -> Buffer.add_string ob "\"too_big\"" - | Minified -> Buffer.add_string ob "\"minified\"" - | Binary -> Buffer.add_string ob "\"binary\"" - | Irrelevant_rule -> Buffer.add_string ob "\"irrelevant_rule\"" - | Too_many_matches -> Buffer.add_string ob "\"too_many_matches\"" - | Gitignore_patterns_match -> Buffer.add_string ob "\"Gitignore_patterns_match\"" - | Dotfile -> Buffer.add_string ob "\"Dotfile\"" - | Nonexistent_file -> Buffer.add_string ob "\"Nonexistent_file\"" - | Insufficient_permissions -> Buffer.add_string ob "\"insufficient_permissions\"" -) -let string_of_skip_reason ?(len = 1024) x = - let ob = Buffer.create len in - write_skip_reason ob x; - Buffer.contents ob -let read_skip_reason = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "always_skipped" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Always_skipped : skip_reason) - | "semgrepignore_patterns_match" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Semgrepignore_patterns_match : skip_reason) - | "cli_include_flags_do_not_match" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Cli_include_flags_do_not_match : skip_reason) - | "cli_exclude_flags_match" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Cli_exclude_flags_match : skip_reason) - | "exceeded_size_limit" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Exceeded_size_limit : skip_reason) - | "analysis_failed_parser_or_internal_error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Analysis_failed_parser_or_internal_error : skip_reason) - | "excluded_by_config" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Excluded_by_config : skip_reason) - | "wrong_language" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Wrong_language : skip_reason) - | "too_big" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Too_big : skip_reason) - | "minified" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Minified : skip_reason) - | "binary" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Binary : skip_reason) - | "irrelevant_rule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Irrelevant_rule : skip_reason) - | "too_many_matches" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Too_many_matches : skip_reason) - | "Gitignore_patterns_match" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Gitignore_patterns_match : skip_reason) - | "Dotfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Dotfile : skip_reason) - | "Nonexistent_file" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Nonexistent_file : skip_reason) - | "insufficient_permissions" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Insufficient_permissions : skip_reason) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "always_skipped" -> - (Always_skipped : skip_reason) - | "semgrepignore_patterns_match" -> - (Semgrepignore_patterns_match : skip_reason) - | "cli_include_flags_do_not_match" -> - (Cli_include_flags_do_not_match : skip_reason) - | "cli_exclude_flags_match" -> - (Cli_exclude_flags_match : skip_reason) - | "exceeded_size_limit" -> - (Exceeded_size_limit : skip_reason) - | "analysis_failed_parser_or_internal_error" -> - (Analysis_failed_parser_or_internal_error : skip_reason) - | "excluded_by_config" -> - (Excluded_by_config : skip_reason) - | "wrong_language" -> - (Wrong_language : skip_reason) - | "too_big" -> - (Too_big : skip_reason) - | "minified" -> - (Minified : skip_reason) - | "binary" -> - (Binary : skip_reason) - | "irrelevant_rule" -> - (Irrelevant_rule : skip_reason) - | "too_many_matches" -> - (Too_many_matches : skip_reason) - | "Gitignore_patterns_match" -> - (Gitignore_patterns_match : skip_reason) - | "Dotfile" -> - (Dotfile : skip_reason) - | "Nonexistent_file" -> - (Nonexistent_file : skip_reason) - | "insufficient_permissions" -> - (Insufficient_permissions : skip_reason) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + | 1 -> + field_matches := ( + Some ( + ( + read__x_0629659 + ) p lb + ) + ); + | 2 -> + field_errors := ( + Some ( + ( + read__todo_list + ) p lb + ) + ); + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_diagnosis := ( + Some ( + ( + read_matching_diagnosis + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + passed = (match !field_passed with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "passed"); + matches = (match !field_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matches"); + errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); + diagnosis = !field_diagnosis; + } + : rule_result) + ) ) -let skip_reason_of_string s = - read_skip_reason (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__rule_id_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_rule_id - ) +let rule_result_of_string s = + read_rule_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_fixtest_result : _ -> fixtest_result -> _ = ( + fun ob (x : fixtest_result) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"passed\":"; + ( + Yojson.Safe.write_bool + ) + ob x.passed; + Buffer.add_char ob '}'; ) -let string_of__rule_id_option ?(len = 1024) x = +let string_of_fixtest_result ?(len = 1024) x = let ob = Buffer.create len in - write__rule_id_option ob x; + write_fixtest_result ob x; Buffer.contents ob -let read__rule_id_option = ( +let read_fixtest_result = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_passed = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 6 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_passed := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 6 && String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_passed := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + passed = (match !field_passed with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "passed"); + } + : fixtest_result) + ) +) +let fixtest_result_of_string s = + read_fixtest_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_config_error_reason = ( + fun ob x -> + match x with + | `UnparsableRule -> Buffer.add_string ob "\"unparsable_rule\"" +) +let string_of_config_error_reason ?(len = 1024) x = + let ob = Buffer.create len in + write_config_error_reason ob x; + Buffer.contents ob +let read_config_error_reason = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_rule_id - ) p lb - in + | "unparsable_rule" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + `UnparsableRule | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "unparsable_rule" -> + `UnparsableRule | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_rule_id - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _rule_id_option_of_string s = - read__rule_id_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_skipped_target : _ -> skipped_target -> _ = ( - fun ob (x : skipped_target) -> +let config_error_reason_of_string s = + read_config_error_reason (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_config_error : _ -> config_error -> _ = ( + fun ob (x : config_error) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; + Buffer.add_string ob "\"file\":"; ( write_fpath ) - ob x.path; + ob x.file; if !is_first then is_first := false else Buffer.add_char ob ','; Buffer.add_string ob "\"reason\":"; ( - write_skip_reason + write_config_error_reason ) ob x.reason; - (match x.details with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"details\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.rule_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_id\":"; - ( - write_rule_id - ) - ob x; - ); Buffer.add_char ob '}'; ) -let string_of_skipped_target ?(len = 1024) x = +let string_of_config_error ?(len = 1024) x = let ob = Buffer.create len in - write_skipped_target ob x; + write_config_error ob x; Buffer.contents ob -let read_skipped_target = ( +let read_config_error = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_path = ref (None) in + let field_file = ref (None) in let field_reason = ref (None) in - let field_details = ref (None) in - let field_rule_id = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -10864,7 +9567,7 @@ let read_skipped_target = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) else ( @@ -10879,28 +9582,6 @@ let read_skipped_target = ( -1 ) ) - | 7 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | _ -> ( -1 ) @@ -10910,7 +9591,7 @@ let read_skipped_target = ( ( match i with | 0 -> - field_path := ( + field_file := ( Some ( ( read_fpath @@ -10921,30 +9602,10 @@ let read_skipped_target = ( field_reason := ( Some ( ( - read_skip_reason + read_config_error_reason ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -10959,7 +9620,7 @@ let read_skipped_target = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) else ( @@ -10974,28 +9635,6 @@ let read_skipped_target = ( -1 ) ) - | 7 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | _ -> ( -1 ) @@ -11005,7 +9644,7 @@ let read_skipped_target = ( ( match i with | 0 -> - field_path := ( + field_file := ( Some ( ( read_fpath @@ -11016,30 +9655,10 @@ let read_skipped_target = ( field_reason := ( Some ( ( - read_skip_reason + read_config_error_reason ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -11049,60 +9668,58 @@ let read_skipped_target = ( with Yojson.End_of_object -> ( ( { - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + file = (match !field_file with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "file"); reason = (match !field_reason with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reason"); - details = !field_details; - rule_id = !field_rule_id; } - : skipped_target) + : config_error) ) ) -let skipped_target_of_string s = - read_skipped_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_skipped_rule : _ -> skipped_rule -> _ = ( - fun ob (x : skipped_rule) -> +let config_error_of_string s = + read_config_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_e141b07 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_rule_result + ) +) +let string_of__x_e141b07 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_e141b07 ob x; + Buffer.contents ob +let read__x_e141b07 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_rule_result + ) +) +let _x_e141b07_of_string s = + read__x_e141b07 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_checks : _ -> checks -> _ = ( + fun ob (x : checks) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_id\":"; - ( - write_rule_id - ) - ob x.rule_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"details\":"; - ( - Yojson.Safe.write_string - ) - ob x.details; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"position\":"; + Buffer.add_string ob "\"checks\":"; ( - write_position + write__x_e141b07 ) - ob x.position; + ob x.checks; Buffer.add_char ob '}'; ) -let string_of_skipped_rule ?(len = 1024) x = +let string_of_checks ?(len = 1024) x = let ob = Buffer.create len in - write_skipped_rule ob x; + write_checks ob x; Buffer.contents ob -let read_skipped_rule = ( +let read_checks = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_rule_id = ref (None) in - let field_details = ref (None) in - let field_position = ref (None) in + let field_checks = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -11111,66 +9728,22 @@ let read_skipped_rule = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = 's' then ( + 0 + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - | 1 -> - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_position := ( + field_checks := ( Some ( ( - read_position + read__x_e141b07 ) p lb ) ); @@ -11186,66 +9759,22 @@ let read_skipped_rule = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = 's' then ( + 0 + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - | 1 -> - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_position := ( + field_checks := ( Some ( ( - read_position + read__x_e141b07 ) p lb ) ); @@ -11258,124 +9787,149 @@ let read_skipped_rule = ( with Yojson.End_of_object -> ( ( { - rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); - details = (match !field_details with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "details"); - position = (match !field_position with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "position"); + checks = (match !field_checks with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "checks"); } - : skipped_rule) + : checks) ) ) -let skipped_rule_of_string s = - read_skipped_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__skipped_target_list = ( +let checks_of_string s = + read_checks (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_fc09e7b = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_fixtest_result + ) +) +let string_of__x_fc09e7b ?(len = 1024) x = + let ob = Buffer.create len in + write__x_fc09e7b ob x; + Buffer.contents ob +let read__x_fc09e7b = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_fixtest_result + ) +) +let _x_fc09e7b_of_string s = + read__x_fc09e7b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_e1142f7 = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_checks + ) +) +let string_of__x_e1142f7 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_e1142f7 ob x; + Buffer.contents ob +let read__x_e1142f7 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_checks + ) +) +let _x_e1142f7_of_string s = + read__x_e1142f7 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__fpath_list = ( Atdgen_runtime.Oj_run.write_list ( - write_skipped_target + write_fpath ) ) -let string_of__skipped_target_list ?(len = 1024) x = +let string_of__fpath_list ?(len = 1024) x = let ob = Buffer.create len in - write__skipped_target_list ob x; + write__fpath_list ob x; Buffer.contents ob -let read__skipped_target_list = ( +let read__fpath_list = ( Atdgen_runtime.Oj_run.read_list ( - read_skipped_target + read_fpath ) ) -let _skipped_target_list_of_string s = - read__skipped_target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__skipped_target_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__skipped_target_list +let _fpath_list_of_string s = + read__fpath_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__config_error_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_config_error ) ) -let string_of__skipped_target_list_option ?(len = 1024) x = +let string_of__config_error_list ?(len = 1024) x = let ob = Buffer.create len in - write__skipped_target_list_option ob x; + write__config_error_list ob x; Buffer.contents ob -let read__skipped_target_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__skipped_target_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__skipped_target_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) +let read__config_error_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_config_error + ) ) -let _skipped_target_list_option_of_string s = - read__skipped_target_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scanned_and_skipped : _ -> scanned_and_skipped -> _ = ( - fun ob (x : scanned_and_skipped) -> +let _config_error_list_of_string s = + read__config_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tests_result : _ -> tests_result -> _ = ( + fun ob (x : tests_result) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"scanned\":"; + Buffer.add_string ob "\"results\":"; + ( + write__x_e1142f7 + ) + ob x.results; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fixtest_results\":"; + ( + write__x_fc09e7b + ) + ob x.fixtest_results; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"config_missing_tests\":"; ( write__fpath_list ) - ob x.scanned; - (match x.skipped with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"skipped\":"; - ( - write__skipped_target_list - ) - ob x; - ); + ob x.config_missing_tests; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"config_missing_fixtests\":"; + ( + write__fpath_list + ) + ob x.config_missing_fixtests; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"config_with_errors\":"; + ( + write__config_error_list + ) + ob x.config_with_errors; Buffer.add_char ob '}'; ) -let string_of_scanned_and_skipped ?(len = 1024) x = +let string_of_tests_result ?(len = 1024) x = let ob = Buffer.create len in - write_scanned_and_skipped ob x; + write_tests_result ob x; Buffer.contents ob -let read_scanned_and_skipped = ( +let read_tests_result = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_scanned = ref (None) in - let field_skipped = ref (None) in + let field_results = ref (None) in + let field_fixtest_results = ref (None) in + let field_config_missing_tests = ref (None) in + let field_config_missing_fixtests = ref (None) in + let field_config_with_errors = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -11384,54 +9938,95 @@ let read_scanned_and_skipped = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 && String.unsafe_get s pos = 's' then ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 's' then ( + 0 ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 15 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'u' && String.unsafe_get s (pos+12) = 'l' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 20 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 23 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'f' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'x' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_scanned := ( + field_results := ( + Some ( + ( + read__x_e1142f7 + ) p lb + ) + ); + | 1 -> + field_fixtest_results := ( + Some ( + ( + read__x_fc09e7b + ) p lb + ) + ); + | 2 -> + field_config_missing_tests := ( + Some ( + ( + read__fpath_list + ) p lb + ) + ); + | 3 -> + field_config_missing_fixtests := ( Some ( ( read__fpath_list ) p lb ) ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_skipped := ( - Some ( - ( - read__skipped_target_list - ) p lb - ) - ); - ) + | 4 -> + field_config_with_errors := ( + Some ( + ( + read__config_error_list + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -11444,54 +10039,95 @@ let read_scanned_and_skipped = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 && String.unsafe_get s pos = 's' then ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 's' then ( + 0 ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 15 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'u' && String.unsafe_get s (pos+12) = 'l' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 's' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 20 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 23 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'g' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'f' && String.unsafe_get s (pos+16) = 'i' && String.unsafe_get s (pos+17) = 'x' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_scanned := ( + field_results := ( Some ( ( - read__fpath_list + read__x_e1142f7 ) p lb ) ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_skipped := ( - Some ( - ( - read__skipped_target_list - ) p lb - ) - ); - ) + field_fixtest_results := ( + Some ( + ( + read__x_fc09e7b + ) p lb + ) + ); + | 2 -> + field_config_missing_tests := ( + Some ( + ( + read__fpath_list + ) p lb + ) + ); + | 3 -> + field_config_missing_fixtests := ( + Some ( + ( + read__fpath_list + ) p lb + ) + ); + | 4 -> + field_config_with_errors := ( + Some ( + ( + read__config_error_list + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -11501,127 +10137,258 @@ let read_scanned_and_skipped = ( with Yojson.End_of_object -> ( ( { - scanned = (match !field_scanned with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scanned"); - skipped = !field_skipped; + results = (match !field_results with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "results"); + fixtest_results = (match !field_fixtest_results with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fixtest_results"); + config_missing_tests = (match !field_config_missing_tests with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_missing_tests"); + config_missing_fixtests = (match !field_config_missing_fixtests with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_missing_fixtests"); + config_with_errors = (match !field_config_with_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config_with_errors"); } - : scanned_and_skipped) + : tests_result) ) ) -let scanned_and_skipped_of_string s = - read_scanned_and_skipped (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__int_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - Yojson.Safe.write_int - ) +let tests_result_of_string s = + read_tests_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_product = ( + fun ob x -> + match x with + | `SAST -> Buffer.add_string ob "\"sast\"" + | `SCA -> Buffer.add_string ob "\"sca\"" + | `Secrets -> Buffer.add_string ob "\"secrets\"" ) -let string_of__int_option ?(len = 1024) x = +let string_of_product ?(len = 1024) x = let ob = Buffer.create len in - write__int_option ob x; + write_product ob x; Buffer.contents ob -let read__int_option = ( +let read_product = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "None" -> + | "sast" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `SAST + | "sca" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `SCA + | "secrets" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Secrets + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "sast" -> + `SAST + | "sca" -> + `SCA + | "secrets" -> + `Secrets + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let product_of_string s = + read_product (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_lockfile_kind : _ -> lockfile_kind -> _ = ( + fun ob (x : lockfile_kind) -> + match x with + | PipRequirementsTxt -> Buffer.add_string ob "\"PipRequirementsTxt\"" + | PoetryLock -> Buffer.add_string ob "\"PoetryLock\"" + | PipfileLock -> Buffer.add_string ob "\"PipfileLock\"" + | UvLock -> Buffer.add_string ob "\"UvLock\"" + | NpmPackageLockJson -> Buffer.add_string ob "\"NpmPackageLockJson\"" + | YarnLock -> Buffer.add_string ob "\"YarnLock\"" + | PnpmLock -> Buffer.add_string ob "\"PnpmLock\"" + | GemfileLock -> Buffer.add_string ob "\"GemfileLock\"" + | GoMod -> Buffer.add_string ob "\"GoMod\"" + | CargoLock -> Buffer.add_string ob "\"CargoLock\"" + | MavenDepTree -> Buffer.add_string ob "\"MavenDepTree\"" + | GradleLockfile -> Buffer.add_string ob "\"GradleLockfile\"" + | ComposerLock -> Buffer.add_string ob "\"ComposerLock\"" + | NugetPackagesLockJson -> Buffer.add_string ob "\"NugetPackagesLockJson\"" + | PubspecLock -> Buffer.add_string ob "\"PubspecLock\"" + | SwiftPackageResolved -> Buffer.add_string ob "\"SwiftPackageResolved\"" + | MixLock -> Buffer.add_string ob "\"MixLock\"" + | ConanLock -> Buffer.add_string ob "\"ConanLock\"" +) +let string_of_lockfile_kind ?(len = 1024) x = + let ob = Buffer.create len in + write_lockfile_kind ob x; + Buffer.contents ob +let read_lockfile_kind = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "PipRequirementsTxt" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PipRequirementsTxt : lockfile_kind) + | "PoetryLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PoetryLock : lockfile_kind) + | "PipfileLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PipfileLock : lockfile_kind) + | "UvLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (UvLock : lockfile_kind) + | "NpmPackageLockJson" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (NpmPackageLockJson : lockfile_kind) + | "YarnLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (YarnLock : lockfile_kind) + | "PnpmLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PnpmLock : lockfile_kind) + | "GemfileLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (GemfileLock : lockfile_kind) + | "GoMod" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in + (GoMod : lockfile_kind) + | "CargoLock" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + (CargoLock : lockfile_kind) + | "MavenDepTree" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MavenDepTree : lockfile_kind) + | "GradleLockfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (GradleLockfile : lockfile_kind) + | "ComposerLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (ComposerLock : lockfile_kind) + | "NugetPackagesLockJson" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (NugetPackagesLockJson : lockfile_kind) + | "PubspecLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PubspecLock : lockfile_kind) + | "SwiftPackageResolved" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SwiftPackageResolved : lockfile_kind) + | "MixLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MixLock : lockfile_kind) + | "ConanLock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (ConanLock : lockfile_kind) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "PipRequirementsTxt" -> + (PipRequirementsTxt : lockfile_kind) + | "PoetryLock" -> + (PoetryLock : lockfile_kind) + | "PipfileLock" -> + (PipfileLock : lockfile_kind) + | "UvLock" -> + (UvLock : lockfile_kind) + | "NpmPackageLockJson" -> + (NpmPackageLockJson : lockfile_kind) + | "YarnLock" -> + (YarnLock : lockfile_kind) + | "PnpmLock" -> + (PnpmLock : lockfile_kind) + | "GemfileLock" -> + (GemfileLock : lockfile_kind) + | "GoMod" -> + (GoMod : lockfile_kind) + | "CargoLock" -> + (CargoLock : lockfile_kind) + | "MavenDepTree" -> + (MavenDepTree : lockfile_kind) + | "GradleLockfile" -> + (GradleLockfile : lockfile_kind) + | "ComposerLock" -> + (ComposerLock : lockfile_kind) + | "NugetPackagesLockJson" -> + (NugetPackagesLockJson : lockfile_kind) + | "PubspecLock" -> + (PubspecLock : lockfile_kind) + | "SwiftPackageResolved" -> + (SwiftPackageResolved : lockfile_kind) + | "MixLock" -> + (MixLock : lockfile_kind) + | "ConanLock" -> + (ConanLock : lockfile_kind) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _int_option_of_string s = - read__int_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_info : _ -> scan_info -> _ = ( - fun ob (x : scan_info) -> +let lockfile_kind_of_string s = + read_lockfile_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_lockfile : _ -> lockfile -> _ = ( + fun ob (x : lockfile) -> Buffer.add_char ob '{'; let is_first = ref true in - (match x.id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"id\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"enabled_products\":"; - ( - write__product_list - ) - ob x.enabled_products; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deployment_id\":"; + Buffer.add_string ob "\"kind\":"; ( - Yojson.Safe.write_int + write_lockfile_kind ) - ob x.deployment_id; + ob x.kind; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deployment_name\":"; + Buffer.add_string ob "\"path\":"; ( - Yojson.Safe.write_string + write_fpath ) - ob x.deployment_name; + ob x.path; Buffer.add_char ob '}'; ) -let string_of_scan_info ?(len = 1024) x = +let string_of_lockfile ?(len = 1024) x = let ob = Buffer.create len in - write_scan_info ob x; + write_lockfile ob x; Buffer.contents ob -let read_scan_info = ( +let read_lockfile = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_id = ref (None) in - let field_enabled_products = ref (None) in - let field_deployment_id = ref (None) in - let field_deployment_name = ref (None) in + let field_kind = ref (None) in + let field_path = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -11630,78 +10397,49 @@ let read_scan_info = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 2 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 2 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( - 3 - ) - else ( - -1 + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 1 + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 1 -> - field_enabled_products := ( - Some ( - ( - read__product_list - ) p lb - ) - ); - | 2 -> - field_deployment_id := ( + field_kind := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_lockfile_kind ) p lb ) ); - | 3 -> - field_deployment_name := ( + | 1 -> + field_path := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_fpath ) p lb ) ); @@ -11712,83 +10450,54 @@ let read_scan_info = ( while true do Yojson.Safe.read_space p lb; Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 2 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 2 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( - 3 - ) - else ( - -1 + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 1 + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 1 -> - field_enabled_products := ( - Some ( - ( - read__product_list - ) p lb - ) - ); - | 2 -> - field_deployment_id := ( + field_kind := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_lockfile_kind ) p lb ) ); - | 3 -> - field_deployment_name := ( + | 1 -> + field_path := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_fpath ) p lb ) ); @@ -11801,60 +10510,143 @@ let read_scan_info = ( with Yojson.End_of_object -> ( ( { - id = !field_id; - enabled_products = (match !field_enabled_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled_products"); - deployment_id = (match !field_deployment_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_id"); - deployment_name = (match !field_deployment_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_name"); + kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); } - : scan_info) + : lockfile) ) ) -let scan_info_of_string s = - read_scan_info (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_configuration : _ -> scan_configuration -> _ = ( - fun ob (x : scan_configuration) -> +let lockfile_of_string s = + read_lockfile (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__product_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_product + ) +) +let string_of__product_list ?(len = 1024) x = + let ob = Buffer.create len in + write__product_list ob x; + Buffer.contents ob +let read__product_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_product + ) +) +let _product_list_of_string s = + read__product_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__lockfile_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_lockfile + ) +) +let string_of__lockfile_option ?(len = 1024) x = + let ob = Buffer.create len in + write__lockfile_option ob x; + Buffer.contents ob +let read__lockfile_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_lockfile + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_lockfile + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _lockfile_option_of_string s = + read__lockfile_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_code_target : _ -> code_target -> _ = ( + fun ob (x : code_target) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"rules\":"; + Buffer.add_string ob "\"path\":"; ( - write_raw_json + write_fpath ) - ob x.rules; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; + Buffer.add_string ob "\"analyzer\":"; ( - write__string_list + write_xlang ) - ob x.triage_ignored_syntactic_ids; + ob x.analyzer; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; + Buffer.add_string ob "\"products\":"; ( - write__string_list + write__product_list ) - ob x.triage_ignored_match_based_ids; + ob x.products; + (match x.lockfile_target with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lockfile_target\":"; + ( + write_lockfile + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_scan_configuration ?(len = 1024) x = +let string_of_code_target ?(len = 1024) x = let ob = Buffer.create len in - write_scan_configuration ob x; + write_code_target ob x; Buffer.contents ob -let read_scan_configuration = ( +let read_code_target = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_rules = ref (None) in - let field_triage_ignored_syntactic_ids = ref ([]) in - let field_triage_ignored_match_based_ids = ref ([]) in + let field_path = ref (None) in + let field_analyzer = ref (None) in + let field_products = ref (None) in + let field_lockfile_target = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -11864,25 +10656,39 @@ let read_scan_configuration = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 5 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 0 ) else ( -1 ) ) - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 1 - ) - else ( - -1 - ) + | 8 -> ( + match String.unsafe_get s pos with + | 'a' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'z' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' then ( + 1 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 2 + | 15 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 't' then ( + 3 ) else ( -1 @@ -11897,27 +10703,37 @@ let read_scan_configuration = ( ( match i with | 0 -> - field_rules := ( + field_path := ( Some ( ( - read_raw_json + read_fpath ) p lb ) ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( + field_analyzer := ( + Some ( ( - read__string_list + read_xlang ) p lb - ); - ) + ) + ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( + field_products := ( + Some ( ( - read__string_list + read__product_list ) p lb + ) + ); + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_lockfile_target := ( + Some ( + ( + read_lockfile + ) p lb + ) ); ) | _ -> ( @@ -11933,25 +10749,39 @@ let read_scan_configuration = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 5 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 0 ) else ( -1 ) ) - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 1 - ) - else ( - -1 - ) + | 8 -> ( + match String.unsafe_get s pos with + | 'a' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'z' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' then ( + 1 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 2 + | 15 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 't' then ( + 3 ) else ( -1 @@ -11966,27 +10796,37 @@ let read_scan_configuration = ( ( match i with | 0 -> - field_rules := ( + field_path := ( Some ( ( - read_raw_json + read_fpath ) p lb ) ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( + field_analyzer := ( + Some ( ( - read__string_list + read_xlang ) p lb - ); - ) + ) + ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( + field_products := ( + Some ( ( - read__string_list + read__product_list ) p lb + ) + ); + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_lockfile_target := ( + Some ( + ( + read_lockfile + ) p lb + ) ); ) | _ -> ( @@ -11998,161 +10838,206 @@ let read_scan_configuration = ( with Yojson.End_of_object -> ( ( { - rules = (match !field_rules with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rules"); - triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; - triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + analyzer = (match !field_analyzer with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "analyzer"); + products = (match !field_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "products"); + lockfile_target = !field_lockfile_target; } - : scan_configuration) + : code_target) ) ) -let scan_configuration_of_string s = - read_scan_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_glob = ( - Yojson.Safe.write_string -) -let string_of_glob ?(len = 1024) x = - let ob = Buffer.create len in - write_glob ob x; - Buffer.contents ob -let read_glob = ( - Atdgen_runtime.Oj_run.read_string -) -let glob_of_string s = - read_glob (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__glob_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_glob - ) +let code_target_of_string s = + read_code_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_target = ( + fun ob x -> + match x with + | `CodeTarget x -> + Buffer.add_string ob "[\"CodeTarget\","; + ( + write_code_target + ) ob x; + Buffer.add_char ob ']' + | `LockfileTarget x -> + Buffer.add_string ob "[\"LockfileTarget\","; + ( + write_lockfile + ) ob x; + Buffer.add_char ob ']' ) -let string_of__glob_list ?(len = 1024) x = +let string_of_target ?(len = 1024) x = let ob = Buffer.create len in - write__glob_list ob x; + write_target ob x; Buffer.contents ob -let read__glob_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_glob - ) +let read_target = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "CodeTarget" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_code_target + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `CodeTarget x + | "LockfileTarget" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_lockfile + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `LockfileTarget x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "CodeTarget" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_code_target + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `CodeTarget x + | "LockfileTarget" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_lockfile + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `LockfileTarget x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let _glob_list_of_string s = - read__glob_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_c6e52f6 = ( +let target_of_string s = + read_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__target_list = ( Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_product - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__glob_list - ) ob x - ); - Buffer.add_char ob ']'; - ) -) -let string_of__x_c6e52f6 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_c6e52f6 ob x; - Buffer.contents ob -let read__x_c6e52f6 = ( - Atdgen_runtime.Oj_run.read_list ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_product - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__glob_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + write_target ) ) -let _x_c6e52f6_of_string s = - read__x_c6e52f6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_product_ignored_files = ( - write__x_c6e52f6 +let string_of__target_list ?(len = 1024) x = + let ob = Buffer.create len in + write__target_list ob x; + Buffer.contents ob +let read__target_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_target + ) ) -let string_of_product_ignored_files ?(len = 1024) x = +let _target_list_of_string s = + read__target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_targets = ( + write__target_list +) +let string_of_targets ?(len = 1024) x = let ob = Buffer.create len in - write_product_ignored_files ob x; + write_targets ob x; Buffer.contents ob -let read_product_ignored_files = ( - read__x_c6e52f6 +let read_targets = ( + read__target_list ) -let product_ignored_files_of_string s = - read_product_ignored_files (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_historical_configuration : _ -> historical_configuration -> _ = ( - fun ob (x : historical_configuration) -> +let targets_of_string s = + read_targets (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__float_list = ( + Atdgen_runtime.Oj_run.write_list ( + Yojson.Safe.write_std_float + ) +) +let string_of__float_list ?(len = 1024) x = + let ob = Buffer.create len in + write__float_list ob x; + Buffer.contents ob +let read__float_list = ( + Atdgen_runtime.Oj_run.read_list ( + Atdgen_runtime.Oj_run.read_number + ) +) +let _float_list_of_string s = + read__float_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_target_times : _ -> target_times -> _ = ( + fun ob (x : target_times) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"enabled\":"; + Buffer.add_string ob "\"path\":"; ( - Yojson.Safe.write_bool + write_fpath ) - ob x.enabled; - (match x.lookback_days with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"lookback_days\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); + ob x.path; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"num_bytes\":"; + ( + Yojson.Safe.write_int + ) + ob x.num_bytes; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"match_times\":"; + ( + write__float_list + ) + ob x.match_times; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"parse_times\":"; + ( + write__float_list + ) + ob x.parse_times; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"run_time\":"; + ( + Yojson.Safe.write_std_float + ) + ob x.run_time; Buffer.add_char ob '}'; ) -let string_of_historical_configuration ?(len = 1024) x = +let string_of_target_times ?(len = 1024) x = let ob = Buffer.create len in - write_historical_configuration ob x; + write_target_times ob x; Buffer.contents ob -let read_historical_configuration = ( +let read_target_times = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_enabled = ref (None) in - let field_lookback_days = ref (None) in + let field_path = ref (None) in + let field_num_bytes = ref (None) in + let field_match_times = ref (None) in + let field_parse_times = ref (None) in + let field_run_time = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -12162,22 +11047,52 @@ let read_historical_configuration = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 0 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' then ( + | 8 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 4 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 's' then ( 1 ) else ( -1 ) ) + | 11 -> ( + match String.unsafe_get s pos with + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) | _ -> ( -1 ) @@ -12187,23 +11102,45 @@ let read_historical_configuration = ( ( match i with | 0 -> - field_enabled := ( + field_path := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_fpath ) p lb ) ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lookback_days := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) + field_num_bytes := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_match_times := ( + Some ( + ( + read__float_list + ) p lb + ) + ); + | 3 -> + field_parse_times := ( + Some ( + ( + read__float_list + ) p lb + ) + ); + | 4 -> + field_run_time := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_number + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -12217,48 +11154,100 @@ let read_historical_configuration = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( 0 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' then ( + | 8 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( + 4 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 's' then ( 1 ) else ( -1 ) ) - | _ -> ( - -1 + | 11 -> ( + match String.unsafe_get s pos with + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 1 -> + field_num_bytes := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_match_times := ( + Some ( + ( + read__float_list + ) p lb ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_enabled := ( + ); + | 3 -> + field_parse_times := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__float_list + ) p lb + ) + ); + | 4 -> + field_run_time := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_number ) p lb ) ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lookback_days := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -12268,236 +11257,345 @@ let read_historical_configuration = ( with Yojson.End_of_object -> ( ( { - enabled = (match !field_enabled with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled"); - lookback_days = !field_lookback_days; + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + num_bytes = (match !field_num_bytes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "num_bytes"); + match_times = (match !field_match_times with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "match_times"); + parse_times = (match !field_parse_times with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "parse_times"); + run_time = (match !field_run_time with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "run_time"); } - : historical_configuration) + : target_times) ) ) -let historical_configuration_of_string s = - read_historical_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__product_ignored_files_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_product_ignored_files - ) +let target_times_of_string s = + read_target_times (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tag = ( + Yojson.Safe.write_string ) -let string_of__product_ignored_files_option ?(len = 1024) x = +let string_of_tag ?(len = 1024) x = let ob = Buffer.create len in - write__product_ignored_files_option ob x; + write_tag ob x; Buffer.contents ob -let read__product_ignored_files_option = ( +let read_tag = ( + Atdgen_runtime.Oj_run.read_string +) +let tag_of_string s = + read_tag (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_resolution_method = ( + fun ob x -> + match x with + | `LockfileParsing -> Buffer.add_string ob "\"LockfileParsing\"" + | `DynamicResolution -> Buffer.add_string ob "\"DynamicResolution\"" +) +let string_of_resolution_method ?(len = 1024) x = + let ob = Buffer.create len in + write_resolution_method ob x; + Buffer.contents ob +let read_resolution_method = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "None" -> + | "LockfileParsing" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_product_ignored_files - ) p lb - in + `LockfileParsing + | "DynamicResolution" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + `DynamicResolution | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "LockfileParsing" -> + `LockfileParsing + | "DynamicResolution" -> + `DynamicResolution + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let resolution_method_of_string s = + read_resolution_method (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_manifest_kind = ( + fun ob x -> + match x with + | `RequirementsIn -> Buffer.add_string ob "\"RequirementsIn\"" + | `PackageJson -> Buffer.add_string ob "\"PackageJson\"" + | `Gemfile -> Buffer.add_string ob "\"Gemfile\"" + | `GoMod -> Buffer.add_string ob "\"GoMod\"" + | `CargoToml -> Buffer.add_string ob "\"CargoToml\"" + | `PomXml -> Buffer.add_string ob "\"PomXml\"" + | `BuildGradle -> Buffer.add_string ob "\"BuildGradle\"" + | `SettingsGradle -> Buffer.add_string ob "\"SettingsGradle\"" + | `ComposerJson -> Buffer.add_string ob "\"ComposerJson\"" + | `NugetManifestJson -> Buffer.add_string ob "\"NugetManifestJson\"" + | `PubspecYaml -> Buffer.add_string ob "\"PubspecYaml\"" + | `PackageSwift -> Buffer.add_string ob "\"PackageSwift\"" + | `MixExs -> Buffer.add_string ob "\"MixExs\"" + | `Pipfile -> Buffer.add_string ob "\"Pipfile\"" + | `PyprojectToml -> Buffer.add_string ob "\"PyprojectToml\"" + | `ConanFileTxt -> Buffer.add_string ob "\"ConanFileTxt\"" + | `ConanFilePy -> Buffer.add_string ob "\"ConanFilePy\"" + | `Csproj -> Buffer.add_string ob "\"Csproj\"" +) +let string_of_manifest_kind ?(len = 1024) x = + let ob = Buffer.create len in + write_manifest_kind ob x; + Buffer.contents ob +let read_manifest_kind = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "RequirementsIn" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RequirementsIn + | "PackageJson" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PackageJson + | "Gemfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Gemfile + | "GoMod" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `GoMod + | "CargoToml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `CargoToml + | "PomXml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PomXml + | "BuildGradle" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `BuildGradle + | "SettingsGradle" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `SettingsGradle + | "ComposerJson" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `ComposerJson + | "NugetManifestJson" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `NugetManifestJson + | "PubspecYaml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PubspecYaml + | "PackageSwift" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PackageSwift + | "MixExs" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `MixExs + | "Pipfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pipfile + | "PyprojectToml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PyprojectToml + | "ConanFileTxt" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `ConanFileTxt + | "ConanFilePy" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `ConanFilePy + | "Csproj" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Csproj + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "RequirementsIn" -> + `RequirementsIn + | "PackageJson" -> + `PackageJson + | "Gemfile" -> + `Gemfile + | "GoMod" -> + `GoMod + | "CargoToml" -> + `CargoToml + | "PomXml" -> + `PomXml + | "BuildGradle" -> + `BuildGradle + | "SettingsGradle" -> + `SettingsGradle + | "ComposerJson" -> + `ComposerJson + | "NugetManifestJson" -> + `NugetManifestJson + | "PubspecYaml" -> + `PubspecYaml + | "PackageSwift" -> + `PackageSwift + | "MixExs" -> + `MixExs + | "Pipfile" -> + `Pipfile + | "PyprojectToml" -> + `PyprojectToml + | "ConanFileTxt" -> + `ConanFileTxt + | "ConanFilePy" -> + `ConanFilePy + | "Csproj" -> + `Csproj | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_product_ignored_files - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _product_ignored_files_option_of_string s = - read__product_ignored_files_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__historical_configuration_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_historical_configuration - ) +let manifest_kind_of_string s = + read_manifest_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_dependency_source_file_kind = ( + fun ob x -> + match x with + | `Lockfile x -> + Buffer.add_string ob "[\"Lockfile\","; + ( + write_lockfile_kind + ) ob x; + Buffer.add_char ob ']' + | `Manifest x -> + Buffer.add_string ob "[\"Manifest\","; + ( + write_manifest_kind + ) ob x; + Buffer.add_char ob ']' ) -let string_of__historical_configuration_option ?(len = 1024) x = +let string_of_dependency_source_file_kind ?(len = 1024) x = let ob = Buffer.create len in - write__historical_configuration_option ob x; + write_dependency_source_file_kind ob x; Buffer.contents ob -let read__historical_configuration_option = ( +let read_dependency_source_file_kind = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "None" -> + | "Lockfile" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_lockfile_kind + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> + `Lockfile x + | "Manifest" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_historical_configuration + read_manifest_kind ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + `Manifest x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> + | "Lockfile" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_historical_configuration + read_lockfile_kind ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + `Lockfile x + | "Manifest" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_manifest_kind + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Manifest x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _historical_configuration_option_of_string s = - read__historical_configuration_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_engine_configuration : _ -> engine_configuration -> _ = ( - fun ob (x : engine_configuration) -> +let dependency_source_file_kind_of_string s = + read_dependency_source_file_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_dependency_source_file : _ -> dependency_source_file -> _ = ( + fun ob (x : dependency_source_file) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"autofix\":"; - ( - Yojson.Safe.write_bool - ) - ob x.autofix; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"deepsemgrep\":"; - ( - Yojson.Safe.write_bool - ) - ob x.deepsemgrep; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_query\":"; - ( - Yojson.Safe.write_bool - ) - ob x.dependency_query; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path_to_transitivity\":"; - ( - Yojson.Safe.write_bool - ) - ob x.path_to_transitivity; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ignored_files\":"; - ( - write__string_list - ) - ob x.ignored_files; - (match x.product_ignored_files with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"product_ignored_files\":"; - ( - write_product_ignored_files - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"generic_slow_rollout\":"; + Buffer.add_string ob "\"kind\":"; ( - Yojson.Safe.write_bool + write_dependency_source_file_kind ) - ob x.generic_slow_rollout; - (match x.historical_config with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"historical_config\":"; - ( - write_historical_configuration - ) - ob x; - ); + ob x.kind; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"always_suppress_errors\":"; + Buffer.add_string ob "\"path\":"; ( - Yojson.Safe.write_bool + write_fpath ) - ob x.always_suppress_errors; + ob x.path; Buffer.add_char ob '}'; ) -let string_of_engine_configuration ?(len = 1024) x = +let string_of_dependency_source_file ?(len = 1024) x = let ob = Buffer.create len in - write_engine_configuration ob x; + write_dependency_source_file ob x; Buffer.contents ob -let read_engine_configuration = ( +let read_dependency_source_file = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_autofix = ref (false) in - let field_deepsemgrep = ref (false) in - let field_dependency_query = ref (false) in - let field_path_to_transitivity = ref (false) in - let field_ignored_files = ref ([]) in - let field_product_ignored_files = ref (None) in - let field_generic_slow_rollout = ref (false) in - let field_historical_config = ref (None) in - let field_always_suppress_errors = ref (false) in + let field_kind = ref (None) in + let field_path = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -12506,169 +11604,52 @@ let read_engine_configuration = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( - 0 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 1 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'f' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' then ( - 7 - ) - else ( - -1 - ) - ) - | 20 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'w' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 21 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'd' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( - 5 - ) - else ( - -1 + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'o' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 's' then ( - 8 + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( + field_kind := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_dependency_source_file_kind ) p lb - ); - ) + ) + ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( - ( - read__string_list - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_product_ignored_files := ( - Some ( - ( - read_product_ignored_files - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_generic_slow_rollout := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_config := ( - Some ( - ( - read_historical_configuration - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_always_suppress_errors := ( + field_path := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_fpath ) p lb - ); - ) + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -12681,169 +11662,52 @@ let read_engine_configuration = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( - 0 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 1 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'f' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' then ( - 7 - ) - else ( - -1 - ) - ) - | 20 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'w' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 21 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'd' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( - 5 - ) - else ( - -1 - ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'o' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 's' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( - ( - read__string_list - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_product_ignored_files := ( - Some ( - ( - read_product_ignored_files - ) p lb + if len = 4 then ( + match String.unsafe_get s pos with + | 'k' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_generic_slow_rollout := ( + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_kind := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_dependency_source_file_kind ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_config := ( - Some ( - ( - read_historical_configuration - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_always_suppress_errors := ( + ) + ); + | 1 -> + field_path := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_fpath ) p lb - ); - ) + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -12853,65 +11717,58 @@ let read_engine_configuration = ( with Yojson.End_of_object -> ( ( { - autofix = !field_autofix; - deepsemgrep = !field_deepsemgrep; - dependency_query = !field_dependency_query; - path_to_transitivity = !field_path_to_transitivity; - ignored_files = !field_ignored_files; - product_ignored_files = !field_product_ignored_files; - generic_slow_rollout = !field_generic_slow_rollout; - historical_config = !field_historical_config; - always_suppress_errors = !field_always_suppress_errors; + kind = (match !field_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "kind"); + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); } - : engine_configuration) + : dependency_source_file) ) ) -let engine_configuration_of_string s = - read_engine_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_response : _ -> scan_response -> _ = ( - fun ob (x : scan_response) -> +let dependency_source_file_of_string s = + read_dependency_source_file (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_dependency_resolution_stats : _ -> dependency_resolution_stats -> _ = ( + fun ob (x : dependency_resolution_stats) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"info\":"; + Buffer.add_string ob "\"resolution_method\":"; ( - write_scan_info + write_resolution_method ) - ob x.info; + ob x.resolution_method; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"config\":"; + Buffer.add_string ob "\"dependency_count\":"; ( - write_scan_configuration + Yojson.Safe.write_int ) - ob x.config; + ob x.dependency_count; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_params\":"; + Buffer.add_string ob "\"ecosystem\":"; ( - write_engine_configuration + write_ecosystem ) - ob x.engine_params; + ob x.ecosystem; Buffer.add_char ob '}'; ) -let string_of_scan_response ?(len = 1024) x = +let string_of_dependency_resolution_stats ?(len = 1024) x = let ob = Buffer.create len in - write_scan_response ob x; + write_dependency_resolution_stats ob x; Buffer.contents ob -let read_scan_response = ( +let read_dependency_resolution_stats = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_info = ref (None) in - let field_config = ref (None) in - let field_engine_params = ref (None) in + let field_resolution_method = ref (None) in + let field_dependency_count = ref (None) in + let field_ecosystem = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -12921,25 +11778,25 @@ let read_scan_response = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' then ( - 0 + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 2 ) else ( -1 ) ) - | 6 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' then ( + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( 1 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 's' then ( - 2 + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'd' then ( + 0 ) else ( -1 @@ -12954,26 +11811,26 @@ let read_scan_response = ( ( match i with | 0 -> - field_info := ( + field_resolution_method := ( Some ( ( - read_scan_info + read_resolution_method ) p lb ) ); | 1 -> - field_config := ( + field_dependency_count := ( Some ( ( - read_scan_configuration + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_engine_params := ( + field_ecosystem := ( Some ( ( - read_engine_configuration + read_ecosystem ) p lb ) ); @@ -12990,25 +11847,25 @@ let read_scan_response = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' then ( - 0 + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( + 2 ) else ( -1 ) ) - | 6 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' then ( + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( 1 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 's' then ( - 2 + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'd' then ( + 0 ) else ( -1 @@ -13023,26 +11880,26 @@ let read_scan_response = ( ( match i with | 0 -> - field_info := ( + field_resolution_method := ( Some ( ( - read_scan_info + read_resolution_method ) p lb ) ); | 1 -> - field_config := ( + field_dependency_count := ( Some ( ( - read_scan_configuration + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_engine_params := ( + field_ecosystem := ( Some ( ( - read_engine_configuration + read_ecosystem ) p lb ) ); @@ -13055,81 +11912,134 @@ let read_scan_response = ( with Yojson.End_of_object -> ( ( { - info = (match !field_info with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "info"); - config = (match !field_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config"); - engine_params = (match !field_engine_params with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_params"); + resolution_method = (match !field_resolution_method with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "resolution_method"); + dependency_count = (match !field_dependency_count with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_count"); + ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); } - : scan_response) + : dependency_resolution_stats) ) ) -let scan_response_of_string s = - read_scan_response (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_metadata : _ -> scan_metadata -> _ = ( - fun ob (x : scan_metadata) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cli_version\":"; - ( - write_version - ) - ob x.cli_version; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"unique_id\":"; - ( - write_uuid - ) - ob x.unique_id; +let dependency_resolution_stats_of_string s = + read_dependency_resolution_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_source_file_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_dependency_source_file + ) +) +let string_of__dependency_source_file_list ?(len = 1024) x = + let ob = Buffer.create len in + write__dependency_source_file_list ob x; + Buffer.contents ob +let read__dependency_source_file_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_dependency_source_file + ) +) +let _dependency_source_file_list_of_string s = + read__dependency_source_file_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_resolution_stats_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_dependency_resolution_stats + ) +) +let string_of__dependency_resolution_stats_option ?(len = 1024) x = + let ob = Buffer.create len in + write__dependency_resolution_stats_option ob x; + Buffer.contents ob +let read__dependency_resolution_stats_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_dependency_resolution_stats + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_dependency_resolution_stats + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _dependency_resolution_stats_option_of_string s = + read__dependency_resolution_stats_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_subproject_stats : _ -> subproject_stats -> _ = ( + fun ob (x : subproject_stats) -> + Buffer.add_char ob '{'; + let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"requested_products\":"; + Buffer.add_string ob "\"subproject_id\":"; ( - write__product_list + Yojson.Safe.write_string ) - ob x.requested_products; + ob x.subproject_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dry_run\":"; + Buffer.add_string ob "\"dependency_sources\":"; ( - Yojson.Safe.write_bool + write__dependency_source_file_list ) - ob x.dry_run; - (match x.sms_scan_id with None -> () | Some x -> + ob x.dependency_sources; + (match x.resolved_stats with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"sms_scan_id\":"; + Buffer.add_string ob "\"resolved_stats\":"; ( - Yojson.Safe.write_string + write_dependency_resolution_stats ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_scan_metadata ?(len = 1024) x = +let string_of_subproject_stats ?(len = 1024) x = let ob = Buffer.create len in - write_scan_metadata ob x; + write_subproject_stats ob x; Buffer.contents ob -let read_scan_metadata = ( +let read_subproject_stats = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_cli_version = ref (None) in - let field_unique_id = ref (None) in - let field_requested_products = ref (None) in - let field_dry_run = ref (false) in - let field_sms_scan_id = ref (None) in + let field_subproject_id = ref (None) in + let field_dependency_sources = ref (None) in + let field_resolved_stats = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13139,47 +12049,25 @@ let read_scan_metadata = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' then ( - 3 + | 13 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 0 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'q' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( - 1 + | 14 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 's' then ( + 2 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 18 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'q' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( - 2 + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' then ( + 1 ) else ( -1 @@ -13194,43 +12082,27 @@ let read_scan_metadata = ( ( match i with | 0 -> - field_cli_version := ( + field_subproject_id := ( Some ( ( - read_version + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_unique_id := ( + field_dependency_sources := ( Some ( ( - read_uuid + read__dependency_source_file_list ) p lb ) ); | 2 -> - field_requested_products := ( - Some ( - ( - read__product_list - ) p lb - ) - ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dry_run := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sms_scan_id := ( + field_resolved_stats := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_dependency_resolution_stats ) p lb ) ); @@ -13248,47 +12120,25 @@ let read_scan_metadata = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' then ( - 3 + | 13 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 0 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'q' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( - 1 + | 14 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 's' then ( + 2 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 18 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'q' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( - 2 + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'u' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 's' then ( + 1 ) else ( -1 @@ -13303,47 +12153,147 @@ let read_scan_metadata = ( ( match i with | 0 -> - field_cli_version := ( + field_subproject_id := ( Some ( ( - read_version + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_unique_id := ( + field_dependency_sources := ( Some ( ( - read_uuid + read__dependency_source_file_list ) p lb ) ); | 2 -> - field_requested_products := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_resolved_stats := ( + Some ( + ( + read_dependency_resolution_stats + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + subproject_id = (match !field_subproject_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "subproject_id"); + dependency_sources = (match !field_dependency_sources with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_sources"); + resolved_stats = !field_resolved_stats; + } + : subproject_stats) + ) +) +let subproject_stats_of_string s = + read_subproject_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__subproject_stats_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_subproject_stats + ) +) +let string_of__subproject_stats_list ?(len = 1024) x = + let ob = Buffer.create len in + write__subproject_stats_list ob x; + Buffer.contents ob +let read__subproject_stats_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_subproject_stats + ) +) +let _subproject_stats_list_of_string s = + read__subproject_stats_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_supply_chain_stats : _ -> supply_chain_stats -> _ = ( + fun ob (x : supply_chain_stats) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"subprojects_stats\":"; + ( + write__subproject_stats_list + ) + ob x.subprojects_stats; + Buffer.add_char ob '}'; +) +let string_of_supply_chain_stats ?(len = 1024) x = + let ob = Buffer.create len in + write_supply_chain_stats ob x; + Buffer.contents ob +let read_supply_chain_stats = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_subprojects_stats = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 17 && String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 's' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_subprojects_stats := ( + Some ( + ( + read__subproject_stats_list + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 17 && String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'b' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'j' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 's' then ( + 0 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_subprojects_stats := ( Some ( ( - read__product_list + read__subproject_stats_list ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dry_run := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sms_scan_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -13353,141 +12303,172 @@ let read_scan_metadata = ( with Yojson.End_of_object -> ( ( { - cli_version = (match !field_cli_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_version"); - unique_id = (match !field_unique_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unique_id"); - requested_products = (match !field_requested_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "requested_products"); - dry_run = !field_dry_run; - sms_scan_id = !field_sms_scan_id; + subprojects_stats = (match !field_subprojects_stats with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "subprojects_stats"); } - : scan_metadata) + : supply_chain_stats) ) ) -let scan_metadata_of_string s = - read_scan_metadata (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__uri_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_uri - ) -) -let string_of__uri_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__uri_nullable ob x; - Buffer.contents ob -let read__uri_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_uri - ) p lb) : _ option) -) -let _uri_nullable_of_string s = - read__uri_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - Yojson.Safe.write_string - ) -) -let string_of__string_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__string_nullable ob x; - Buffer.contents ob -let read__string_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - Atdgen_runtime.Oj_run.read_string - ) p lb) : _ option) -) -let _string_nullable_of_string s = - read__string_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__sha1_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_sha1 - ) -) -let string_of__sha1_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__sha1_nullable ob x; - Buffer.contents ob -let read__sha1_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_sha1 - ) p lb) : _ option) -) -let _sha1_nullable_of_string s = - read__sha1_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__datetime_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_datetime - ) +let supply_chain_stats_of_string s = + read_supply_chain_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_skip_reason : _ -> skip_reason -> _ = ( + fun ob (x : skip_reason) -> + match x with + | Always_skipped -> Buffer.add_string ob "\"always_skipped\"" + | Semgrepignore_patterns_match -> Buffer.add_string ob "\"semgrepignore_patterns_match\"" + | Cli_include_flags_do_not_match -> Buffer.add_string ob "\"cli_include_flags_do_not_match\"" + | Cli_exclude_flags_match -> Buffer.add_string ob "\"cli_exclude_flags_match\"" + | Exceeded_size_limit -> Buffer.add_string ob "\"exceeded_size_limit\"" + | Analysis_failed_parser_or_internal_error -> Buffer.add_string ob "\"analysis_failed_parser_or_internal_error\"" + | Excluded_by_config -> Buffer.add_string ob "\"excluded_by_config\"" + | Wrong_language -> Buffer.add_string ob "\"wrong_language\"" + | Too_big -> Buffer.add_string ob "\"too_big\"" + | Minified -> Buffer.add_string ob "\"minified\"" + | Binary -> Buffer.add_string ob "\"binary\"" + | Irrelevant_rule -> Buffer.add_string ob "\"irrelevant_rule\"" + | Too_many_matches -> Buffer.add_string ob "\"too_many_matches\"" + | Gitignore_patterns_match -> Buffer.add_string ob "\"Gitignore_patterns_match\"" + | Dotfile -> Buffer.add_string ob "\"Dotfile\"" + | Nonexistent_file -> Buffer.add_string ob "\"Nonexistent_file\"" + | Insufficient_permissions -> Buffer.add_string ob "\"insufficient_permissions\"" ) -let string_of__datetime_option ?(len = 1024) x = +let string_of_skip_reason ?(len = 1024) x = let ob = Buffer.create len in - write__datetime_option ob x; + write_skip_reason ob x; Buffer.contents ob -let read__datetime_option = ( +let read_skip_reason = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "None" -> + | "always_skipped" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_datetime - ) p lb - in + (Always_skipped : skip_reason) + | "semgrepignore_patterns_match" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + (Semgrepignore_patterns_match : skip_reason) + | "cli_include_flags_do_not_match" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Cli_include_flags_do_not_match : skip_reason) + | "cli_exclude_flags_match" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Cli_exclude_flags_match : skip_reason) + | "exceeded_size_limit" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Exceeded_size_limit : skip_reason) + | "analysis_failed_parser_or_internal_error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Analysis_failed_parser_or_internal_error : skip_reason) + | "excluded_by_config" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Excluded_by_config : skip_reason) + | "wrong_language" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Wrong_language : skip_reason) + | "too_big" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Too_big : skip_reason) + | "minified" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Minified : skip_reason) + | "binary" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Binary : skip_reason) + | "irrelevant_rule" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Irrelevant_rule : skip_reason) + | "too_many_matches" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Too_many_matches : skip_reason) + | "Gitignore_patterns_match" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Gitignore_patterns_match : skip_reason) + | "Dotfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Dotfile : skip_reason) + | "Nonexistent_file" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Nonexistent_file : skip_reason) + | "insufficient_permissions" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Insufficient_permissions : skip_reason) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "always_skipped" -> + (Always_skipped : skip_reason) + | "semgrepignore_patterns_match" -> + (Semgrepignore_patterns_match : skip_reason) + | "cli_include_flags_do_not_match" -> + (Cli_include_flags_do_not_match : skip_reason) + | "cli_exclude_flags_match" -> + (Cli_exclude_flags_match : skip_reason) + | "exceeded_size_limit" -> + (Exceeded_size_limit : skip_reason) + | "analysis_failed_parser_or_internal_error" -> + (Analysis_failed_parser_or_internal_error : skip_reason) + | "excluded_by_config" -> + (Excluded_by_config : skip_reason) + | "wrong_language" -> + (Wrong_language : skip_reason) + | "too_big" -> + (Too_big : skip_reason) + | "minified" -> + (Minified : skip_reason) + | "binary" -> + (Binary : skip_reason) + | "irrelevant_rule" -> + (Irrelevant_rule : skip_reason) + | "too_many_matches" -> + (Too_many_matches : skip_reason) + | "Gitignore_patterns_match" -> + (Gitignore_patterns_match : skip_reason) + | "Dotfile" -> + (Dotfile : skip_reason) + | "Nonexistent_file" -> + (Nonexistent_file : skip_reason) + | "insufficient_permissions" -> + (Insufficient_permissions : skip_reason) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_datetime - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _datetime_option_of_string s = - read__datetime_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__bool_option = ( +let skip_reason_of_string s = + read_skip_reason (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__rule_id_option = ( Atdgen_runtime.Oj_run.write_std_option ( - Yojson.Safe.write_bool + write_rule_id ) ) -let string_of__bool_option ?(len = 1024) x = +let string_of__rule_id_option ?(len = 1024) x = let ob = Buffer.create len in - write__bool_option ob x; + write__rule_id_option ob x; Buffer.contents ob -let read__bool_option = ( +let read__rule_id_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -13500,7 +12481,7 @@ let read__bool_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + read_rule_id ) p lb in Yojson.Safe.read_space p lb; @@ -13523,7 +12504,7 @@ let read__bool_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - Atdgen_runtime.Oj_run.read_bool + read_rule_id ) p lb in Yojson.Safe.read_space p lb; @@ -13533,310 +12514,66 @@ let read__bool_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _bool_option_of_string s = - read__bool_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_project_metadata : _ -> project_metadata -> _ = ( - fun ob (x : project_metadata) -> +let _rule_id_option_of_string s = + read__rule_id_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_skipped_target : _ -> skipped_target -> _ = ( + fun ob (x : skipped_target) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"semgrep_version\":"; - ( - write_version - ) - ob x.semgrep_version; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"scan_environment\":"; - ( - Yojson.Safe.write_string - ) - ob x.scan_environment; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"repository\":"; - ( - Yojson.Safe.write_string - ) - ob x.repository; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"repo_url\":"; - ( - write__uri_nullable - ) - ob x.repo_url; - (match x.repo_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"repo_id\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.org_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"org_id\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.repo_display_name with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"repo_display_name\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"branch\":"; - ( - write__string_nullable - ) - ob x.branch; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit\":"; - ( - write__sha1_nullable - ) - ob x.commit; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_title\":"; - ( - write__string_nullable - ) - ob x.commit_title; - (match x.commit_timestamp with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_timestamp\":"; - ( - write_datetime - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_author_email\":"; - ( - write__string_nullable - ) - ob x.commit_author_email; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_author_name\":"; - ( - write__string_nullable - ) - ob x.commit_author_name; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_author_username\":"; - ( - write__string_nullable - ) - ob x.commit_author_username; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_author_image_url\":"; - ( - write__uri_nullable - ) - ob x.commit_author_image_url; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ci_job_url\":"; - ( - write__uri_nullable - ) - ob x.ci_job_url; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"on\":"; - ( - Yojson.Safe.write_string - ) - ob x.on; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pull_request_author_username\":"; - ( - write__string_nullable - ) - ob x.pull_request_author_username; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pull_request_author_image_url\":"; - ( - write__uri_nullable - ) - ob x.pull_request_author_image_url; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pull_request_id\":"; - ( - write__string_nullable - ) - ob x.pull_request_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pull_request_title\":"; + Buffer.add_string ob "\"path\":"; ( - write__string_nullable + write_fpath ) - ob x.pull_request_title; - (match x.base_sha with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"base_sha\":"; - ( - write_sha1 - ) - ob x; - ); - (match x.start_sha with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"start_sha\":"; - ( - write_sha1 - ) - ob x; - ); + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"is_full_scan\":"; + Buffer.add_string ob "\"reason\":"; ( - Yojson.Safe.write_bool + write_skip_reason ) - ob x.is_full_scan; - (match x.is_sca_scan with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"is_sca_scan\":"; - ( - Yojson.Safe.write_bool - ) - ob x; - ); - (match x.is_code_scan with None -> () | Some x -> + ob x.reason; + (match x.details with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"is_code_scan\":"; + Buffer.add_string ob "\"details\":"; ( - Yojson.Safe.write_bool + Yojson.Safe.write_string ) ob x; ); - (match x.is_secrets_scan with None -> () | Some x -> + (match x.rule_id with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"is_secrets_scan\":"; + Buffer.add_string ob "\"rule_id\":"; ( - Yojson.Safe.write_bool + write_rule_id ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_project_metadata ?(len = 1024) x = +let string_of_skipped_target ?(len = 1024) x = let ob = Buffer.create len in - write_project_metadata ob x; + write_skipped_target ob x; Buffer.contents ob -let read_project_metadata = ( +let read_skipped_target = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_semgrep_version = ref (None) in - let field_scan_environment = ref (None) in - let field_repository = ref (None) in - let field_repo_url = ref (None) in - let field_repo_id = ref (None) in - let field_org_id = ref (None) in - let field_repo_display_name = ref (None) in - let field_branch = ref (None) in - let field_commit = ref (None) in - let field_commit_title = ref (None) in - let field_commit_timestamp = ref (None) in - let field_commit_author_email = ref (None) in - let field_commit_author_name = ref (None) in - let field_commit_author_username = ref (None) in - let field_commit_author_image_url = ref (None) in - let field_ci_job_url = ref (None) in - let field_on = ref (None) in - let field_pull_request_author_username = ref (None) in - let field_pull_request_author_image_url = ref (None) in - let field_pull_request_id = ref (None) in - let field_pull_request_title = ref (None) in - let field_base_sha = ref (None) in - let field_start_sha = ref (None) in - let field_is_full_scan = ref (None) in - let field_is_sca_scan = ref (None) in - let field_is_code_scan = ref (None) in - let field_is_secrets_scan = ref (None) in + let field_path = ref (None) in + let field_reason = ref (None) in + let field_details = ref (None) in + let field_rule_id = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13846,226 +12583,35 @@ let read_project_metadata = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 2 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'n' then ( - 16 + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 0 ) else ( -1 ) ) | 6 -> ( - match String.unsafe_get s pos with - | 'b' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' then ( - 7 - ) - else ( - -1 - ) - ) - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | 'o' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'd' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'b' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'h' && String.unsafe_get s (pos+7) = 'a' then ( - 21 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'l' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' then ( - 22 + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' then ( + 1 ) else ( -1 ) ) - | 10 -> ( + | 7 -> ( match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'l' then ( - 15 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'y' then ( + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( 2 ) else ( -1 ) ) - | _ -> ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'n' then ( - 24 - ) - else ( - -1 - ) - ) - | 12 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' then ( - 9 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' then ( - match String.unsafe_get s (pos+3) with - | 'c' -> ( - if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( - 25 - ) - else ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( - 23 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 15 -> ( - match String.unsafe_get s pos with - | 'i' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'n' then ( - 26 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'd' then ( - 19 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 16 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'p' then ( - 10 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'v' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'e' then ( - 6 - ) - else ( - -1 - ) - ) - | 18 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( - 12 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'e' then ( - 20 + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 3 ) else ( -1 @@ -14075,46 +12621,6 @@ let read_project_metadata = ( -1 ) ) - | 19 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' then ( - 11 - ) - else ( - -1 - ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'n' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'm' && String.unsafe_get s (pos+21) = 'e' then ( - 13 - ) - else ( - -1 - ) - ) - | 23 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'g' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 'r' && String.unsafe_get s (pos+22) = 'l' then ( - 14 - ) - else ( - -1 - ) - ) - | 28 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 's' && String.unsafe_get s (pos+22) = 'e' && String.unsafe_get s (pos+23) = 'r' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'a' && String.unsafe_get s (pos+26) = 'm' && String.unsafe_get s (pos+27) = 'e' then ( - 17 - ) - else ( - -1 - ) - ) - | 29 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 'm' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = '_' && String.unsafe_get s (pos+26) = 'u' && String.unsafe_get s (pos+27) = 'r' && String.unsafe_get s (pos+28) = 'l' then ( - 18 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) @@ -14124,235 +12630,37 @@ let read_project_metadata = ( ( match i with | 0 -> - field_semgrep_version := ( + field_path := ( Some ( ( - read_version + read_fpath ) p lb ) ); | 1 -> - field_scan_environment := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_repository := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 3 -> - field_repo_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_org_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_display_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 7 -> - field_branch := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 8 -> - field_commit := ( - Some ( - ( - read__sha1_nullable - ) p lb - ) - ); - | 9 -> - field_commit_title := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_commit_timestamp := ( - Some ( - ( - read_datetime - ) p lb - ) - ); - ) - | 11 -> - field_commit_author_email := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 12 -> - field_commit_author_name := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 13 -> - field_commit_author_username := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 14 -> - field_commit_author_image_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 15 -> - field_ci_job_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 16 -> - field_on := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 17 -> - field_pull_request_author_username := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 18 -> - field_pull_request_author_image_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 19 -> - field_pull_request_id := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 20 -> - field_pull_request_title := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 21 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_base_sha := ( - Some ( - ( - read_sha1 - ) p lb - ) - ); - ) - | 22 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_start_sha := ( - Some ( - ( - read_sha1 - ) p lb - ) - ); - ) - | 23 -> - field_is_full_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 24 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_sca_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 25 -> + field_reason := ( + Some ( + ( + read_skip_reason + ) p lb + ) + ); + | 2 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_code_scan := ( + field_details := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 26 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_secrets_scan := ( + field_rule_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_rule_id ) p lb ) ); @@ -14370,64 +12678,34 @@ let read_project_metadata = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 2 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'n' then ( - 16 + | 4 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 0 ) else ( -1 ) ) | 6 -> ( - match String.unsafe_get s pos with - | 'b' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' then ( - 7 - ) - else ( - -1 - ) - ) - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | 'o' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'd' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 4 + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' then ( + 1 ) else ( -1 ) ) - | 8 -> ( + | 7 -> ( match String.unsafe_get s pos with - | 'b' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'h' && String.unsafe_get s (pos+7) = 'a' then ( - 21 + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( + 2 ) else ( -1 ) ) | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'l' then ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( 3 ) else ( @@ -14438,27 +12716,210 @@ let read_project_metadata = ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' then ( - 22 + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 1 -> + field_reason := ( + Some ( + ( + read_skip_reason + ) p lb + ) + ); + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_details := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb ) - else ( - -1 + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + reason = (match !field_reason with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reason"); + details = !field_details; + rule_id = !field_rule_id; + } + : skipped_target) + ) +) +let skipped_target_of_string s = + read_skipped_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_skipped_rule : _ -> skipped_rule -> _ = ( + fun ob (x : skipped_rule) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"rule_id\":"; + ( + write_rule_id + ) + ob x.rule_id; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"details\":"; + ( + Yojson.Safe.write_string + ) + ob x.details; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"position\":"; + ( + write_position + ) + ob x.position; + Buffer.add_char ob '}'; +) +let string_of_skipped_rule ?(len = 1024) x = + let ob = Buffer.create len in + write_skipped_rule ob x; + Buffer.contents ob +let read_skipped_rule = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_rule_id = ref (None) in + let field_details = ref (None) in + let field_position = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( + 2 ) - | 10 -> ( + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + | 1 -> + field_details := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_position := ( + Some ( + ( + read_position + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'l' then ( - 15 + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 's' then ( + 1 ) else ( -1 ) ) | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'y' then ( - 2 + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 0 ) else ( -1 @@ -14468,172 +12929,485 @@ let read_project_metadata = ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'n' then ( - 24 + | 8 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( + 2 ) else ( -1 ) ) - | 12 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' then ( - 9 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' then ( - match String.unsafe_get s (pos+3) with - | 'c' -> ( - if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( - 25 - ) - else ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( - 23 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | _ -> ( + -1 ) - | 15 -> ( - match String.unsafe_get s pos with - | 'i' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'n' then ( - 26 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'd' then ( - 19 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb ) - | 16 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'p' then ( - 10 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'v' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + ); + | 1 -> + field_details := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_position := ( + Some ( + ( + read_position + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); + details = (match !field_details with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "details"); + position = (match !field_position with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "position"); + } + : skipped_rule) + ) +) +let skipped_rule_of_string s = + read_skipped_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__skipped_target_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_skipped_target + ) +) +let string_of__skipped_target_list ?(len = 1024) x = + let ob = Buffer.create len in + write__skipped_target_list ob x; + Buffer.contents ob +let read__skipped_target_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_skipped_target + ) +) +let _skipped_target_list_of_string s = + read__skipped_target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__skipped_target_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__skipped_target_list + ) +) +let string_of__skipped_target_list_option ?(len = 1024) x = + let ob = Buffer.create len in + write__skipped_target_list_option ob x; + Buffer.contents ob +let read__skipped_target_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__skipped_target_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__skipped_target_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _skipped_target_list_option_of_string s = + read__skipped_target_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scanned_and_skipped : _ -> scanned_and_skipped -> _ = ( + fun ob (x : scanned_and_skipped) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"scanned\":"; + ( + write__fpath_list + ) + ob x.scanned; + (match x.skipped with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"skipped\":"; + ( + write__skipped_target_list + ) + ob x; + ); + Buffer.add_char ob '}'; +) +let string_of_scanned_and_skipped ?(len = 1024) x = + let ob = Buffer.create len in + write_scanned_and_skipped ob x; + Buffer.contents ob +let read_scanned_and_skipped = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_scanned = ref (None) in + let field_skipped = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 7 && String.unsafe_get s pos = 's' then ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'e' then ( - 6 + | 'k' -> ( + if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 1 ) else ( -1 ) ) - | 18 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( - 12 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'e' then ( - 20 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | _ -> ( + -1 ) - | 19 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' then ( - 11 + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_scanned := ( + Some ( + ( + read__fpath_list + ) p lb + ) + ); + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_skipped := ( + Some ( + ( + read__skipped_target_list + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + if len = 7 && String.unsafe_get s pos = 's' then ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - else ( + | 'k' -> ( + if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( -1 ) + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_scanned := ( + Some ( + ( + read__fpath_list + ) p lb + ) + ); + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_skipped := ( + Some ( + ( + read__skipped_target_list + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + scanned = (match !field_scanned with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scanned"); + skipped = !field_skipped; + } + : scanned_and_skipped) + ) +) +let scanned_and_skipped_of_string s = + read_scanned_and_skipped (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_info : _ -> scan_info -> _ = ( + fun ob (x : scan_info) -> + Buffer.add_char ob '{'; + let is_first = ref true in + (match x.id with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"id\":"; + ( + Yojson.Safe.write_int + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"enabled_products\":"; + ( + write__product_list + ) + ob x.enabled_products; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"deployment_id\":"; + ( + Yojson.Safe.write_int + ) + ob x.deployment_id; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"deployment_name\":"; + ( + Yojson.Safe.write_string + ) + ob x.deployment_name; + Buffer.add_char ob '}'; +) +let string_of_scan_info ?(len = 1024) x = + let ob = Buffer.create len in + write_scan_info ob x; + Buffer.contents ob +let read_scan_info = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_id = ref (None) in + let field_enabled_products = ref (None) in + let field_deployment_id = ref (None) in + let field_deployment_name = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 2 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | 13 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 2 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 1 ) - | 22 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'n' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'm' && String.unsafe_get s (pos+21) = 'e' then ( - 13 + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + ) + | 1 -> + field_enabled_products := ( + Some ( + ( + read__product_list + ) p lb + ) + ); + | 2 -> + field_deployment_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 3 -> + field_deployment_name := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 2 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then ( + 0 ) else ( -1 ) ) - | 23 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'g' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 'r' && String.unsafe_get s (pos+22) = 'l' then ( - 14 + | 13 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 2 ) else ( -1 ) ) - | 28 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 's' && String.unsafe_get s (pos+22) = 'e' && String.unsafe_get s (pos+23) = 'r' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'a' && String.unsafe_get s (pos+26) = 'm' && String.unsafe_get s (pos+27) = 'e' then ( - 17 + | 15 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( + 3 ) else ( -1 ) ) - | 29 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 'm' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = '_' && String.unsafe_get s (pos+26) = 'u' && String.unsafe_get s (pos+27) = 'r' && String.unsafe_get s (pos+28) = 'l' then ( - 18 + | 16 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 1 ) else ( -1 @@ -14648,235 +13422,502 @@ let read_project_metadata = ( ( match i with | 0 -> - field_semgrep_version := ( - Some ( - ( - read_version - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + ) | 1 -> - field_scan_environment := ( + field_enabled_products := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__product_list ) p lb ) ); | 2 -> - field_repository := ( + field_deployment_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 3 -> - field_repo_url := ( + field_deployment_name := ( Some ( ( - read__uri_nullable + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); + | _ -> ( + Yojson.Safe.skip_json p lb ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_org_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + id = !field_id; + enabled_products = (match !field_enabled_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled_products"); + deployment_id = (match !field_deployment_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_id"); + deployment_name = (match !field_deployment_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_name"); + } + : scan_info) + ) +) +let scan_info_of_string s = + read_scan_info (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_configuration : _ -> scan_configuration -> _ = ( + fun ob (x : scan_configuration) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"rules\":"; + ( + write_raw_json + ) + ob x.rules; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; + ( + write__string_list + ) + ob x.triage_ignored_syntactic_ids; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; + ( + write__string_list + ) + ob x.triage_ignored_match_based_ids; + Buffer.add_char ob '}'; +) +let string_of_scan_configuration ?(len = 1024) x = + let ob = Buffer.create len in + write_scan_configuration ob x; + Buffer.contents ob +let read_scan_configuration = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_rules = ref (None) in + let field_triage_ignored_syntactic_ids = ref ([]) in + let field_triage_ignored_match_based_ids = ref ([]) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 5 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 1 + ) + else ( + -1 + ) + ) + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_rules := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( + ( + read__string_list + ) p lb + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( + ( + read__string_list + ) p lb + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 5 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 0 ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_display_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb + else ( + -1 ) - ); - ) - | 7 -> - field_branch := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 8 -> - field_commit := ( - Some ( - ( - read__sha1_nullable - ) p lb ) - ); - | 9 -> - field_commit_title := ( - Some ( - ( - read__string_nullable - ) p lb + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 1 + ) + else ( + -1 + ) ) - ); - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_commit_timestamp := ( - Some ( - ( - read_datetime - ) p lb + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 2 + ) + else ( + -1 ) - ); - ) - | 11 -> - field_commit_author_email := ( - Some ( - ( - read__string_nullable - ) p lb ) - ); - | 12 -> - field_commit_author_name := ( - Some ( - ( - read__string_nullable - ) p lb + | _ -> ( + -1 ) - ); - | 13 -> - field_commit_author_username := ( + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_rules := ( Some ( ( - read__string_nullable + read_raw_json ) p lb ) ); - | 14 -> - field_commit_author_image_url := ( - Some ( + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( ( - read__uri_nullable + read__string_list ) p lb - ) - ); - | 15 -> - field_ci_job_url := ( - Some ( + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( ( - read__uri_nullable + read__string_list ) p lb + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + rules = (match !field_rules with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rules"); + triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; + triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; + } + : scan_configuration) + ) +) +let scan_configuration_of_string s = + read_scan_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_glob = ( + Yojson.Safe.write_string +) +let string_of_glob ?(len = 1024) x = + let ob = Buffer.create len in + write_glob ob x; + Buffer.contents ob +let read_glob = ( + Atdgen_runtime.Oj_run.read_string +) +let glob_of_string s = + read_glob (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__glob_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_glob + ) +) +let string_of__glob_list ?(len = 1024) x = + let ob = Buffer.create len in + write__glob_list ob x; + Buffer.contents ob +let read__glob_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_glob + ) +) +let _glob_list_of_string s = + read__glob_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_c6e52f6 = ( + Atdgen_runtime.Oj_run.write_list ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_product + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write__glob_list + ) ob x + ); + Buffer.add_char ob ']'; + ) +) +let string_of__x_c6e52f6 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_c6e52f6 ob x; + Buffer.contents ob +let read__x_c6e52f6 = ( + Atdgen_runtime.Oj_run.read_list ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_product + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read__glob_list + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + ) +) +let _x_c6e52f6_of_string s = + read__x_c6e52f6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_product_ignored_files = ( + write__x_c6e52f6 +) +let string_of_product_ignored_files ?(len = 1024) x = + let ob = Buffer.create len in + write_product_ignored_files ob x; + Buffer.contents ob +let read_product_ignored_files = ( + read__x_c6e52f6 +) +let product_ignored_files_of_string s = + read_product_ignored_files (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_historical_configuration : _ -> historical_configuration -> _ = ( + fun ob (x : historical_configuration) -> + Buffer.add_char ob '{'; + let is_first = ref true in + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"enabled\":"; + ( + Yojson.Safe.write_bool + ) + ob x.enabled; + (match x.lookback_days with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lookback_days\":"; + ( + Yojson.Safe.write_int + ) + ob x; + ); + Buffer.add_char ob '}'; +) +let string_of_historical_configuration ?(len = 1024) x = + let ob = Buffer.create len in + write_historical_configuration ob x; + Buffer.contents ob +let read_historical_configuration = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_enabled = ref (None) in + let field_lookback_days = ref (None) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 0 ) - ); - | 16 -> - field_on := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb + else ( + -1 ) - ); - | 17 -> - field_pull_request_author_username := ( - Some ( - ( - read__string_nullable - ) p lb + ) + | 13 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' then ( + 1 ) - ); - | 18 -> - field_pull_request_author_image_url := ( - Some ( - ( - read__uri_nullable - ) p lb + else ( + -1 ) - ); - | 19 -> - field_pull_request_id := ( + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_enabled := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_lookback_days := ( Some ( ( - read__string_nullable + Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 20 -> - field_pull_request_title := ( - Some ( - ( - read__string_nullable - ) p lb + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 7 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ); - | 21 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_base_sha := ( - Some ( - ( - read_sha1 - ) p lb + | 13 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'b' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' then ( + 1 ) - ); - ) - | 22 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_start_sha := ( - Some ( - ( - read_sha1 - ) p lb + else ( + -1 ) - ); - ) - | 23 -> - field_is_full_scan := ( + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_enabled := ( Some ( ( Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 24 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_sca_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 25 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_code_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 26 -> + | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_secrets_scan := ( + field_lookback_days := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); @@ -14890,65 +13931,81 @@ let read_project_metadata = ( with Yojson.End_of_object -> ( ( { - semgrep_version = (match !field_semgrep_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "semgrep_version"); - scan_environment = (match !field_scan_environment with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scan_environment"); - repository = (match !field_repository with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repository"); - repo_url = (match !field_repo_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repo_url"); - repo_id = !field_repo_id; - org_id = !field_org_id; - repo_display_name = !field_repo_display_name; - branch = (match !field_branch with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "branch"); - commit = (match !field_commit with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit"); - commit_title = (match !field_commit_title with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_title"); - commit_timestamp = !field_commit_timestamp; - commit_author_email = (match !field_commit_author_email with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_email"); - commit_author_name = (match !field_commit_author_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_name"); - commit_author_username = (match !field_commit_author_username with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_username"); - commit_author_image_url = (match !field_commit_author_image_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_image_url"); - ci_job_url = (match !field_ci_job_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ci_job_url"); - on = (match !field_on with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "on"); - pull_request_author_username = (match !field_pull_request_author_username with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_author_username"); - pull_request_author_image_url = (match !field_pull_request_author_image_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_author_image_url"); - pull_request_id = (match !field_pull_request_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_id"); - pull_request_title = (match !field_pull_request_title with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_title"); - base_sha = !field_base_sha; - start_sha = !field_start_sha; - is_full_scan = (match !field_is_full_scan with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_full_scan"); - is_sca_scan = !field_is_sca_scan; - is_code_scan = !field_is_code_scan; - is_secrets_scan = !field_is_secrets_scan; + enabled = (match !field_enabled with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled"); + lookback_days = !field_lookback_days; } - : project_metadata) + : historical_configuration) ) ) -let project_metadata_of_string s = - read_project_metadata (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__tag_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_tag +let historical_configuration_of_string s = + read_historical_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__product_ignored_files_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_product_ignored_files ) ) -let string_of__tag_list ?(len = 1024) x = +let string_of__product_ignored_files_option ?(len = 1024) x = let ob = Buffer.create len in - write__tag_list ob x; + write__product_ignored_files_option ob x; Buffer.contents ob -let read__tag_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_tag - ) +let read__product_ignored_files_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_product_ignored_files + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_product_ignored_files + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let _tag_list_of_string s = - read__tag_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__tag_list_option = ( +let _product_ignored_files_option_of_string s = + read__product_ignored_files_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__historical_configuration_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write__tag_list + write_historical_configuration ) ) -let string_of__tag_list_option ?(len = 1024) x = +let string_of__historical_configuration_option ?(len = 1024) x = let ob = Buffer.create len in - write__tag_list_option ob x; + write__historical_configuration_option ob x; Buffer.contents ob -let read__tag_list_option = ( +let read__historical_configuration_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -14961,7 +14018,7 @@ let read__tag_list_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__tag_list + read_historical_configuration ) p lb in Yojson.Safe.read_space p lb; @@ -14984,7 +14041,7 @@ let read__tag_list_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__tag_list + read_historical_configuration ) p lb in Yojson.Safe.read_space p lb; @@ -14994,44 +14051,116 @@ let read__tag_list_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _tag_list_option_of_string s = - read__tag_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_config_from_repo : _ -> ci_config_from_repo -> _ = ( - fun ob (x : ci_config_from_repo) -> +let _historical_configuration_option_of_string s = + read__historical_configuration_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_engine_configuration : _ -> engine_configuration -> _ = ( + fun ob (x : engine_configuration) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"version\":"; + Buffer.add_string ob "\"autofix\":"; ( - write_version + Yojson.Safe.write_bool ) - ob x.version; - (match x.tags with None -> () | Some x -> + ob x.autofix; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"deepsemgrep\":"; + ( + Yojson.Safe.write_bool + ) + ob x.deepsemgrep; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dependency_query\":"; + ( + Yojson.Safe.write_bool + ) + ob x.dependency_query; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path_to_transitivity\":"; + ( + Yojson.Safe.write_bool + ) + ob x.path_to_transitivity; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ignored_files\":"; + ( + write__string_list + ) + ob x.ignored_files; + (match x.product_ignored_files with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"tags\":"; + Buffer.add_string ob "\"product_ignored_files\":"; ( - write__tag_list + write_product_ignored_files + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"generic_slow_rollout\":"; + ( + Yojson.Safe.write_bool + ) + ob x.generic_slow_rollout; + (match x.historical_config with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"historical_config\":"; + ( + write_historical_configuration ) ob x; ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"always_suppress_errors\":"; + ( + Yojson.Safe.write_bool + ) + ob x.always_suppress_errors; Buffer.add_char ob '}'; ) -let string_of_ci_config_from_repo ?(len = 1024) x = +let string_of_engine_configuration ?(len = 1024) x = let ob = Buffer.create len in - write_ci_config_from_repo ob x; + write_engine_configuration ob x; Buffer.contents ob -let read_ci_config_from_repo = ( +let read_engine_configuration = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_version = ref ("") in - let field_tags = ref (None) in + let field_autofix = ref (false) in + let field_deepsemgrep = ref (false) in + let field_dependency_query = ref (false) in + let field_path_to_transitivity = ref (false) in + let field_ignored_files = ref ([]) in + let field_product_ignored_files = ref (None) in + let field_generic_slow_rollout = ref (false) in + let field_historical_config = ref (None) in + let field_always_suppress_errors = ref (false) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -15041,48 +14170,168 @@ let read_ci_config_from_repo = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 's' then ( + | 7 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 0 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( 1 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 0 + | 13 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 2 + ) + else ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'f' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' then ( + 7 + ) + else ( + -1 + ) + ) + | 20 -> ( + match String.unsafe_get s pos with + | 'g' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'w' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 21 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'd' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'o' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 's' then ( + 8 ) else ( -1 ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_autofix := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 1 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list + ) p lb + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_product_ignored_files := ( + Some ( + ( + read_product_ignored_files + ) p lb + ) + ); + ) + | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_version := ( + field_generic_slow_rollout := ( ( - read_version + Atdgen_runtime.Oj_run.read_bool ) p lb ); ) - | 1 -> + | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_tags := ( + field_historical_config := ( Some ( ( - read__tag_list + read_historical_configuration ) p lb ) ); ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_always_suppress_errors := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -15096,17 +14345,79 @@ let read_ci_config_from_repo = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 4 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 's' then ( + | 7 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 0 + ) + else ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( 1 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 0 + | 13 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 2 + ) + else ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'f' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' then ( + 7 + ) + else ( + -1 + ) + ) + | 20 -> ( + match String.unsafe_get s pos with + | 'g' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'c' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'w' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 21 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'd' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = '_' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'o' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 's' then ( + 8 ) else ( -1 @@ -15122,22 +14433,80 @@ let read_ci_config_from_repo = ( match i with | 0 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_version := ( + field_autofix := ( ( - read_version + Atdgen_runtime.Oj_run.read_bool ) p lb ); ) | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_tags := ( + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list + ) p lb + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_product_ignored_files := ( Some ( ( - read__tag_list + read_product_ignored_files + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_generic_slow_rollout := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_config := ( + Some ( + ( + read_historical_configuration ) p lb ) ); ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_always_suppress_errors := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -15147,129 +14516,65 @@ let read_ci_config_from_repo = ( with Yojson.End_of_object -> ( ( { - version = !field_version; - tags = !field_tags; + autofix = !field_autofix; + deepsemgrep = !field_deepsemgrep; + dependency_query = !field_dependency_query; + path_to_transitivity = !field_path_to_transitivity; + ignored_files = !field_ignored_files; + product_ignored_files = !field_product_ignored_files; + generic_slow_rollout = !field_generic_slow_rollout; + historical_config = !field_historical_config; + always_suppress_errors = !field_always_suppress_errors; } - : ci_config_from_repo) - ) -) -let ci_config_from_repo_of_string s = - read_ci_config_from_repo (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ci_config_from_repo_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_ci_config_from_repo - ) -) -let string_of__ci_config_from_repo_option ?(len = 1024) x = - let ob = Buffer.create len in - write__ci_config_from_repo_option ob x; - Buffer.contents ob -let read__ci_config_from_repo_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_ci_config_from_repo - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_ci_config_from_repo - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + : engine_configuration) + ) ) -let _ci_config_from_repo_option_of_string s = - read__ci_config_from_repo_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_request : _ -> scan_request -> _ = ( - fun ob (x : scan_request) -> +let engine_configuration_of_string s = + read_engine_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_response : _ -> scan_response -> _ = ( + fun ob (x : scan_response) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"project_metadata\":"; + Buffer.add_string ob "\"info\":"; ( - write_project_metadata + write_scan_info ) - ob x.project_metadata; + ob x.info; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"scan_metadata\":"; + Buffer.add_string ob "\"config\":"; ( - write_scan_metadata + write_scan_configuration ) - ob x.scan_metadata; - (match x.project_config with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"project_config\":"; - ( - write_ci_config_from_repo - ) - ob x; - ); - (match x.meta with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"meta\":"; - ( - write_raw_json - ) - ob x; - ); + ob x.config; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"engine_params\":"; + ( + write_engine_configuration + ) + ob x.engine_params; Buffer.add_char ob '}'; ) -let string_of_scan_request ?(len = 1024) x = +let string_of_scan_response ?(len = 1024) x = let ob = Buffer.create len in - write_scan_request ob x; + write_scan_response ob x; Buffer.contents ob -let read_scan_request = ( +let read_scan_response = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_project_metadata = ref (None) in - let field_scan_metadata = ref (None) in - let field_project_config = ref (None) in - let field_meta = ref (None) in + let field_info = ref (None) in + let field_config = ref (None) in + let field_engine_params = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -15280,37 +14585,29 @@ let read_scan_request = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - 3 + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' then ( + 0 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'a' then ( + | 6 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' then ( 1 ) else ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'f' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'g' then ( + | 13 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 's' then ( 2 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'd' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' then ( - 0 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) @@ -15320,41 +14617,29 @@ let read_scan_request = ( ( match i with | 0 -> - field_project_metadata := ( + field_info := ( Some ( ( - read_project_metadata + read_scan_info ) p lb ) ); | 1 -> - field_scan_metadata := ( + field_config := ( Some ( ( - read_scan_metadata + read_scan_configuration ) p lb ) ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_project_config := ( - Some ( - ( - read_ci_config_from_repo - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_meta := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) + field_engine_params := ( + Some ( + ( + read_engine_configuration + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -15369,37 +14654,29 @@ let read_scan_request = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - 3 + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'o' then ( + 0 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'a' then ( + | 6 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' then ( 1 ) else ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'f' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'g' then ( + | 13 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 's' then ( 2 ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'd' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' then ( - 0 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) @@ -15409,41 +14686,29 @@ let read_scan_request = ( ( match i with | 0 -> - field_project_metadata := ( + field_info := ( Some ( ( - read_project_metadata + read_scan_info ) p lb ) ); | 1 -> - field_scan_metadata := ( + field_config := ( Some ( ( - read_scan_metadata + read_scan_configuration ) p lb ) ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_project_config := ( - Some ( - ( - read_ci_config_from_repo - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_meta := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - ) + field_engine_params := ( + Some ( + ( + read_engine_configuration + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -15453,132 +14718,81 @@ let read_scan_request = ( with Yojson.End_of_object -> ( ( { - project_metadata = (match !field_project_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "project_metadata"); - scan_metadata = (match !field_scan_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scan_metadata"); - project_config = !field_project_config; - meta = !field_meta; + info = (match !field_info with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "info"); + config = (match !field_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "config"); + engine_params = (match !field_engine_params with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_params"); } - : scan_request) + : scan_response) ) ) -let scan_request_of_string s = - read_scan_request (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_4053a06 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - Yojson.Safe.write_string - ) -) -let string_of__x_4053a06 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_4053a06 ob x; - Buffer.contents ob -let read__x_4053a06 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - Atdgen_runtime.Oj_run.read_string - ) -) -let _x_4053a06_of_string s = - read__x_4053a06 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_env = ( - write__x_4053a06 -) -let string_of_ci_env ?(len = 1024) x = - let ob = Buffer.create len in - write_ci_env ob x; - Buffer.contents ob -let read_ci_env = ( - read__x_4053a06 -) -let ci_env_of_string s = - read_ci_env (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_config : _ -> ci_config -> _ = ( - fun ob (x : ci_config) -> +let scan_response_of_string s = + read_scan_response (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_metadata : _ -> scan_metadata -> _ = ( + fun ob (x : scan_metadata) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"env\":"; - ( - write_ci_env - ) - ob x.env; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"enabled_products\":"; - ( - write__product_list - ) - ob x.enabled_products; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ignored_files\":"; - ( - write__string_list - ) - ob x.ignored_files; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"autofix\":"; + Buffer.add_string ob "\"cli_version\":"; ( - Yojson.Safe.write_bool + write_version ) - ob x.autofix; + ob x.cli_version; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deepsemgrep\":"; + Buffer.add_string ob "\"unique_id\":"; ( - Yojson.Safe.write_bool + write_uuid ) - ob x.deepsemgrep; + ob x.unique_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_query\":"; + Buffer.add_string ob "\"requested_products\":"; ( - Yojson.Safe.write_bool + write__product_list ) - ob x.dependency_query; + ob x.requested_products; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path_to_transitivity\":"; + Buffer.add_string ob "\"dry_run\":"; ( Yojson.Safe.write_bool ) - ob x.path_to_transitivity; + ob x.dry_run; + (match x.sms_scan_id with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"sms_scan_id\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_ci_config ?(len = 1024) x = +let string_of_scan_metadata ?(len = 1024) x = let ob = Buffer.create len in - write_ci_config ob x; + write_scan_metadata ob x; Buffer.contents ob -let read_ci_config = ( +let read_scan_metadata = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_env = ref (None) in - let field_enabled_products = ref (None) in - let field_ignored_files = ref (None) in - let field_autofix = ref (false) in - let field_deepsemgrep = ref (false) in - let field_dependency_query = ref (false) in - let field_path_to_transitivity = ref (false) in + let field_cli_version = ref (None) in + let field_unique_id = ref (None) in + let field_requested_products = ref (None) in + let field_dry_run = ref (false) in + let field_sms_scan_id = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -15588,51 +14802,35 @@ let read_ci_config = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'v' then ( - 0 - ) - else ( - -1 - ) - ) | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' then ( 3 ) else ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 4 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 2 + | 9 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'q' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( + 1 ) else ( -1 ) ) - | 16 -> ( + | 11 -> ( match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 5 + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 0 ) else ( -1 ) ) - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 1 + | 's' -> ( + if String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'd' then ( + 4 ) else ( -1 @@ -15642,9 +14840,9 @@ let read_ci_config = ( -1 ) ) - | 20 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 6 + | 18 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'q' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( + 2 ) else ( -1 @@ -15659,32 +14857,32 @@ let read_ci_config = ( ( match i with | 0 -> - field_env := ( + field_cli_version := ( Some ( ( - read_ci_env + read_version ) p lb ) ); | 1 -> - field_enabled_products := ( + field_unique_id := ( Some ( ( - read__product_list + read_uuid ) p lb ) ); | 2 -> - field_ignored_files := ( + field_requested_products := ( Some ( ( - read__string_list + read__product_list ) p lb ) ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( + field_dry_run := ( ( Atdgen_runtime.Oj_run.read_bool ) p lb @@ -15692,26 +14890,12 @@ let read_ci_config = ( ) | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb + field_sms_scan_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) ); ) | _ -> ( @@ -15727,51 +14911,35 @@ let read_ci_config = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'v' then ( - 0 - ) - else ( - -1 - ) - ) | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' then ( 3 ) else ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 4 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 2 + | 9 -> ( + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'q' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( + 1 ) else ( -1 ) ) - | 16 -> ( + | 11 -> ( match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 5 + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 0 ) else ( -1 ) ) - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 1 + | 's' -> ( + if String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'd' then ( + 4 ) else ( -1 @@ -15781,9 +14949,9 @@ let read_ci_config = ( -1 ) ) - | 20 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 6 + | 18 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'q' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'p' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( + 2 ) else ( -1 @@ -15798,32 +14966,32 @@ let read_ci_config = ( ( match i with | 0 -> - field_env := ( + field_cli_version := ( Some ( ( - read_ci_env + read_version ) p lb ) ); | 1 -> - field_enabled_products := ( + field_unique_id := ( Some ( ( - read__product_list + read_uuid ) p lb ) ); | 2 -> - field_ignored_files := ( + field_requested_products := ( Some ( ( - read__string_list + read__product_list ) p lb ) ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( + field_dry_run := ( ( Atdgen_runtime.Oj_run.read_bool ) p lb @@ -15831,26 +14999,12 @@ let read_ci_config = ( ) | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb + field_sms_scan_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) ); ) | _ -> ( @@ -15862,207 +15016,84 @@ let read_ci_config = ( with Yojson.End_of_object -> ( ( { - env = (match !field_env with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "env"); - enabled_products = (match !field_enabled_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled_products"); - ignored_files = (match !field_ignored_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ignored_files"); - autofix = !field_autofix; - deepsemgrep = !field_deepsemgrep; - dependency_query = !field_dependency_query; - path_to_transitivity = !field_path_to_transitivity; + cli_version = (match !field_cli_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_version"); + unique_id = (match !field_unique_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unique_id"); + requested_products = (match !field_requested_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "requested_products"); + dry_run = !field_dry_run; + sms_scan_id = !field_sms_scan_id; } - : ci_config) + : scan_metadata) ) ) -let ci_config_of_string s = - read_ci_config (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_action = ( - fun ob x -> - match x with - | `Message x -> - Buffer.add_string ob "[\"Message\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `Delay x -> - Buffer.add_string ob "[\"Delay\","; - ( - Yojson.Safe.write_std_float - ) ob x; - Buffer.add_char ob ']' - | `Exit x -> - Buffer.add_string ob "[\"Exit\","; - ( - Yojson.Safe.write_int - ) ob x; - Buffer.add_char ob ']' +let scan_metadata_of_string s = + read_scan_metadata (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__uri_nullable = ( + Atdgen_runtime.Oj_run.write_nullable ( + write_uri + ) ) -let string_of_action ?(len = 1024) x = +let string_of__uri_nullable ?(len = 1024) x = let ob = Buffer.create len in - write_action ob x; + write__uri_nullable ob x; Buffer.contents ob -let read_action = ( +let read__uri_nullable = ( fun p lb -> Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Message" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Message x - | "Delay" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_number - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Delay x - | "Exit" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Exit x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Message" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Message x - | "Delay" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_number - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Delay x - | "Exit" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Exit x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + read_uri + ) p lb) : _ option) ) -let action_of_string s = - read_action (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__fpath_ci_config_list = ( - Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_fpath - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_ci_config - ) ob x - ); - Buffer.add_char ob ']'; +let _uri_nullable_of_string s = + read__uri_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__string_nullable = ( + Atdgen_runtime.Oj_run.write_nullable ( + Yojson.Safe.write_string ) ) -let string_of__fpath_ci_config_list ?(len = 1024) x = +let string_of__string_nullable ?(len = 1024) x = let ob = Buffer.create len in - write__fpath_ci_config_list ob x; + write__string_nullable ob x; Buffer.contents ob -let read__fpath_ci_config_list = ( - Atdgen_runtime.Oj_run.read_list ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_fpath - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_ci_config - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); +let read__string_nullable = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + Atdgen_runtime.Oj_run.read_string + ) p lb) : _ option) +) +let _string_nullable_of_string s = + read__string_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__sha1_nullable = ( + Atdgen_runtime.Oj_run.write_nullable ( + write_sha1 ) ) -let _fpath_ci_config_list_of_string s = - read__fpath_ci_config_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__fpath_ci_config_list_option = ( +let string_of__sha1_nullable ?(len = 1024) x = + let ob = Buffer.create len in + write__sha1_nullable ob x; + Buffer.contents ob +let read__sha1_nullable = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + read_sha1 + ) p lb) : _ option) +) +let _sha1_nullable_of_string s = + read__sha1_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__datetime_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write__fpath_ci_config_list + write_datetime ) ) -let string_of__fpath_ci_config_list_option ?(len = 1024) x = +let string_of__datetime_option ?(len = 1024) x = let ob = Buffer.create len in - write__fpath_ci_config_list_option ob x; + write__datetime_option ob x; Buffer.contents ob -let read__fpath_ci_config_list_option = ( +let read__datetime_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -16075,7 +15106,7 @@ let read__fpath_ci_config_list_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__fpath_ci_config_list + read_datetime ) p lb in Yojson.Safe.read_space p lb; @@ -16098,7 +15129,7 @@ let read__fpath_ci_config_list_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__fpath_ci_config_list + read_datetime ) p lb in Yojson.Safe.read_space p lb; @@ -16108,18 +15139,18 @@ let read__fpath_ci_config_list_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _fpath_ci_config_list_option_of_string s = - read__fpath_ci_config_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ci_config_option = ( +let _datetime_option_of_string s = + read__datetime_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__bool_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_ci_config + Yojson.Safe.write_bool ) ) -let string_of__ci_config_option ?(len = 1024) x = +let string_of__bool_option ?(len = 1024) x = let ob = Buffer.create len in - write__ci_config_option ob x; + write__bool_option ob x; Buffer.contents ob -let read__ci_config_option = ( +let read__bool_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -16132,7 +15163,7 @@ let read__ci_config_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_ci_config + Atdgen_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; @@ -16155,7 +15186,7 @@ let read__ci_config_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_ci_config + Atdgen_runtime.Oj_run.read_bool ) p lb in Yojson.Safe.read_space p lb; @@ -16165,56 +15196,78 @@ let read__ci_config_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _ci_config_option_of_string s = - read__ci_config_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__action_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_action - ) -) -let string_of__action_list ?(len = 1024) x = - let ob = Buffer.create len in - write__action_list ob x; - Buffer.contents ob -let read__action_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_action - ) -) -let _action_list_of_string s = - read__action_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_config_from_cloud : _ -> ci_config_from_cloud -> _ = ( - fun ob (x : ci_config_from_cloud) -> +let _bool_option_of_string s = + read__bool_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_project_metadata : _ -> project_metadata -> _ = ( + fun ob (x : project_metadata) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"repo_config\":"; + Buffer.add_string ob "\"semgrep_version\":"; + ( + write_version + ) + ob x.semgrep_version; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"scan_environment\":"; + ( + Yojson.Safe.write_string + ) + ob x.scan_environment; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"repository\":"; ( - write_ci_config + Yojson.Safe.write_string ) - ob x.repo_config; - (match x.org_config with None -> () | Some x -> + ob x.repository; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"repo_url\":"; + ( + write__uri_nullable + ) + ob x.repo_url; + (match x.repo_id with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"org_config\":"; + Buffer.add_string ob "\"repo_id\":"; ( - write_ci_config + Yojson.Safe.write_string ) ob x; ); - (match x.dirs_config with None -> () | Some x -> + (match x.org_id with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dirs_config\":"; + Buffer.add_string ob "\"org_id\":"; ( - write__fpath_ci_config_list + Yojson.Safe.write_string + ) + ob x; + ); + (match x.repo_display_name with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"repo_display_name\":"; + ( + Yojson.Safe.write_string ) ob x; ); @@ -16222,25 +15275,231 @@ let write_ci_config_from_cloud : _ -> ci_config_from_cloud -> _ = ( is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"actions\":"; + Buffer.add_string ob "\"branch\":"; ( - write__action_list + write__string_nullable ) - ob x.actions; + ob x.branch; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit\":"; + ( + write__sha1_nullable + ) + ob x.commit; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_title\":"; + ( + write__string_nullable + ) + ob x.commit_title; + (match x.commit_timestamp with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_timestamp\":"; + ( + write_datetime + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_author_email\":"; + ( + write__string_nullable + ) + ob x.commit_author_email; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_author_name\":"; + ( + write__string_nullable + ) + ob x.commit_author_name; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_author_username\":"; + ( + write__string_nullable + ) + ob x.commit_author_username; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"commit_author_image_url\":"; + ( + write__uri_nullable + ) + ob x.commit_author_image_url; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ci_job_url\":"; + ( + write__uri_nullable + ) + ob x.ci_job_url; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"on\":"; + ( + Yojson.Safe.write_string + ) + ob x.on; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"pull_request_author_username\":"; + ( + write__string_nullable + ) + ob x.pull_request_author_username; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"pull_request_author_image_url\":"; + ( + write__uri_nullable + ) + ob x.pull_request_author_image_url; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"pull_request_id\":"; + ( + write__string_nullable + ) + ob x.pull_request_id; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"pull_request_title\":"; + ( + write__string_nullable + ) + ob x.pull_request_title; + (match x.base_sha with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"base_sha\":"; + ( + write_sha1 + ) + ob x; + ); + (match x.start_sha with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"start_sha\":"; + ( + write_sha1 + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_full_scan\":"; + ( + Yojson.Safe.write_bool + ) + ob x.is_full_scan; + (match x.is_sca_scan with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_sca_scan\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); + (match x.is_code_scan with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_code_scan\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); + (match x.is_secrets_scan with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_secrets_scan\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_ci_config_from_cloud ?(len = 1024) x = +let string_of_project_metadata ?(len = 1024) x = let ob = Buffer.create len in - write_ci_config_from_cloud ob x; + write_project_metadata ob x; Buffer.contents ob -let read_ci_config_from_cloud = ( +let read_project_metadata = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_repo_config = ref (None) in - let field_org_config = ref (None) in - let field_dirs_config = ref (None) in - let field_actions = ref ([]) in + let field_semgrep_version = ref (None) in + let field_scan_environment = ref (None) in + let field_repository = ref (None) in + let field_repo_url = ref (None) in + let field_repo_id = ref (None) in + let field_org_id = ref (None) in + let field_repo_display_name = ref (None) in + let field_branch = ref (None) in + let field_commit = ref (None) in + let field_commit_title = ref (None) in + let field_commit_timestamp = ref (None) in + let field_commit_author_email = ref (None) in + let field_commit_author_name = ref (None) in + let field_commit_author_username = ref (None) in + let field_commit_author_image_url = ref (None) in + let field_ci_job_url = ref (None) in + let field_on = ref (None) in + let field_pull_request_author_username = ref (None) in + let field_pull_request_author_image_url = ref (None) in + let field_pull_request_id = ref (None) in + let field_pull_request_title = ref (None) in + let field_base_sha = ref (None) in + let field_start_sha = ref (None) in + let field_is_full_scan = ref (None) in + let field_is_sca_scan = ref (None) in + let field_is_code_scan = ref (None) in + let field_is_secrets_scan = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -16250,43 +15509,274 @@ let read_ci_config_from_cloud = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with + | 2 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'n' then ( + 16 + ) + else ( + -1 + ) + ) + | 6 -> ( + match String.unsafe_get s pos with + | 'b' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' then ( + 7 + ) + else ( + -1 + ) + ) + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' then ( + 8 + ) + else ( + -1 + ) + ) + | 'o' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'd' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 3 + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 8 -> ( + match String.unsafe_get s pos with + | 'b' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'h' && String.unsafe_get s (pos+7) = 'a' then ( + 21 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'l' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' then ( + 22 + ) + else ( + -1 + ) + ) + | 10 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'l' then ( + 15 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'y' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'n' then ( + 24 + ) + else ( + -1 + ) + ) + | 12 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' then ( + 9 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' then ( + match String.unsafe_get s (pos+3) with + | 'c' -> ( + if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( + 25 + ) + else ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( + 23 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 15 -> ( + match String.unsafe_get s pos with + | 'i' -> ( + if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'n' then ( + 26 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'd' then ( + 19 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 16 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'p' then ( + 10 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'v' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'e' then ( + 6 + ) + else ( + -1 + ) + ) + | 18 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( + 12 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'e' then ( + 20 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 19 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' then ( + 11 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'n' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'm' && String.unsafe_get s (pos+21) = 'e' then ( + 13 + ) + else ( + -1 + ) + ) + | 23 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'g' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 'r' && String.unsafe_get s (pos+22) = 'l' then ( + 14 ) else ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' then ( - 1 + | 28 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 's' && String.unsafe_get s (pos+22) = 'e' && String.unsafe_get s (pos+23) = 'r' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'a' && String.unsafe_get s (pos+26) = 'm' && String.unsafe_get s (pos+27) = 'e' then ( + 17 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 2 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | 29 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 'm' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = '_' && String.unsafe_get s (pos+26) = 'u' && String.unsafe_get s (pos+27) = 'r' && String.unsafe_get s (pos+28) = 'l' then ( + 18 + ) + else ( + -1 + ) ) | _ -> ( -1 @@ -16297,41 +15787,239 @@ let read_ci_config_from_cloud = ( ( match i with | 0 -> - field_repo_config := ( + field_semgrep_version := ( Some ( ( - read_ci_config + read_version ) p lb ) ); | 1 -> + field_scan_environment := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_repository := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 3 -> + field_repo_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_org_config := ( + field_repo_id := ( Some ( ( - read_ci_config + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 2 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dirs_config := ( + field_org_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_repo_display_name := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + field_branch := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 8 -> + field_commit := ( + Some ( + ( + read__sha1_nullable + ) p lb + ) + ); + | 9 -> + field_commit_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_commit_timestamp := ( + Some ( + ( + read_datetime + ) p lb + ) + ); + ) + | 11 -> + field_commit_author_email := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 12 -> + field_commit_author_name := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 13 -> + field_commit_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 14 -> + field_commit_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 15 -> + field_ci_job_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 16 -> + field_on := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 17 -> + field_pull_request_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 18 -> + field_pull_request_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 19 -> + field_pull_request_id := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 20 -> + field_pull_request_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 21 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_base_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 22 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_start_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 23 -> + field_is_full_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 24 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_sca_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 25 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_code_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 26 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_secrets_scan := ( Some ( ( - read__fpath_ci_config_list + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_actions := ( - ( - read__action_list - ) p lb - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -16345,43 +16033,274 @@ let read_ci_config_from_cloud = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with + | 2 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'n' then ( + 16 + ) + else ( + -1 + ) + ) + | 6 -> ( + match String.unsafe_get s pos with + | 'b' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' then ( + 7 + ) + else ( + -1 + ) + ) + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' then ( + 8 + ) + else ( + -1 + ) + ) + | 'o' -> ( + if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'd' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) | 7 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 3 + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 8 -> ( + match String.unsafe_get s pos with + | 'b' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'h' && String.unsafe_get s (pos+7) = 'a' then ( + 21 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'l' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' then ( + 22 + ) + else ( + -1 + ) + ) + | 10 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'l' then ( + 15 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'y' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'n' then ( + 24 + ) + else ( + -1 + ) + ) + | 12 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' then ( + 9 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' then ( + match String.unsafe_get s (pos+3) with + | 'c' -> ( + if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( + 25 + ) + else ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' then ( + 23 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 15 -> ( + match String.unsafe_get s pos with + | 'i' -> ( + if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'n' then ( + 26 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'd' then ( + 19 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'o' && String.unsafe_get s (pos+14) = 'n' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 16 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'm' && String.unsafe_get s (pos+15) = 'p' then ( + 10 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'v' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 't' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 17 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'a' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'e' then ( + 6 + ) + else ( + -1 + ) + ) + | 18 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( + 12 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'e' then ( + 20 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 19 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 'l' then ( + 11 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'r' && String.unsafe_get s (pos+18) = 'n' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'm' && String.unsafe_get s (pos+21) = 'e' then ( + 13 + ) + else ( + -1 + ) + ) + | 23 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'g' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 'r' && String.unsafe_get s (pos+22) = 'l' then ( + 14 ) else ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' then ( - 1 + | 28 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'u' && String.unsafe_get s (pos+21) = 's' && String.unsafe_get s (pos+22) = 'e' && String.unsafe_get s (pos+23) = 'r' && String.unsafe_get s (pos+24) = 'n' && String.unsafe_get s (pos+25) = 'a' && String.unsafe_get s (pos+26) = 'm' && String.unsafe_get s (pos+27) = 'e' then ( + 17 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 2 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + | 29 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'q' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 't' && String.unsafe_get s (pos+16) = 'h' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = '_' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 'm' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 'g' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = '_' && String.unsafe_get s (pos+26) = 'u' && String.unsafe_get s (pos+27) = 'r' && String.unsafe_get s (pos+28) = 'l' then ( + 18 + ) + else ( + -1 + ) ) | _ -> ( -1 @@ -16392,41 +16311,239 @@ let read_ci_config_from_cloud = ( ( match i with | 0 -> - field_repo_config := ( + field_semgrep_version := ( Some ( ( - read_ci_config + read_version ) p lb ) ); | 1 -> + field_scan_environment := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_repository := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 3 -> + field_repo_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_org_config := ( + field_repo_id := ( Some ( ( - read_ci_config + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 2 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dirs_config := ( + field_org_id := ( Some ( ( - read__fpath_ci_config_list + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_repo_display_name := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + field_branch := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 8 -> + field_commit := ( + Some ( + ( + read__sha1_nullable + ) p lb + ) + ); + | 9 -> + field_commit_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_commit_timestamp := ( + Some ( + ( + read_datetime + ) p lb + ) + ); + ) + | 11 -> + field_commit_author_email := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 12 -> + field_commit_author_name := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 13 -> + field_commit_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 14 -> + field_commit_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 15 -> + field_ci_job_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 16 -> + field_on := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 17 -> + field_pull_request_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 18 -> + field_pull_request_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 19 -> + field_pull_request_id := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 20 -> + field_pull_request_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 21 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_base_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 22 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_start_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 23 -> + field_is_full_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 24 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_sca_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 25 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_code_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 26 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_secrets_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_actions := ( - ( - read__action_list - ) p lb - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -16436,83 +16553,65 @@ let read_ci_config_from_cloud = ( with Yojson.End_of_object -> ( ( { - repo_config = (match !field_repo_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repo_config"); - org_config = !field_org_config; - dirs_config = !field_dirs_config; - actions = !field_actions; + semgrep_version = (match !field_semgrep_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "semgrep_version"); + scan_environment = (match !field_scan_environment with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scan_environment"); + repository = (match !field_repository with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repository"); + repo_url = (match !field_repo_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repo_url"); + repo_id = !field_repo_id; + org_id = !field_org_id; + repo_display_name = !field_repo_display_name; + branch = (match !field_branch with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "branch"); + commit = (match !field_commit with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit"); + commit_title = (match !field_commit_title with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_title"); + commit_timestamp = !field_commit_timestamp; + commit_author_email = (match !field_commit_author_email with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_email"); + commit_author_name = (match !field_commit_author_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_name"); + commit_author_username = (match !field_commit_author_username with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_username"); + commit_author_image_url = (match !field_commit_author_image_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_image_url"); + ci_job_url = (match !field_ci_job_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ci_job_url"); + on = (match !field_on with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "on"); + pull_request_author_username = (match !field_pull_request_author_username with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_author_username"); + pull_request_author_image_url = (match !field_pull_request_author_image_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_author_image_url"); + pull_request_id = (match !field_pull_request_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_id"); + pull_request_title = (match !field_pull_request_title with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pull_request_title"); + base_sha = !field_base_sha; + start_sha = !field_start_sha; + is_full_scan = (match !field_is_full_scan with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_full_scan"); + is_sca_scan = !field_is_sca_scan; + is_code_scan = !field_is_code_scan; + is_secrets_scan = !field_is_secrets_scan; } - : ci_config_from_cloud) + : project_metadata) ) ) -let ci_config_from_cloud_of_string s = - read_ci_config_from_cloud (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__product_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__product_list +let project_metadata_of_string s = + read_project_metadata (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__tag_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_tag ) ) -let string_of__product_list_option ?(len = 1024) x = +let string_of__tag_list ?(len = 1024) x = let ob = Buffer.create len in - write__product_list_option ob x; + write__tag_list ob x; Buffer.contents ob -let read__product_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__product_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__product_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) +let read__tag_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_tag + ) ) -let _product_list_option_of_string s = - read__product_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ci_config_from_cloud_option = ( +let _tag_list_of_string s = + read__tag_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__tag_list_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_ci_config_from_cloud + write__tag_list ) ) -let string_of__ci_config_from_cloud_option ?(len = 1024) x = +let string_of__tag_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__ci_config_from_cloud_option ob x; + write__tag_list_option ob x; Buffer.contents ob -let read__ci_config_from_cloud_option = ( +let read__tag_list_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -16525,7 +16624,7 @@ let read__ci_config_from_cloud_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_ci_config_from_cloud + read__tag_list ) p lb in Yojson.Safe.read_space p lb; @@ -16548,7 +16647,7 @@ let read__ci_config_from_cloud_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_ci_config_from_cloud + read__tag_list ) p lb in Yojson.Safe.read_space p lb; @@ -16558,166 +16657,44 @@ let read__ci_config_from_cloud_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _ci_config_from_cloud_option_of_string s = - read__ci_config_from_cloud_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scan_config : _ -> scan_config -> _ = ( - fun ob (x : scan_config) -> +let _tag_list_option_of_string s = + read__tag_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_config_from_repo : _ -> ci_config_from_repo -> _ = ( + fun ob (x : ci_config_from_repo) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deployment_id\":"; - ( - Yojson.Safe.write_int - ) - ob x.deployment_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"deployment_name\":"; - ( - Yojson.Safe.write_string - ) - ob x.deployment_name; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"policy_names\":"; - ( - write__string_list - ) - ob x.policy_names; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_config\":"; - ( - Yojson.Safe.write_string - ) - ob x.rule_config; - (match x.ci_config_from_cloud with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ci_config_from_cloud\":"; - ( - write_ci_config_from_cloud - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"autofix\":"; - ( - Yojson.Safe.write_bool - ) - ob x.autofix; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"deepsemgrep\":"; - ( - Yojson.Safe.write_bool - ) - ob x.deepsemgrep; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_query\":"; - ( - Yojson.Safe.write_bool - ) - ob x.dependency_query; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path_to_transitivity\":"; - ( - Yojson.Safe.write_bool - ) - ob x.path_to_transitivity; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; - ( - write__string_list - ) - ob x.triage_ignored_syntactic_ids; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; - ( - write__string_list - ) - ob x.triage_ignored_match_based_ids; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ignored_files\":"; + Buffer.add_string ob "\"version\":"; ( - write__string_list + write_version ) - ob x.ignored_files; - (match x.enabled_products with None -> () | Some x -> + ob x.version; + (match x.tags with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"enabled_products\":"; + Buffer.add_string ob "\"tags\":"; ( - write__product_list - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"actions\":"; - ( - write__action_list - ) - ob x.actions; + write__tag_list + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_scan_config ?(len = 1024) x = +let string_of_ci_config_from_repo ?(len = 1024) x = let ob = Buffer.create len in - write_scan_config ob x; + write_ci_config_from_repo ob x; Buffer.contents ob -let read_scan_config = ( +let read_ci_config_from_repo = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_deployment_id = ref (None) in - let field_deployment_name = ref (None) in - let field_policy_names = ref (None) in - let field_rule_config = ref (None) in - let field_ci_config_from_cloud = ref (None) in - let field_autofix = ref (false) in - let field_deepsemgrep = ref (false) in - let field_dependency_query = ref (false) in - let field_path_to_transitivity = ref (false) in - let field_triage_ignored_syntactic_ids = ref ([]) in - let field_triage_ignored_match_based_ids = ref ([]) in - let field_ignored_files = ref ([]) in - let field_enabled_products = ref (None) in - let field_actions = ref ([]) in + let field_version = ref ("") in + let field_tags = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -16727,148 +16704,17 @@ let read_scan_config = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'a' then ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 13 - ) - else ( - -1 - ) - ) - | 'u' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 11 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 6 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 13 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 11 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( + | 4 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 's' then ( 1 ) else ( -1 ) ) - | 16 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 7 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 12 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 20 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'f' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 10 + | 7 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 0 ) else ( -1 @@ -16883,121 +16729,23 @@ let read_scan_config = ( ( match i with | 0 -> - field_deployment_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_deployment_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_policy_names := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | 3 -> - field_rule_config := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ci_config_from_cloud := ( - Some ( - ( - read_ci_config_from_cloud - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( - ( - read__string_list - ) p lb - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( - ( - read__string_list - ) p lb - ); - ) - | 11 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( + field_version := ( ( - read__string_list + read_version ) p lb ); ) - | 12 -> + | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_enabled_products := ( + field_tags := ( Some ( ( - read__product_list + read__tag_list ) p lb ) ); ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_actions := ( - ( - read__action_list - ) p lb - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17011,148 +16759,17 @@ let read_scan_config = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - if String.unsafe_get s pos = 'a' then ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 13 - ) - else ( - -1 - ) - ) - | 'u' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 11 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( - 6 - ) - else ( - -1 - ) - ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 13 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( - 11 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( + | 4 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 's' then ( 1 ) else ( -1 ) ) - | 16 -> ( - match String.unsafe_get s pos with - | 'd' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( - 7 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 12 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 20 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'f' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 28 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 30 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( - 10 + | 7 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( + 0 ) else ( -1 @@ -17167,121 +16784,23 @@ let read_scan_config = ( ( match i with | 0 -> - field_deployment_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_deployment_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_policy_names := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | 3 -> - field_rule_config := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ci_config_from_cloud := ( - Some ( - ( - read_ci_config_from_cloud - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path_to_transitivity := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_syntactic_ids := ( - ( - read__string_list - ) p lb - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_triage_ignored_match_based_ids := ( - ( - read__string_list - ) p lb - ); - ) - | 11 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( + field_version := ( ( - read__string_list + read_version ) p lb ); ) - | 12 -> + | 1 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_enabled_products := ( + field_tags := ( Some ( ( - read__product_list + read__tag_list ) p lb ) ); ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_actions := ( - ( - read__action_list - ) p lb - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17291,230 +16810,129 @@ let read_scan_config = ( with Yojson.End_of_object -> ( ( { - deployment_id = (match !field_deployment_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_id"); - deployment_name = (match !field_deployment_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_name"); - policy_names = (match !field_policy_names with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "policy_names"); - rule_config = (match !field_rule_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_config"); - ci_config_from_cloud = !field_ci_config_from_cloud; - autofix = !field_autofix; - deepsemgrep = !field_deepsemgrep; - dependency_query = !field_dependency_query; - path_to_transitivity = !field_path_to_transitivity; - triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; - triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; - ignored_files = !field_ignored_files; - enabled_products = !field_enabled_products; - actions = !field_actions; + version = !field_version; + tags = !field_tags; } - : scan_config) + : ci_config_from_repo) ) ) -let scan_config_of_string s = - read_scan_config (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sca_parser_name = ( - fun ob x -> - match x with - | `Gemfile_lock -> Buffer.add_string ob "\"gemfile_lock\"" - | `Go_mod -> Buffer.add_string ob "\"go_mod\"" - | `Go_sum -> Buffer.add_string ob "\"go_sum\"" - | `Gradle_lockfile -> Buffer.add_string ob "\"gradle_lockfile\"" - | `Gradle_build -> Buffer.add_string ob "\"gradle_build\"" - | `Jsondoc -> Buffer.add_string ob "\"jsondoc\"" - | `Pipfile -> Buffer.add_string ob "\"pipfile\"" - | `Pnpm_lock -> Buffer.add_string ob "\"pnpm_lock\"" - | `Poetry_lock -> Buffer.add_string ob "\"poetry_lock\"" - | `Pyproject_toml -> Buffer.add_string ob "\"pyproject_toml\"" - | `Requirements -> Buffer.add_string ob "\"requirements\"" - | `Yarn_1 -> Buffer.add_string ob "\"yarn_1\"" - | `Yarn_2 -> Buffer.add_string ob "\"yarn_2\"" - | `Pomtree -> Buffer.add_string ob "\"pomtree\"" - | `Cargo_parser -> Buffer.add_string ob "\"cargo\"" - | `Composer_lock -> Buffer.add_string ob "\"composer_lock\"" - | `Pubspec_lock -> Buffer.add_string ob "\"pubspec_lock\"" - | `Package_swift -> Buffer.add_string ob "\"package_swift\"" - | `Package_resolved -> Buffer.add_string ob "\"package_resolved\"" - | `Mix_lock -> Buffer.add_string ob "\"mix_lock\"" +let ci_config_from_repo_of_string s = + read_ci_config_from_repo (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__ci_config_from_repo_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_ci_config_from_repo + ) ) -let string_of_sca_parser_name ?(len = 1024) x = +let string_of__ci_config_from_repo_option ?(len = 1024) x = let ob = Buffer.create len in - write_sca_parser_name ob x; + write__ci_config_from_repo_option ob x; Buffer.contents ob -let read_sca_parser_name = ( +let read__ci_config_from_repo_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "gemfile_lock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gemfile_lock - | "go_mod" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Go_mod - | "go_sum" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Go_sum - | "gradle_lockfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gradle_lockfile - | "gradle_build" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gradle_build - | "jsondoc" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Jsondoc - | "pipfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pipfile - | "pnpm_lock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pnpm_lock - | "poetry_lock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Poetry_lock - | "pyproject_toml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pyproject_toml - | "requirements" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Requirements - | "yarn_1" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Yarn_1 - | "yarn_2" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Yarn_2 - | "pomtree" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pomtree - | "cargo" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cargo_parser - | "composer_lock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Composer_lock - | "pubspec_lock" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pubspec_lock - | "package_swift" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Package_swift - | "package_resolved" -> + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Package_resolved - | "mix_lock" -> + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_ci_config_from_repo + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Mix_lock + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "gemfile_lock" -> - `Gemfile_lock - | "go_mod" -> - `Go_mod - | "go_sum" -> - `Go_sum - | "gradle_lockfile" -> - `Gradle_lockfile - | "gradle_build" -> - `Gradle_build - | "jsondoc" -> - `Jsondoc - | "pipfile" -> - `Pipfile - | "pnpm_lock" -> - `Pnpm_lock - | "poetry_lock" -> - `Poetry_lock - | "pyproject_toml" -> - `Pyproject_toml - | "requirements" -> - `Requirements - | "yarn_1" -> - `Yarn_1 - | "yarn_2" -> - `Yarn_2 - | "pomtree" -> - `Pomtree - | "cargo" -> - `Cargo_parser - | "composer_lock" -> - `Composer_lock - | "pubspec_lock" -> - `Pubspec_lock - | "package_swift" -> - `Package_swift - | "package_resolved" -> - `Package_resolved - | "mix_lock" -> - `Mix_lock + | "None" -> + (None : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_ci_config_from_repo + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let sca_parser_name_of_string s = - read_sca_parser_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_child : _ -> dependency_child -> _ = ( - fun ob (x : dependency_child) -> +let _ci_config_from_repo_option_of_string s = + read__ci_config_from_repo_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_request : _ -> scan_request -> _ = ( + fun ob (x : scan_request) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"package\":"; + Buffer.add_string ob "\"project_metadata\":"; ( - Yojson.Safe.write_string + write_project_metadata ) - ob x.package; + ob x.project_metadata; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"version\":"; + Buffer.add_string ob "\"scan_metadata\":"; ( - Yojson.Safe.write_string + write_scan_metadata ) - ob x.version; + ob x.scan_metadata; + (match x.project_config with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"project_config\":"; + ( + write_ci_config_from_repo + ) + ob x; + ); + (match x.meta with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"meta\":"; + ( + write_raw_json + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_dependency_child ?(len = 1024) x = +let string_of_scan_request ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_child ob x; + write_scan_request ob x; Buffer.contents ob -let read_dependency_child = ( +let read_scan_request = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_package = ref (None) in - let field_version = ref (None) in + let field_project_metadata = ref (None) in + let field_scan_metadata = ref (None) in + let field_project_config = ref (None) in + let field_meta = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -17523,52 +16941,83 @@ let read_dependency_child = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 then ( - match String.unsafe_get s pos with - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) + match len with + | 4 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + 3 ) - | 'v' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 13 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'a' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'f' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'g' then ( + 2 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'd' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_package := ( + field_project_metadata := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_project_metadata ) p lb ) ); | 1 -> - field_version := ( + field_scan_metadata := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_scan_metadata ) p lb ) ); + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_project_config := ( + Some ( + ( + read_ci_config_from_repo + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_meta := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17581,52 +17030,83 @@ let read_dependency_child = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 then ( - match String.unsafe_get s pos with - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) + match len with + | 4 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + 3 ) - | 'v' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 13 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'a' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 14 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'f' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'g' then ( + 2 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'j' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'm' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'd' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_package := ( + field_project_metadata := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_project_metadata ) p lb ) ); | 1 -> - field_version := ( + field_scan_metadata := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_scan_metadata ) p lb ) ); + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_project_config := ( + Some ( + ( + read_ci_config_from_repo + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_meta := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17636,398 +17116,186 @@ let read_dependency_child = ( with Yojson.End_of_object -> ( ( { - package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); - version = (match !field_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "version"); + project_metadata = (match !field_project_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "project_metadata"); + scan_metadata = (match !field_scan_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "scan_metadata"); + project_config = !field_project_config; + meta = !field_meta; } - : dependency_child) + : scan_request) ) ) -let dependency_child_of_string s = - read_dependency_child (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_b85b97f = ( +let scan_request_of_string s = + read_scan_request (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_4053a06 = ( Atdgen_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( - write__string_list - ) -) -let string_of__x_b85b97f ?(len = 1024) x = - let ob = Buffer.create len in - write__x_b85b97f ob x; - Buffer.contents ob -let read__x_b85b97f = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read__string_list - ) -) -let _x_b85b97f_of_string s = - read__x_b85b97f (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__fpath_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_fpath - ) -) -let string_of__fpath_option ?(len = 1024) x = - let ob = Buffer.create len in - write__fpath_option ob x; - Buffer.contents ob -let read__fpath_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_fpath - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_fpath - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _fpath_option_of_string s = - read__fpath_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_child_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_dependency_child + Yojson.Safe.write_string ) ) -let string_of__dependency_child_list ?(len = 1024) x = +let string_of__x_4053a06 ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_child_list ob x; + write__x_4053a06 ob x; Buffer.contents ob -let read__dependency_child_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_dependency_child +let read__x_4053a06 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + Atdgen_runtime.Oj_run.read_string ) ) -let _dependency_child_list_of_string s = - read__dependency_child_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_child_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__dependency_child_list - ) +let _x_4053a06_of_string s = + read__x_4053a06 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_env = ( + write__x_4053a06 ) -let string_of__dependency_child_list_option ?(len = 1024) x = +let string_of_ci_env ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_child_list_option ob x; + write_ci_env ob x; Buffer.contents ob -let read__dependency_child_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__dependency_child_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__dependency_child_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) +let read_ci_env = ( + read__x_4053a06 ) -let _dependency_child_list_option_of_string s = - read__dependency_child_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_found_dependency : _ -> found_dependency -> _ = ( - fun ob (x : found_dependency) -> +let ci_env_of_string s = + read_ci_env (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_config : _ -> ci_config -> _ = ( + fun ob (x : ci_config) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"package\":"; + Buffer.add_string ob "\"env\":"; ( - Yojson.Safe.write_string + write_ci_env ) - ob x.package; + ob x.env; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"version\":"; + Buffer.add_string ob "\"enabled_products\":"; ( - Yojson.Safe.write_string + write__product_list ) - ob x.version; + ob x.enabled_products; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"ecosystem\":"; + Buffer.add_string ob "\"ignored_files\":"; ( - write_ecosystem + write__string_list ) - ob x.ecosystem; + ob x.ignored_files; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"allowed_hashes\":"; + Buffer.add_string ob "\"autofix\":"; ( - write__x_b85b97f + Yojson.Safe.write_bool ) - ob x.allowed_hashes; - (match x.resolved_url with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"resolved_url\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); + ob x.autofix; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"transitivity\":"; + Buffer.add_string ob "\"deepsemgrep\":"; ( - write_transitivity + Yojson.Safe.write_bool ) - ob x.transitivity; - (match x.manifest_path with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"manifest_path\":"; - ( - write_fpath - ) - ob x; - ); - (match x.lockfile_path with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"lockfile_path\":"; - ( - write_fpath - ) - ob x; - ); - (match x.line_number with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"line_number\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); - (match x.children with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"children\":"; - ( - write__dependency_child_list - ) - ob x; - ); - (match x.git_ref with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"git_ref\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); + ob x.deepsemgrep; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dependency_query\":"; + ( + Yojson.Safe.write_bool + ) + ob x.dependency_query; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path_to_transitivity\":"; + ( + Yojson.Safe.write_bool + ) + ob x.path_to_transitivity; Buffer.add_char ob '}'; ) -let string_of_found_dependency ?(len = 1024) x = +let string_of_ci_config ?(len = 1024) x = let ob = Buffer.create len in - write_found_dependency ob x; + write_ci_config ob x; Buffer.contents ob -let read_found_dependency = ( +let read_ci_config = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_package = ref (None) in - let field_version = ref (None) in - let field_ecosystem = ref (None) in - let field_allowed_hashes = ref (None) in - let field_resolved_url = ref (None) in - let field_transitivity = ref (None) in - let field_manifest_path = ref (None) in - let field_lockfile_path = ref (None) in - let field_line_number = ref (None) in - let field_children = ref (None) in - let field_git_ref = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'f' then ( - 10 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'v' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( - 9 + let field_env = ref (None) in + let field_enabled_products = ref (None) in + let field_ignored_files = ref (None) in + let field_autofix = ref (false) in + let field_deepsemgrep = ref (false) in + let field_dependency_query = ref (false) in + let field_path_to_transitivity = ref (false) in + try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_end lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'v' then ( + 0 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 2 + | 7 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 3 ) else ( -1 ) ) | 11 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'b' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' then ( - 8 + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( + 4 ) else ( -1 ) ) - | 12 -> ( - match String.unsafe_get s pos with - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'u' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'l' then ( - 4 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 13 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 16 -> ( match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( - 7 + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 5 ) else ( -1 ) ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( - 6 + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 1 ) else ( -1 @@ -18037,9 +17305,9 @@ let read_found_dependency = ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'w' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 3 + | 20 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 6 ) else ( -1 @@ -18054,103 +17322,59 @@ let read_found_dependency = ( ( match i with | 0 -> - field_package := ( + field_env := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_ci_env ) p lb ) ); | 1 -> - field_version := ( + field_enabled_products := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__product_list ) p lb ) ); | 2 -> - field_ecosystem := ( + field_ignored_files := ( Some ( ( - read_ecosystem + read__string_list ) p lb ) ); | 3 -> - field_allowed_hashes := ( - Some ( - ( - read__x_b85b97f - ) p lb - ) - ); - | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_url := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - field_transitivity := ( - Some ( + field_autofix := ( ( - read_transitivity + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_manifest_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lockfile_path := ( - Some ( - ( - read_fpath - ) p lb - ) ); ) - | 8 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_line_number := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) - | 9 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_children := ( - Some ( - ( - read__dependency_child_list - ) p lb - ) + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) - | 10 -> + | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_git_ref := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) | _ -> ( @@ -18166,95 +17390,51 @@ let read_found_dependency = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 7 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'f' then ( - 10 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'v' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' then ( - 9 + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'v' then ( + 0 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 2 + | 7 -> ( + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 3 ) else ( -1 ) ) | 11 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'b' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'r' then ( - 8 + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( + 4 ) else ( -1 ) ) - | 12 -> ( - match String.unsafe_get s pos with - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'u' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'l' then ( - 4 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 13 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 16 -> ( match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( - 7 + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 5 ) else ( -1 ) ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' then ( - 6 + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 1 ) else ( -1 @@ -18264,9 +17444,9 @@ let read_found_dependency = ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'w' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 's' then ( - 3 + | 20 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 6 ) else ( -1 @@ -18281,175 +17461,449 @@ let read_found_dependency = ( ( match i with | 0 -> - field_package := ( + field_env := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_ci_env ) p lb ) ); | 1 -> - field_version := ( + field_enabled_products := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__product_list ) p lb ) ); | 2 -> - field_ecosystem := ( + field_ignored_files := ( Some ( ( - read_ecosystem + read__string_list ) p lb ) ); | 3 -> - field_allowed_hashes := ( - Some ( - ( - read__x_b85b97f - ) p lb - ) - ); - | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_url := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - field_transitivity := ( - Some ( + field_autofix := ( ( - read_transitivity + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_manifest_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_lockfile_path := ( - Some ( - ( - read_fpath - ) p lb - ) ); ) - | 8 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_line_number := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) - | 9 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_children := ( - Some ( - ( - read__dependency_child_list - ) p lb - ) + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) - | 10 -> + | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_git_ref := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb ); ) | _ -> ( Yojson.Safe.skip_json p lb ) ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); - version = (match !field_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "version"); - ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); - allowed_hashes = (match !field_allowed_hashes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "allowed_hashes"); - resolved_url = !field_resolved_url; - transitivity = (match !field_transitivity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "transitivity"); - manifest_path = !field_manifest_path; - lockfile_path = !field_lockfile_path; - line_number = !field_line_number; - children = !field_children; - git_ref = !field_git_ref; - } - : found_dependency) - ) + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + env = (match !field_env with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "env"); + enabled_products = (match !field_enabled_products with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "enabled_products"); + ignored_files = (match !field_ignored_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ignored_files"); + autofix = !field_autofix; + deepsemgrep = !field_deepsemgrep; + dependency_query = !field_dependency_query; + path_to_transitivity = !field_path_to_transitivity; + } + : ci_config) + ) +) +let ci_config_of_string s = + read_ci_config (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_action = ( + fun ob x -> + match x with + | `Message x -> + Buffer.add_string ob "[\"Message\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `Delay x -> + Buffer.add_string ob "[\"Delay\","; + ( + Yojson.Safe.write_std_float + ) ob x; + Buffer.add_char ob ']' + | `Exit x -> + Buffer.add_string ob "[\"Exit\","; + ( + Yojson.Safe.write_int + ) ob x; + Buffer.add_char ob ']' +) +let string_of_action ?(len = 1024) x = + let ob = Buffer.create len in + write_action ob x; + Buffer.contents ob +let read_action = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "Message" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Message x + | "Delay" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_number + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Delay x + | "Exit" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_int + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Exit x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Message" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Message x + | "Delay" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_number + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Delay x + | "Exit" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + Atdgen_runtime.Oj_run.read_int + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Exit x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let action_of_string s = + read_action (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__fpath_ci_config_list = ( + Atdgen_runtime.Oj_run.write_list ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_fpath + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write_ci_config + ) ob x + ); + Buffer.add_char ob ']'; + ) +) +let string_of__fpath_ci_config_list ?(len = 1024) x = + let ob = Buffer.create len in + write__fpath_ci_config_list ob x; + Buffer.contents ob +let read__fpath_ci_config_list = ( + Atdgen_runtime.Oj_run.read_list ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_fpath + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read_ci_config + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); + ) ) -let found_dependency_of_string s = - read_found_dependency (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_pattern : _ -> dependency_pattern -> _ = ( - fun ob (x : dependency_pattern) -> +let _fpath_ci_config_list_of_string s = + read__fpath_ci_config_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__fpath_ci_config_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__fpath_ci_config_list + ) +) +let string_of__fpath_ci_config_list_option ?(len = 1024) x = + let ob = Buffer.create len in + write__fpath_ci_config_list_option ob x; + Buffer.contents ob +let read__fpath_ci_config_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__fpath_ci_config_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__fpath_ci_config_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _fpath_ci_config_list_option_of_string s = + read__fpath_ci_config_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__ci_config_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_ci_config + ) +) +let string_of__ci_config_option ?(len = 1024) x = + let ob = Buffer.create len in + write__ci_config_option ob x; + Buffer.contents ob +let read__ci_config_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_ci_config + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_ci_config + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _ci_config_option_of_string s = + read__ci_config_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__action_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_action + ) +) +let string_of__action_list ?(len = 1024) x = + let ob = Buffer.create len in + write__action_list ob x; + Buffer.contents ob +let read__action_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_action + ) +) +let _action_list_of_string s = + read__action_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_config_from_cloud : _ -> ci_config_from_cloud -> _ = ( + fun ob (x : ci_config_from_cloud) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"ecosystem\":"; - ( - write_ecosystem - ) - ob x.ecosystem; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"package\":"; + Buffer.add_string ob "\"repo_config\":"; ( - Yojson.Safe.write_string + write_ci_config ) - ob x.package; + ob x.repo_config; + (match x.org_config with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"org_config\":"; + ( + write_ci_config + ) + ob x; + ); + (match x.dirs_config with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dirs_config\":"; + ( + write__fpath_ci_config_list + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"semver_range\":"; + Buffer.add_string ob "\"actions\":"; ( - Yojson.Safe.write_string + write__action_list ) - ob x.semver_range; + ob x.actions; Buffer.add_char ob '}'; ) -let string_of_dependency_pattern ?(len = 1024) x = +let string_of_ci_config_from_cloud ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_pattern ob x; + write_ci_config_from_cloud ob x; Buffer.contents ob -let read_dependency_pattern = ( +let read_ci_config_from_cloud = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_ecosystem = ref (None) in - let field_package = ref (None) in - let field_semver_range = ref (None) in + let field_repo_config = ref (None) in + let field_org_config = ref (None) in + let field_dirs_config = ref (None) in + let field_actions = ref ([]) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18460,28 +17914,42 @@ let read_dependency_pattern = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 7 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 1 + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 3 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 0 + | 10 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = 'e' then ( - 2 - ) - else ( - -1 - ) + | 11 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 2 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) | _ -> ( -1 @@ -18492,29 +17960,41 @@ let read_dependency_pattern = ( ( match i with | 0 -> - field_ecosystem := ( + field_repo_config := ( Some ( ( - read_ecosystem + read_ci_config ) p lb ) ); | 1 -> - field_package := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_org_config := ( + Some ( + ( + read_ci_config + ) p lb + ) + ); + ) | 2 -> - field_semver_range := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dirs_config := ( + Some ( + ( + read__fpath_ci_config_list + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_actions := ( ( - Atdgen_runtime.Oj_run.read_string + read__action_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -18529,28 +18009,42 @@ let read_dependency_pattern = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 7 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 1 + if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 3 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'm' then ( - 0 + | 10 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'g' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = 'e' then ( - 2 - ) - else ( - -1 - ) + | 11 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 2 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) | _ -> ( -1 @@ -18561,29 +18055,41 @@ let read_dependency_pattern = ( ( match i with | 0 -> - field_ecosystem := ( + field_repo_config := ( Some ( ( - read_ecosystem + read_ci_config ) p lb ) ); | 1 -> - field_package := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_org_config := ( + Some ( + ( + read_ci_config + ) p lb + ) + ); + ) | 2 -> - field_semver_range := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dirs_config := ( + Some ( + ( + read__fpath_ci_config_list + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_actions := ( ( - Atdgen_runtime.Oj_run.read_string + read__action_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -18593,265 +18099,288 @@ let read_dependency_pattern = ( with Yojson.End_of_object -> ( ( { - ecosystem = (match !field_ecosystem with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ecosystem"); - package = (match !field_package with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package"); - semver_range = (match !field_semver_range with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "semver_range"); + repo_config = (match !field_repo_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "repo_config"); + org_config = !field_org_config; + dirs_config = !field_dirs_config; + actions = !field_actions; } - : dependency_pattern) + : ci_config_from_cloud) ) ) -let dependency_pattern_of_string s = - read_dependency_pattern (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dependency_match : _ -> dependency_match -> _ = ( - fun ob (x : dependency_match) -> +let ci_config_from_cloud_of_string s = + read_ci_config_from_cloud (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__product_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__product_list + ) +) +let string_of__product_list_option ?(len = 1024) x = + let ob = Buffer.create len in + write__product_list_option ob x; + Buffer.contents ob +let read__product_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__product_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__product_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _product_list_option_of_string s = + read__product_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__ci_config_from_cloud_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_ci_config_from_cloud + ) +) +let string_of__ci_config_from_cloud_option ?(len = 1024) x = + let ob = Buffer.create len in + write__ci_config_from_cloud_option ob x; + Buffer.contents ob +let read__ci_config_from_cloud_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_ci_config_from_cloud + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_ci_config_from_cloud + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _ci_config_from_cloud_option_of_string s = + read__ci_config_from_cloud_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scan_config : _ -> scan_config -> _ = ( + fun ob (x : scan_config) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_pattern\":"; + Buffer.add_string ob "\"deployment_id\":"; ( - write_dependency_pattern + Yojson.Safe.write_int ) - ob x.dependency_pattern; + ob x.deployment_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"found_dependency\":"; + Buffer.add_string ob "\"deployment_name\":"; ( - write_found_dependency + Yojson.Safe.write_string ) - ob x.found_dependency; + ob x.deployment_name; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"lockfile\":"; + Buffer.add_string ob "\"policy_names\":"; ( - write_fpath + write__string_list ) - ob x.lockfile; - Buffer.add_char ob '}'; -) -let string_of_dependency_match ?(len = 1024) x = - let ob = Buffer.create len in - write_dependency_match ob x; - Buffer.contents ob -let read_dependency_match = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_dependency_pattern = ref (None) in - let field_found_dependency = ref (None) in - let field_lockfile = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | 18 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; + ob x.policy_names; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"rule_config\":"; + ( + Yojson.Safe.write_string + ) + ob x.rule_config; + (match x.ci_config_from_cloud with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ci_config_from_cloud\":"; ( - match i with - | 0 -> - field_dependency_pattern := ( - Some ( - ( - read_dependency_pattern - ) p lb - ) - ); - | 1 -> - field_found_dependency := ( - Some ( - ( - read_found_dependency - ) p lb - ) - ); - | 2 -> - field_lockfile := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | 18 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = 'n' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_dependency_pattern := ( - Some ( - ( - read_dependency_pattern - ) p lb - ) - ); - | 1 -> - field_found_dependency := ( - Some ( - ( - read_found_dependency - ) p lb - ) - ); - | 2 -> - field_lockfile := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - dependency_pattern = (match !field_dependency_pattern with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_pattern"); - found_dependency = (match !field_found_dependency with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "found_dependency"); - lockfile = (match !field_lockfile with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lockfile"); - } - : dependency_match) + write_ci_config_from_cloud ) -) -let dependency_match_of_string s = - read_dependency_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sca_info : _ -> sca_info -> _ = ( - fun ob (x : sca_info) -> - Buffer.add_char ob '{'; - let is_first = ref true in + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"reachable\":"; + Buffer.add_string ob "\"autofix\":"; ( Yojson.Safe.write_bool ) - ob x.reachable; + ob x.autofix; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"reachability_rule\":"; + Buffer.add_string ob "\"deepsemgrep\":"; ( Yojson.Safe.write_bool ) - ob x.reachability_rule; + ob x.deepsemgrep; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"sca_finding_schema\":"; + Buffer.add_string ob "\"dependency_query\":"; ( - Yojson.Safe.write_int + Yojson.Safe.write_bool ) - ob x.sca_finding_schema; + ob x.dependency_query; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path_to_transitivity\":"; + ( + Yojson.Safe.write_bool + ) + ob x.path_to_transitivity; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"triage_ignored_syntactic_ids\":"; + ( + write__string_list + ) + ob x.triage_ignored_syntactic_ids; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"triage_ignored_match_based_ids\":"; + ( + write__string_list + ) + ob x.triage_ignored_match_based_ids; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ignored_files\":"; + ( + write__string_list + ) + ob x.ignored_files; + (match x.enabled_products with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"enabled_products\":"; + ( + write__product_list + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_match\":"; + Buffer.add_string ob "\"actions\":"; ( - write_dependency_match + write__action_list ) - ob x.dependency_match; + ob x.actions; Buffer.add_char ob '}'; ) -let string_of_sca_info ?(len = 1024) x = +let string_of_scan_config ?(len = 1024) x = let ob = Buffer.create len in - write_sca_info ob x; + write_scan_config ob x; Buffer.contents ob -let read_sca_info = ( +let read_scan_config = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_reachable = ref (None) in - let field_reachability_rule = ref (None) in - let field_sca_finding_schema = ref (None) in - let field_dependency_match = ref (None) in + let field_deployment_id = ref (None) in + let field_deployment_name = ref (None) in + let field_policy_names = ref (None) in + let field_rule_config = ref (None) in + let field_ci_config_from_cloud = ref (None) in + let field_autofix = ref (false) in + let field_deepsemgrep = ref (false) in + let field_dependency_query = ref (false) in + let field_path_to_transitivity = ref (false) in + let field_triage_ignored_syntactic_ids = ref ([]) in + let field_triage_ignored_match_based_ids = ref ([]) in + let field_ignored_files = ref ([]) in + let field_enabled_products = ref (None) in + let field_actions = ref ([]) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18861,33 +18390,148 @@ let read_sca_info = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 9 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'e' then ( - 0 + | 7 -> ( + if String.unsafe_get s pos = 'a' then ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 13 + ) + else ( + -1 + ) + ) + | 'u' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' then ( - 3 + | 11 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( + 6 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 12 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( + 2 ) else ( -1 ) ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'e' then ( + | 13 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 11 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( 1 ) else ( -1 ) ) - | 18 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' then ( - 2 + | 16 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 7 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 12 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 20 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'f' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 9 + ) + else ( + -1 + ) + ) + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 10 ) else ( -1 @@ -18902,37 +18546,121 @@ let read_sca_info = ( ( match i with | 0 -> - field_reachable := ( + field_deployment_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_reachability_rule := ( + field_deployment_name := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 2 -> - field_sca_finding_schema := ( + field_policy_names := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + | 3 -> + field_rule_config := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ci_config_from_cloud := ( + Some ( + ( + read_ci_config_from_cloud + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_autofix := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( + ( + read__string_list + ) p lb + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( + ( + read__string_list + ) p lb + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list ) p lb - ) - ); - | 3 -> - field_dependency_match := ( - Some ( + ); + ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_enabled_products := ( + Some ( + ( + read__product_list + ) p lb + ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_actions := ( ( - read_dependency_match + read__action_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -18946,33 +18674,148 @@ let read_sca_info = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 9 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'e' then ( - 0 + | 7 -> ( + if String.unsafe_get s pos = 'a' then ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( + 13 + ) + else ( + -1 + ) + ) + | 'u' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'x' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) - | 16 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'h' then ( - 3 + | 11 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'p' then ( + 6 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'g' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 12 -> ( + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( + 2 ) else ( -1 ) ) - | 17 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'u' && String.unsafe_get s (pos+15) = 'l' && String.unsafe_get s (pos+16) = 'e' then ( + | 13 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'd' then ( + 0 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+1) = 'g' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'o' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' then ( + 11 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'a' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = 'e' then ( 1 ) else ( -1 ) ) - | 18 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'g' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 'h' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'a' then ( - 2 + | 16 -> ( + match String.unsafe_get s pos with + | 'd' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'c' && String.unsafe_get s (pos+9) = 'y' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'q' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'y' then ( + 7 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'd' && String.unsafe_get s (pos+12) = 'u' && String.unsafe_get s (pos+13) = 'c' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 12 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 20 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'f' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'm' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'l' && String.unsafe_get s (pos+17) = 'o' && String.unsafe_get s (pos+18) = 'u' && String.unsafe_get s (pos+19) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'v' && String.unsafe_get s (pos+17) = 'i' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'y' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 28 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 's' && String.unsafe_get s (pos+16) = 'y' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' && String.unsafe_get s (pos+19) = 'a' && String.unsafe_get s (pos+20) = 'c' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = 'i' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = '_' && String.unsafe_get s (pos+25) = 'i' && String.unsafe_get s (pos+26) = 'd' && String.unsafe_get s (pos+27) = 's' then ( + 9 + ) + else ( + -1 + ) + ) + | 30 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'd' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'm' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 't' && String.unsafe_get s (pos+18) = 'c' && String.unsafe_get s (pos+19) = 'h' && String.unsafe_get s (pos+20) = '_' && String.unsafe_get s (pos+21) = 'b' && String.unsafe_get s (pos+22) = 'a' && String.unsafe_get s (pos+23) = 's' && String.unsafe_get s (pos+24) = 'e' && String.unsafe_get s (pos+25) = 'd' && String.unsafe_get s (pos+26) = '_' && String.unsafe_get s (pos+27) = 'i' && String.unsafe_get s (pos+28) = 'd' && String.unsafe_get s (pos+29) = 's' then ( + 10 ) else ( -1 @@ -18987,37 +18830,121 @@ let read_sca_info = ( ( match i with | 0 -> - field_reachable := ( + field_deployment_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_reachability_rule := ( + field_deployment_name := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 2 -> - field_sca_finding_schema := ( + field_policy_names := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__string_list ) p lb ) ); | 3 -> - field_dependency_match := ( + field_rule_config := ( Some ( ( - read_dependency_match + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ci_config_from_cloud := ( + Some ( + ( + read_ci_config_from_cloud + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_autofix := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_deepsemgrep := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_query := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path_to_transitivity := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_syntactic_ids := ( + ( + read__string_list + ) p lb + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_triage_ignored_match_based_ids := ( + ( + read__string_list + ) p lb + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list + ) p lb + ); + ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_enabled_products := ( + Some ( + ( + read__product_list + ) p lb + ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_actions := ( + ( + read__action_list ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -19027,16 +18954,196 @@ let read_sca_info = ( with Yojson.End_of_object -> ( ( { - reachable = (match !field_reachable with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reachable"); - reachability_rule = (match !field_reachability_rule with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "reachability_rule"); - sca_finding_schema = (match !field_sca_finding_schema with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "sca_finding_schema"); - dependency_match = (match !field_dependency_match with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "dependency_match"); + deployment_id = (match !field_deployment_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_id"); + deployment_name = (match !field_deployment_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "deployment_name"); + policy_names = (match !field_policy_names with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "policy_names"); + rule_config = (match !field_rule_config with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_config"); + ci_config_from_cloud = !field_ci_config_from_cloud; + autofix = !field_autofix; + deepsemgrep = !field_deepsemgrep; + dependency_query = !field_dependency_query; + path_to_transitivity = !field_path_to_transitivity; + triage_ignored_syntactic_ids = !field_triage_ignored_syntactic_ids; + triage_ignored_match_based_ids = !field_triage_ignored_match_based_ids; + ignored_files = !field_ignored_files; + enabled_products = !field_enabled_products; + actions = !field_actions; } - : sca_info) + : scan_config) ) ) -let sca_info_of_string s = - read_sca_info (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let scan_config_of_string s = + read_scan_config (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_sca_parser_name = ( + fun ob x -> + match x with + | `Gemfile_lock -> Buffer.add_string ob "\"gemfile_lock\"" + | `Go_mod -> Buffer.add_string ob "\"go_mod\"" + | `Go_sum -> Buffer.add_string ob "\"go_sum\"" + | `Gradle_lockfile -> Buffer.add_string ob "\"gradle_lockfile\"" + | `Gradle_build -> Buffer.add_string ob "\"gradle_build\"" + | `Jsondoc -> Buffer.add_string ob "\"jsondoc\"" + | `Pipfile -> Buffer.add_string ob "\"pipfile\"" + | `Pnpm_lock -> Buffer.add_string ob "\"pnpm_lock\"" + | `Poetry_lock -> Buffer.add_string ob "\"poetry_lock\"" + | `Pyproject_toml -> Buffer.add_string ob "\"pyproject_toml\"" + | `Requirements -> Buffer.add_string ob "\"requirements\"" + | `Yarn_1 -> Buffer.add_string ob "\"yarn_1\"" + | `Yarn_2 -> Buffer.add_string ob "\"yarn_2\"" + | `Pomtree -> Buffer.add_string ob "\"pomtree\"" + | `Cargo_parser -> Buffer.add_string ob "\"cargo\"" + | `Composer_lock -> Buffer.add_string ob "\"composer_lock\"" + | `Pubspec_lock -> Buffer.add_string ob "\"pubspec_lock\"" + | `Package_swift -> Buffer.add_string ob "\"package_swift\"" + | `Package_resolved -> Buffer.add_string ob "\"package_resolved\"" + | `Mix_lock -> Buffer.add_string ob "\"mix_lock\"" +) +let string_of_sca_parser_name ?(len = 1024) x = + let ob = Buffer.create len in + write_sca_parser_name ob x; + Buffer.contents ob +let read_sca_parser_name = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "gemfile_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Gemfile_lock + | "go_mod" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Go_mod + | "go_sum" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Go_sum + | "gradle_lockfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Gradle_lockfile + | "gradle_build" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Gradle_build + | "jsondoc" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Jsondoc + | "pipfile" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pipfile + | "pnpm_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pnpm_lock + | "poetry_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Poetry_lock + | "pyproject_toml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pyproject_toml + | "requirements" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Requirements + | "yarn_1" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Yarn_1 + | "yarn_2" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Yarn_2 + | "pomtree" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pomtree + | "cargo" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Cargo_parser + | "composer_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Composer_lock + | "pubspec_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Pubspec_lock + | "package_swift" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Package_swift + | "package_resolved" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Package_resolved + | "mix_lock" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Mix_lock + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "gemfile_lock" -> + `Gemfile_lock + | "go_mod" -> + `Go_mod + | "go_sum" -> + `Go_sum + | "gradle_lockfile" -> + `Gradle_lockfile + | "gradle_build" -> + `Gradle_build + | "jsondoc" -> + `Jsondoc + | "pipfile" -> + `Pipfile + | "pnpm_lock" -> + `Pnpm_lock + | "poetry_lock" -> + `Poetry_lock + | "pyproject_toml" -> + `Pyproject_toml + | "requirements" -> + `Requirements + | "yarn_1" -> + `Yarn_1 + | "yarn_2" -> + `Yarn_2 + | "pomtree" -> + `Pomtree + | "cargo" -> + `Cargo_parser + | "composer_lock" -> + `Composer_lock + | "pubspec_lock" -> + `Pubspec_lock + | "package_swift" -> + `Package_swift + | "package_resolved" -> + `Package_resolved + | "mix_lock" -> + `Mix_lock + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let sca_parser_name_of_string s = + read_sca_parser_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_sarif_format_return : _ -> sarif_format_return -> _ = ( fun ob (x : sarif_format_return) -> Buffer.add_char ob '{'; @@ -20886,63 +20993,6 @@ let read__string_list_option = ( ) let _string_list_option_of_string s = read__string_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__sca_info_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_sca_info - ) -) -let string_of__sca_info_option ?(len = 1024) x = - let ob = Buffer.create len in - write__sca_info_option ob x; - Buffer.contents ob -let read__sca_info_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_sca_info - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_sca_info - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _sca_info_option_of_string s = - read__sca_info_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__metavars_option = ( Atdgen_runtime.Oj_run.write_std_option ( write_metavars @@ -21157,7 +21207,7 @@ let write_cli_match_extra : _ -> cli_match_extra -> _ = ( Buffer.add_char ob ','; Buffer.add_string ob "\"sca_info\":"; ( - write_sca_info + write_sca_match ) ob x; ); @@ -21509,7 +21559,7 @@ let read_cli_match_extra = ( field_sca_info := ( Some ( ( - read_sca_info + read_sca_match ) p lb ) ); @@ -21836,7 +21886,7 @@ let read_cli_match_extra = ( field_sca_info := ( Some ( ( - read_sca_info + read_sca_match ) p lb ) ); @@ -24648,7 +24698,7 @@ let write_finding : _ -> finding -> _ = ( Buffer.add_char ob ','; Buffer.add_string ob "\"sca_info\":"; ( - write_sca_info + write_sca_match ) ob x; ); @@ -25087,7 +25137,7 @@ let read_finding = ( field_sca_info := ( Some ( ( - read_sca_info + read_sca_match ) p lb ) ); @@ -25496,7 +25546,7 @@ let read_finding = ( field_sca_info := ( Some ( ( - read_sca_info + read_sca_match ) p lb ) ); diff --git a/semgrep_output_v1_j.mli b/semgrep_output_v1_j.mli index 63cbdd1..52275bb 100644 --- a/semgrep_output_v1_j.mli +++ b/semgrep_output_v1_j.mli @@ -3,6 +3,13 @@ type datetime = Semgrep_output_v1_t.datetime +type dependency_child = Semgrep_output_v1_t.dependency_child = { + package: string; + version: string +} + +type ecosystem = Semgrep_output_v1_t.ecosystem [@@deriving show,eq] + type fpath = Semgrep_output_v1_t.fpath [@@deriving show, eq] type match_severity = Semgrep_output_v1_t.match_severity @@ -60,6 +67,12 @@ type raw_json = Yojson.Basic.t type rule_id = Semgrep_output_v1_t.rule_id [@@deriving show] +type sca_pattern = Semgrep_output_v1_t.sca_pattern = { + ecosystem: ecosystem; + package: string; + semver_range: string +} + type sha1 = Semgrep_output_v1_t.sha1 type historical_info = Semgrep_output_v1_t.historical_info = { @@ -83,6 +96,35 @@ type metavar_value = Semgrep_output_v1_t.metavar_value = { type metavars = Semgrep_output_v1_t.metavars +type transitivity = Semgrep_output_v1_t.transitivity [@@deriving show,eq] + +type found_dependency = Semgrep_output_v1_t.found_dependency = { + package: string; + version: string; + ecosystem: ecosystem; + allowed_hashes: (string * string list) list; + resolved_url: string option; + transitivity: transitivity; + manifest_path: fpath option; + lockfile_path: fpath option; + line_number: int option; + children: dependency_child list option; + git_ref: string option +} + +type dependency_match = Semgrep_output_v1_t.dependency_match = { + dependency_pattern: sca_pattern; + found_dependency: found_dependency; + lockfile: fpath +} + +type sca_match = Semgrep_output_v1_t.sca_match = { + reachable: bool; + reachability_rule: bool; + sca_finding_schema: int; + dependency_match: dependency_match +} + type validation_state = Semgrep_output_v1_t.validation_state [@@deriving show, eq] @@ -99,14 +141,15 @@ type match_dataflow_trace = Semgrep_output_v1_t.match_dataflow_trace = { } type core_match_extra = Semgrep_output_v1_t.core_match_extra = { + metavars: metavars; + engine_kind: engine_of_finding; + is_ignored: bool; message: string option; metadata: raw_json option; severity: match_severity option; - metavars: metavars; fix: string option; dataflow_trace: match_dataflow_trace option; - engine_kind: engine_of_finding; - is_ignored: bool; + sca_match: sca_match option; validation_state: validation_state option; historical_info: historical_info option; extra_extra: raw_json option @@ -175,8 +218,6 @@ type triage_ignored = Semgrep_output_v1_t.triage_ignored = { triage_ignored_match_based_ids: string list } -type transitivity = Semgrep_output_v1_t.transitivity [@@deriving show,eq] - type todo = Semgrep_output_v1_t.todo type matching_diagnosis = Semgrep_output_v1_t.matching_diagnosis = { @@ -262,8 +303,6 @@ type resolution_method = Semgrep_output_v1_t.resolution_method type manifest_kind = Semgrep_output_v1_t.manifest_kind [@@deriving show, eq] -type ecosystem = Semgrep_output_v1_t.ecosystem [@@deriving show,eq] - type dependency_source_file_kind = Semgrep_output_v1_t.dependency_source_file_kind [@@deriving show] @@ -450,44 +489,6 @@ type scan_config = Semgrep_output_v1_t.scan_config = { type sca_parser_name = Semgrep_output_v1_t.sca_parser_name -type dependency_child = Semgrep_output_v1_t.dependency_child = { - package: string; - version: string -} - -type found_dependency = Semgrep_output_v1_t.found_dependency = { - package: string; - version: string; - ecosystem: ecosystem; - allowed_hashes: (string * string list) list; - resolved_url: string option; - transitivity: transitivity; - manifest_path: fpath option; - lockfile_path: fpath option; - line_number: int option; - children: dependency_child list option; - git_ref: string option -} - -type dependency_pattern = Semgrep_output_v1_t.dependency_pattern = { - ecosystem: ecosystem; - package: string; - semver_range: string -} - -type dependency_match = Semgrep_output_v1_t.dependency_match = { - dependency_pattern: dependency_pattern; - found_dependency: found_dependency; - lockfile: fpath -} - -type sca_info = Semgrep_output_v1_t.sca_info = { - reachable: bool; - reachability_rule: bool; - sca_finding_schema: int; - dependency_match: dependency_match -} - type sarif_format_return = Semgrep_output_v1_t.sarif_format_return = { output: string; format_time_seconds: float @@ -565,7 +566,7 @@ type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { fingerprint: string; lines: string; is_ignored: bool option; - sca_info: sca_info option; + sca_info: sca_match option; validation_state: validation_state option; historical_info: historical_info option; dataflow_trace: match_dataflow_trace option; @@ -649,7 +650,7 @@ type finding = Semgrep_output_v1_t.finding = { metadata: raw_json; is_blocking: bool; fixed_lines: string list option; - sca_info: sca_info option; + sca_info: sca_match option; dataflow_trace: match_dataflow_trace option; validation_state: validation_state option; historical_info: historical_info option; @@ -909,6 +910,46 @@ val datetime_of_string : string -> datetime (** Deserialize JSON data of type {!type:datetime}. *) +val write_dependency_child : + Buffer.t -> dependency_child -> unit + (** Output a JSON value of type {!type:dependency_child}. *) + +val string_of_dependency_child : + ?len:int -> dependency_child -> string + (** Serialize a value of type {!type:dependency_child} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_dependency_child : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> dependency_child + (** Input JSON data of type {!type:dependency_child}. *) + +val dependency_child_of_string : + string -> dependency_child + (** Deserialize JSON data of type {!type:dependency_child}. *) + +val write_ecosystem : + Buffer.t -> ecosystem -> unit + (** Output a JSON value of type {!type:ecosystem}. *) + +val string_of_ecosystem : + ?len:int -> ecosystem -> string + (** Serialize a value of type {!type:ecosystem} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_ecosystem : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> ecosystem + (** Input JSON data of type {!type:ecosystem}. *) + +val ecosystem_of_string : + string -> ecosystem + (** Deserialize JSON data of type {!type:ecosystem}. *) + val write_fpath : Buffer.t -> fpath -> unit (** Output a JSON value of type {!type:fpath}. *) @@ -1129,6 +1170,26 @@ val rule_id_of_string : string -> rule_id (** Deserialize JSON data of type {!type:rule_id}. *) +val write_sca_pattern : + Buffer.t -> sca_pattern -> unit + (** Output a JSON value of type {!type:sca_pattern}. *) + +val string_of_sca_pattern : + ?len:int -> sca_pattern -> string + (** Serialize a value of type {!type:sca_pattern} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_sca_pattern : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> sca_pattern + (** Input JSON data of type {!type:sca_pattern}. *) + +val sca_pattern_of_string : + string -> sca_pattern + (** Deserialize JSON data of type {!type:sca_pattern}. *) + val write_sha1 : Buffer.t -> sha1 -> unit (** Output a JSON value of type {!type:sha1}. *) @@ -1229,6 +1290,86 @@ val metavars_of_string : string -> metavars (** Deserialize JSON data of type {!type:metavars}. *) +val write_transitivity : + Buffer.t -> transitivity -> unit + (** Output a JSON value of type {!type:transitivity}. *) + +val string_of_transitivity : + ?len:int -> transitivity -> string + (** Serialize a value of type {!type:transitivity} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_transitivity : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> transitivity + (** Input JSON data of type {!type:transitivity}. *) + +val transitivity_of_string : + string -> transitivity + (** Deserialize JSON data of type {!type:transitivity}. *) + +val write_found_dependency : + Buffer.t -> found_dependency -> unit + (** Output a JSON value of type {!type:found_dependency}. *) + +val string_of_found_dependency : + ?len:int -> found_dependency -> string + (** Serialize a value of type {!type:found_dependency} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_found_dependency : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> found_dependency + (** Input JSON data of type {!type:found_dependency}. *) + +val found_dependency_of_string : + string -> found_dependency + (** Deserialize JSON data of type {!type:found_dependency}. *) + +val write_dependency_match : + Buffer.t -> dependency_match -> unit + (** Output a JSON value of type {!type:dependency_match}. *) + +val string_of_dependency_match : + ?len:int -> dependency_match -> string + (** Serialize a value of type {!type:dependency_match} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_dependency_match : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> dependency_match + (** Input JSON data of type {!type:dependency_match}. *) + +val dependency_match_of_string : + string -> dependency_match + (** Deserialize JSON data of type {!type:dependency_match}. *) + +val write_sca_match : + Buffer.t -> sca_match -> unit + (** Output a JSON value of type {!type:sca_match}. *) + +val string_of_sca_match : + ?len:int -> sca_match -> string + (** Serialize a value of type {!type:sca_match} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_sca_match : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> sca_match + (** Input JSON data of type {!type:sca_match}. *) + +val sca_match_of_string : + string -> sca_match + (** Deserialize JSON data of type {!type:sca_match}. *) + val write_validation_state : Buffer.t -> validation_state -> unit (** Output a JSON value of type {!type:validation_state}. *) @@ -1609,26 +1750,6 @@ val triage_ignored_of_string : string -> triage_ignored (** Deserialize JSON data of type {!type:triage_ignored}. *) -val write_transitivity : - Buffer.t -> transitivity -> unit - (** Output a JSON value of type {!type:transitivity}. *) - -val string_of_transitivity : - ?len:int -> transitivity -> string - (** Serialize a value of type {!type:transitivity} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_transitivity : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> transitivity - (** Input JSON data of type {!type:transitivity}. *) - -val transitivity_of_string : - string -> transitivity - (** Deserialize JSON data of type {!type:transitivity}. *) - val write_todo : Buffer.t -> todo -> unit (** Output a JSON value of type {!type:todo}. *) @@ -2009,26 +2130,6 @@ val manifest_kind_of_string : string -> manifest_kind (** Deserialize JSON data of type {!type:manifest_kind}. *) -val write_ecosystem : - Buffer.t -> ecosystem -> unit - (** Output a JSON value of type {!type:ecosystem}. *) - -val string_of_ecosystem : - ?len:int -> ecosystem -> string - (** Serialize a value of type {!type:ecosystem} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_ecosystem : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> ecosystem - (** Input JSON data of type {!type:ecosystem}. *) - -val ecosystem_of_string : - string -> ecosystem - (** Deserialize JSON data of type {!type:ecosystem}. *) - val write_dependency_source_file_kind : Buffer.t -> dependency_source_file_kind -> unit (** Output a JSON value of type {!type:dependency_source_file_kind}. *) @@ -2549,106 +2650,6 @@ val sca_parser_name_of_string : string -> sca_parser_name (** Deserialize JSON data of type {!type:sca_parser_name}. *) -val write_dependency_child : - Buffer.t -> dependency_child -> unit - (** Output a JSON value of type {!type:dependency_child}. *) - -val string_of_dependency_child : - ?len:int -> dependency_child -> string - (** Serialize a value of type {!type:dependency_child} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_dependency_child : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> dependency_child - (** Input JSON data of type {!type:dependency_child}. *) - -val dependency_child_of_string : - string -> dependency_child - (** Deserialize JSON data of type {!type:dependency_child}. *) - -val write_found_dependency : - Buffer.t -> found_dependency -> unit - (** Output a JSON value of type {!type:found_dependency}. *) - -val string_of_found_dependency : - ?len:int -> found_dependency -> string - (** Serialize a value of type {!type:found_dependency} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_found_dependency : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> found_dependency - (** Input JSON data of type {!type:found_dependency}. *) - -val found_dependency_of_string : - string -> found_dependency - (** Deserialize JSON data of type {!type:found_dependency}. *) - -val write_dependency_pattern : - Buffer.t -> dependency_pattern -> unit - (** Output a JSON value of type {!type:dependency_pattern}. *) - -val string_of_dependency_pattern : - ?len:int -> dependency_pattern -> string - (** Serialize a value of type {!type:dependency_pattern} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_dependency_pattern : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> dependency_pattern - (** Input JSON data of type {!type:dependency_pattern}. *) - -val dependency_pattern_of_string : - string -> dependency_pattern - (** Deserialize JSON data of type {!type:dependency_pattern}. *) - -val write_dependency_match : - Buffer.t -> dependency_match -> unit - (** Output a JSON value of type {!type:dependency_match}. *) - -val string_of_dependency_match : - ?len:int -> dependency_match -> string - (** Serialize a value of type {!type:dependency_match} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_dependency_match : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> dependency_match - (** Input JSON data of type {!type:dependency_match}. *) - -val dependency_match_of_string : - string -> dependency_match - (** Deserialize JSON data of type {!type:dependency_match}. *) - -val write_sca_info : - Buffer.t -> sca_info -> unit - (** Output a JSON value of type {!type:sca_info}. *) - -val string_of_sca_info : - ?len:int -> sca_info -> string - (** Serialize a value of type {!type:sca_info} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_sca_info : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> sca_info - (** Input JSON data of type {!type:sca_info}. *) - -val sca_info_of_string : - string -> sca_info - (** Deserialize JSON data of type {!type:sca_info}. *) - val write_sarif_format_return : Buffer.t -> sarif_format_return -> unit (** Output a JSON value of type {!type:sarif_format_return}. *)