diff --git a/semgrep_output_v1.atd b/semgrep_output_v1.atd index 40567906..0f2881cc 100644 --- a/semgrep_output_v1.atd +++ b/semgrep_output_v1.atd @@ -555,6 +555,8 @@ type sca_match = { (* Note that in addition to "reachable" there are also the notions of * "vulnerable" and "exploitable". * coupling: see also SCA_match.ml + * TODO? have a Direct of xxx and Transitive of sca_transitive_match_kind? + * better so can be reused in other types such as tr_cache_result? *) type sca_match_kind = [ (* This is used for "parity" or "upgrade-only" rules. transitivity @@ -1839,6 +1841,68 @@ type scan_config = { ?ci_config_from_cloud: ci_config_from_cloud option; } +(* ------------------------------------------- *) +(* Transitive reachabilitiy (TR) caching comms *) +(* ------------------------------------------- *) +(* We want essentially to cache semgrep computation on third party packages + * to quickly know (rule_id x package_version) -> sca_transitive_match_kind + * to avoid downloading and recomputing each time the same thing. + *) + +(* The "key". + * The rule_id and resolved_url should form a valid key for our TR cache + * database table. Indeed, semgrep should always return the same result when + * using the same rule and same resolved_url package. The content at the + * URL should hopefully not change (we could md5sum it just in case) and + * the content of the rule_id should also not change (could md5sum it maybe too). + * I've added tr_version below just in case we want to invalidate past + * cached entries (e.g., the semgrep engine itself changed enough that + * some past cached results might be wrong and should be recomputed) +*) +type tr_cache_key = { + rule_id: rule_id; + (* this can be the checksum of the content of the rule (JSON or YAML form) *) + rule_version: string; + (* does not have to match the Semgrep CLI version; can be bumped only + * when we think the match should be recomputed + * TODO: to be set in Transitive_reachability.ml tr_version constant + *) + engine_version: int; + (* ex: http://some-website/hello-world.0.1.2.tgz like in found_dependency + * 'resolved_url' field, but could be anything to describe a particular + * package. We could rely on https://github.com/package-url/purl-spec + *) + package_url: string; + (* extra key just in case (e.g., "prod" vs "dev") *) + extra: string; +} + +(* The "value" *) +type tr_cache_match_result = { + (* alt: cache just sca_match? or sca_match_kind? or even define a separate + * sca_transitive_match type? which would be smaller than storing + * the whole set of matches + * alt: cache the whole cli_output? (which also contains the errors) + *) + matches: cli_match list; +} + +(* Sent by the CLI to the POST /api/???? *) +type tr_query_cache_request = { + entries: tr_cache_key list; +} + +(* Response by the backend the the POST /api/???? *) +type tr_query_cache_response = { + cached: (tr_cache_key * tr_cache_match_result) list; +} + +(* Sent by the CLI to the POST /api/??? *) +type tr_add_cache_request = { + new_entries: (tr_cache_key * tr_cache_match_result) list; +} +(* TODO: tr_add_cache_response: string result (Ok | Error) *) + (* ----------------------------- *) (* TODO a better CI config from cloud *) (* ----------------------------- *) @@ -2407,6 +2471,10 @@ type resolution_result = [ | ResolutionError of resolution_error_kind list ] +(* ----------------------------- *) +(* SCA transitive reachability *) +(* ----------------------------- *) + type transitive_finding = { (* the important part is the sca_match in core_match_extra that * we need to adjust and especially the sca_match_kind. @@ -2424,7 +2492,7 @@ type transitive_reachability_filter_params = { } (* ----------------------------- *) -(* SCA part 4: Symbol analysis *) +(* Symbol analysis *) (* ----------------------------- *) (* "Symbol analysis" is about determining the third-party functions which diff --git a/semgrep_output_v1.jsonschema b/semgrep_output_v1.jsonschema index 931fd0f8..24739d44 100644 --- a/semgrep_output_v1.jsonschema +++ b/semgrep_output_v1.jsonschema @@ -1539,6 +1539,75 @@ } } }, + "tr_cache_key": { + "type": "object", + "required": [ + "rule_id", "rule_version", "engine_version", "package_url", "extra" + ], + "properties": { + "rule_id": { "$ref": "#/definitions/rule_id" }, + "rule_version": { "type": "string" }, + "engine_version": { "type": "integer" }, + "package_url": { "type": "string" }, + "extra": { "type": "string" } + } + }, + "tr_cache_match_result": { + "type": "object", + "required": [ "matches" ], + "properties": { + "matches": { + "type": "array", + "items": { "$ref": "#/definitions/cli_match" } + } + } + }, + "tr_query_cache_request": { + "type": "object", + "required": [ "entries" ], + "properties": { + "entries": { + "type": "array", + "items": { "$ref": "#/definitions/tr_cache_key" } + } + } + }, + "tr_query_cache_response": { + "type": "object", + "required": [ "cached" ], + "properties": { + "cached": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": false, + "prefixItems": [ + { "$ref": "#/definitions/tr_cache_key" }, + { "$ref": "#/definitions/tr_cache_match_result" } + ] + } + } + } + }, + "tr_add_cache_request": { + "type": "object", + "required": [ "new_entries" ], + "properties": { + "new_entries": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": false, + "prefixItems": [ + { "$ref": "#/definitions/tr_cache_key" }, + { "$ref": "#/definitions/tr_cache_match_result" } + ] + } + } + } + }, "ci_config_from_cloud": { "type": "object", "required": [ "repo_config" ], diff --git a/semgrep_output_v1.proto b/semgrep_output_v1.proto index 7f1e8961..712ae2a0 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: 421019ac6b1fda3ccdc884f9f105fcd58949a0082d889d83c56a69bdad28bda0 +// Source file sha256 digest: c5f746ab097b492eccf16194065ddc0b43538f80d33be871ae19a055f913f740 syntax = "proto3"; @@ -583,6 +583,30 @@ message ScanConfig { CiConfigFromCloud ci_config_from_cloud = 120268883; } +message TrCacheKey { + string rule_id = 42354089; + string rule_version = 452304705; + int64 engine_version = 337736996; + string package_url = 122959490; + string extra = 93093008; +} + +message TrCacheMatchResult { + repeated CliMatch matches = 363750006; +} + +message TrQueryCacheRequest { + repeated TrCacheKey entries = 365120787; +} + +message TrQueryCacheResponse { + repeated google.protobuf.Any cached = 275032675; +} + +message TrAddCacheRequest { + repeated google.protobuf.Any new_entries = 446110625; +} + message CiConfigFromCloud { CiConfig repo_config = 403441970; CiConfig org_config = 463285466; diff --git a/semgrep_output_v1.py b/semgrep_output_v1.py index 90d494a7..699744a3 100644 --- a/semgrep_output_v1.py +++ b/semgrep_output_v1.py @@ -4862,6 +4862,278 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass +class CliMatchExtra: + """Original type: cli_match_extra = { ... }""" + + message: str + metadata: RawJson + severity: MatchSeverity + fingerprint: str + lines: str + metavars: Optional[Metavars] = None + fix: Optional[str] = None + fixed_lines: Optional[List[str]] = None + is_ignored: Optional[bool] = None + sca_info: Optional[ScaMatch] = None + validation_state: Optional[ValidationState] = None + historical_info: Optional[HistoricalInfo] = None + dataflow_trace: Optional[MatchDataflowTrace] = None + engine_kind: Optional[EngineOfFinding] = None + extra_extra: Optional[RawJson] = None + + @classmethod + def from_json(cls, x: Any) -> 'CliMatchExtra': + if isinstance(x, dict): + return cls( + message=_atd_read_string(x['message']) if 'message' in x else _atd_missing_json_field('CliMatchExtra', 'message'), + metadata=RawJson.from_json(x['metadata']) if 'metadata' in x else _atd_missing_json_field('CliMatchExtra', 'metadata'), + severity=MatchSeverity.from_json(x['severity']) if 'severity' in x else _atd_missing_json_field('CliMatchExtra', 'severity'), + fingerprint=_atd_read_string(x['fingerprint']) if 'fingerprint' in x else _atd_missing_json_field('CliMatchExtra', 'fingerprint'), + lines=_atd_read_string(x['lines']) if 'lines' in x else _atd_missing_json_field('CliMatchExtra', 'lines'), + metavars=Metavars.from_json(x['metavars']) if 'metavars' in x else None, + 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=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, + engine_kind=EngineOfFinding.from_json(x['engine_kind']) if 'engine_kind' in x else None, + extra_extra=RawJson.from_json(x['extra_extra']) if 'extra_extra' in x else None, + ) + else: + _atd_bad_json('CliMatchExtra', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['message'] = _atd_write_string(self.message) + res['metadata'] = (lambda x: x.to_json())(self.metadata) + res['severity'] = (lambda x: x.to_json())(self.severity) + res['fingerprint'] = _atd_write_string(self.fingerprint) + res['lines'] = _atd_write_string(self.lines) + if self.metavars is not None: + res['metavars'] = (lambda x: x.to_json())(self.metavars) + if self.fix is not None: + res['fix'] = _atd_write_string(self.fix) + if self.fixed_lines is not None: + res['fixed_lines'] = _atd_write_list(_atd_write_string)(self.fixed_lines) + if self.is_ignored is not None: + res['is_ignored'] = _atd_write_bool(self.is_ignored) + if self.sca_info is not None: + res['sca_info'] = (lambda x: x.to_json())(self.sca_info) + 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: + res['historical_info'] = (lambda x: x.to_json())(self.historical_info) + if self.dataflow_trace is not None: + res['dataflow_trace'] = (lambda x: x.to_json())(self.dataflow_trace) + if self.engine_kind is not None: + res['engine_kind'] = (lambda x: x.to_json())(self.engine_kind) + if self.extra_extra is not None: + res['extra_extra'] = (lambda x: x.to_json())(self.extra_extra) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'CliMatchExtra': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class CliMatch: + """Original type: cli_match = { ... }""" + + check_id: RuleId + path: Fpath + start: Position + end: Position + extra: CliMatchExtra + + @classmethod + def from_json(cls, x: Any) -> 'CliMatch': + if isinstance(x, dict): + return cls( + check_id=RuleId.from_json(x['check_id']) if 'check_id' in x else _atd_missing_json_field('CliMatch', 'check_id'), + path=Fpath.from_json(x['path']) if 'path' in x else _atd_missing_json_field('CliMatch', 'path'), + start=Position.from_json(x['start']) if 'start' in x else _atd_missing_json_field('CliMatch', 'start'), + end=Position.from_json(x['end']) if 'end' in x else _atd_missing_json_field('CliMatch', 'end'), + extra=CliMatchExtra.from_json(x['extra']) if 'extra' in x else _atd_missing_json_field('CliMatch', 'extra'), + ) + else: + _atd_bad_json('CliMatch', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['check_id'] = (lambda x: x.to_json())(self.check_id) + res['path'] = (lambda x: x.to_json())(self.path) + res['start'] = (lambda x: x.to_json())(self.start) + res['end'] = (lambda x: x.to_json())(self.end) + res['extra'] = (lambda x: x.to_json())(self.extra) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'CliMatch': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class TrCacheMatchResult: + """Original type: tr_cache_match_result = { ... }""" + + matches: List[CliMatch] + + @classmethod + def from_json(cls, x: Any) -> 'TrCacheMatchResult': + if isinstance(x, dict): + return cls( + matches=_atd_read_list(CliMatch.from_json)(x['matches']) if 'matches' in x else _atd_missing_json_field('TrCacheMatchResult', 'matches'), + ) + else: + _atd_bad_json('TrCacheMatchResult', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['matches'] = _atd_write_list((lambda x: x.to_json()))(self.matches) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'TrCacheMatchResult': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class TrCacheKey: + """Original type: tr_cache_key = { ... }""" + + rule_id: RuleId + rule_version: str + engine_version: int + package_url: str + extra: str + + @classmethod + def from_json(cls, x: Any) -> 'TrCacheKey': + if isinstance(x, dict): + return cls( + rule_id=RuleId.from_json(x['rule_id']) if 'rule_id' in x else _atd_missing_json_field('TrCacheKey', 'rule_id'), + rule_version=_atd_read_string(x['rule_version']) if 'rule_version' in x else _atd_missing_json_field('TrCacheKey', 'rule_version'), + engine_version=_atd_read_int(x['engine_version']) if 'engine_version' in x else _atd_missing_json_field('TrCacheKey', 'engine_version'), + package_url=_atd_read_string(x['package_url']) if 'package_url' in x else _atd_missing_json_field('TrCacheKey', 'package_url'), + extra=_atd_read_string(x['extra']) if 'extra' in x else _atd_missing_json_field('TrCacheKey', 'extra'), + ) + else: + _atd_bad_json('TrCacheKey', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['rule_id'] = (lambda x: x.to_json())(self.rule_id) + res['rule_version'] = _atd_write_string(self.rule_version) + res['engine_version'] = _atd_write_int(self.engine_version) + res['package_url'] = _atd_write_string(self.package_url) + res['extra'] = _atd_write_string(self.extra) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'TrCacheKey': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class TrQueryCacheResponse: + """Original type: tr_query_cache_response = { ... }""" + + cached: List[Tuple[TrCacheKey, TrCacheMatchResult]] + + @classmethod + def from_json(cls, x: Any) -> 'TrQueryCacheResponse': + if isinstance(x, dict): + return cls( + cached=_atd_read_list((lambda x: (TrCacheKey.from_json(x[0]), TrCacheMatchResult.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x['cached']) if 'cached' in x else _atd_missing_json_field('TrQueryCacheResponse', 'cached'), + ) + else: + _atd_bad_json('TrQueryCacheResponse', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['cached'] = _atd_write_list((lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(self.cached) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'TrQueryCacheResponse': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class TrQueryCacheRequest: + """Original type: tr_query_cache_request = { ... }""" + + entries: List[TrCacheKey] + + @classmethod + def from_json(cls, x: Any) -> 'TrQueryCacheRequest': + if isinstance(x, dict): + return cls( + entries=_atd_read_list(TrCacheKey.from_json)(x['entries']) if 'entries' in x else _atd_missing_json_field('TrQueryCacheRequest', 'entries'), + ) + else: + _atd_bad_json('TrQueryCacheRequest', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['entries'] = _atd_write_list((lambda x: x.to_json()))(self.entries) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'TrQueryCacheRequest': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass +class TrAddCacheRequest: + """Original type: tr_add_cache_request = { ... }""" + + new_entries: List[Tuple[TrCacheKey, TrCacheMatchResult]] + + @classmethod + def from_json(cls, x: Any) -> 'TrAddCacheRequest': + if isinstance(x, dict): + return cls( + new_entries=_atd_read_list((lambda x: (TrCacheKey.from_json(x[0]), TrCacheMatchResult.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x['new_entries']) if 'new_entries' in x else _atd_missing_json_field('TrAddCacheRequest', 'new_entries'), + ) + else: + _atd_bad_json('TrAddCacheRequest', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['new_entries'] = _atd_write_list((lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(self.new_entries) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'TrAddCacheRequest': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass class Todo: """Original type: todo""" @@ -9555,126 +9827,6 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass -class CliMatchExtra: - """Original type: cli_match_extra = { ... }""" - - message: str - metadata: RawJson - severity: MatchSeverity - fingerprint: str - lines: str - metavars: Optional[Metavars] = None - fix: Optional[str] = None - fixed_lines: Optional[List[str]] = None - is_ignored: Optional[bool] = None - sca_info: Optional[ScaMatch] = None - validation_state: Optional[ValidationState] = None - historical_info: Optional[HistoricalInfo] = None - dataflow_trace: Optional[MatchDataflowTrace] = None - engine_kind: Optional[EngineOfFinding] = None - extra_extra: Optional[RawJson] = None - - @classmethod - def from_json(cls, x: Any) -> 'CliMatchExtra': - if isinstance(x, dict): - return cls( - message=_atd_read_string(x['message']) if 'message' in x else _atd_missing_json_field('CliMatchExtra', 'message'), - metadata=RawJson.from_json(x['metadata']) if 'metadata' in x else _atd_missing_json_field('CliMatchExtra', 'metadata'), - severity=MatchSeverity.from_json(x['severity']) if 'severity' in x else _atd_missing_json_field('CliMatchExtra', 'severity'), - fingerprint=_atd_read_string(x['fingerprint']) if 'fingerprint' in x else _atd_missing_json_field('CliMatchExtra', 'fingerprint'), - lines=_atd_read_string(x['lines']) if 'lines' in x else _atd_missing_json_field('CliMatchExtra', 'lines'), - metavars=Metavars.from_json(x['metavars']) if 'metavars' in x else None, - 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=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, - engine_kind=EngineOfFinding.from_json(x['engine_kind']) if 'engine_kind' in x else None, - extra_extra=RawJson.from_json(x['extra_extra']) if 'extra_extra' in x else None, - ) - else: - _atd_bad_json('CliMatchExtra', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['message'] = _atd_write_string(self.message) - res['metadata'] = (lambda x: x.to_json())(self.metadata) - res['severity'] = (lambda x: x.to_json())(self.severity) - res['fingerprint'] = _atd_write_string(self.fingerprint) - res['lines'] = _atd_write_string(self.lines) - if self.metavars is not None: - res['metavars'] = (lambda x: x.to_json())(self.metavars) - if self.fix is not None: - res['fix'] = _atd_write_string(self.fix) - if self.fixed_lines is not None: - res['fixed_lines'] = _atd_write_list(_atd_write_string)(self.fixed_lines) - if self.is_ignored is not None: - res['is_ignored'] = _atd_write_bool(self.is_ignored) - if self.sca_info is not None: - res['sca_info'] = (lambda x: x.to_json())(self.sca_info) - 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: - res['historical_info'] = (lambda x: x.to_json())(self.historical_info) - if self.dataflow_trace is not None: - res['dataflow_trace'] = (lambda x: x.to_json())(self.dataflow_trace) - if self.engine_kind is not None: - res['engine_kind'] = (lambda x: x.to_json())(self.engine_kind) - if self.extra_extra is not None: - res['extra_extra'] = (lambda x: x.to_json())(self.extra_extra) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'CliMatchExtra': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CliMatch: - """Original type: cli_match = { ... }""" - - check_id: RuleId - path: Fpath - start: Position - end: Position - extra: CliMatchExtra - - @classmethod - def from_json(cls, x: Any) -> 'CliMatch': - if isinstance(x, dict): - return cls( - check_id=RuleId.from_json(x['check_id']) if 'check_id' in x else _atd_missing_json_field('CliMatch', 'check_id'), - path=Fpath.from_json(x['path']) if 'path' in x else _atd_missing_json_field('CliMatch', 'path'), - start=Position.from_json(x['start']) if 'start' in x else _atd_missing_json_field('CliMatch', 'start'), - end=Position.from_json(x['end']) if 'end' in x else _atd_missing_json_field('CliMatch', 'end'), - extra=CliMatchExtra.from_json(x['extra']) if 'extra' in x else _atd_missing_json_field('CliMatch', 'extra'), - ) - else: - _atd_bad_json('CliMatch', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['check_id'] = (lambda x: x.to_json())(self.check_id) - res['path'] = (lambda x: x.to_json())(self.path) - res['start'] = (lambda x: x.to_json())(self.start) - res['end'] = (lambda x: x.to_json())(self.end) - res['extra'] = (lambda x: x.to_json())(self.extra) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'CliMatch': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - @dataclass class CliOutput: """Original type: cli_output = { ... }""" diff --git a/semgrep_output_v1.ts b/semgrep_output_v1.ts index 97a75b04..a35efc50 100644 --- a/semgrep_output_v1.ts +++ b/semgrep_output_v1.ts @@ -808,6 +808,30 @@ export type ScanConfig = { ci_config_from_cloud?: CiConfigFromCloud; } +export type TrCacheKey = { + rule_id: RuleId; + rule_version: string; + engine_version: number /*int*/; + package_url: string; + extra: string; +} + +export type TrCacheMatchResult = { + matches: CliMatch[]; +} + +export type TrQueryCacheRequest = { + entries: TrCacheKey[]; +} + +export type TrQueryCacheResponse = { + cached: [TrCacheKey, TrCacheMatchResult][]; +} + +export type TrAddCacheRequest = { + new_entries: [TrCacheKey, TrCacheMatchResult][]; +} + export type CiConfigFromCloud = { repo_config: CiConfig; org_config?: CiConfig; @@ -3637,6 +3661,74 @@ export function readScanConfig(x: any, context: any = x): ScanConfig { }; } +export function writeTrCacheKey(x: TrCacheKey, context: any = x): any { + return { + 'rule_id': _atd_write_required_field('TrCacheKey', 'rule_id', writeRuleId, x.rule_id, x), + 'rule_version': _atd_write_required_field('TrCacheKey', 'rule_version', _atd_write_string, x.rule_version, x), + 'engine_version': _atd_write_required_field('TrCacheKey', 'engine_version', _atd_write_int, x.engine_version, x), + 'package_url': _atd_write_required_field('TrCacheKey', 'package_url', _atd_write_string, x.package_url, x), + 'extra': _atd_write_required_field('TrCacheKey', 'extra', _atd_write_string, x.extra, x), + }; +} + +export function readTrCacheKey(x: any, context: any = x): TrCacheKey { + return { + rule_id: _atd_read_required_field('TrCacheKey', 'rule_id', readRuleId, x['rule_id'], x), + rule_version: _atd_read_required_field('TrCacheKey', 'rule_version', _atd_read_string, x['rule_version'], x), + engine_version: _atd_read_required_field('TrCacheKey', 'engine_version', _atd_read_int, x['engine_version'], x), + package_url: _atd_read_required_field('TrCacheKey', 'package_url', _atd_read_string, x['package_url'], x), + extra: _atd_read_required_field('TrCacheKey', 'extra', _atd_read_string, x['extra'], x), + }; +} + +export function writeTrCacheMatchResult(x: TrCacheMatchResult, context: any = x): any { + return { + 'matches': _atd_write_required_field('TrCacheMatchResult', 'matches', _atd_write_array(writeCliMatch), x.matches, x), + }; +} + +export function readTrCacheMatchResult(x: any, context: any = x): TrCacheMatchResult { + return { + matches: _atd_read_required_field('TrCacheMatchResult', 'matches', _atd_read_array(readCliMatch), x['matches'], x), + }; +} + +export function writeTrQueryCacheRequest(x: TrQueryCacheRequest, context: any = x): any { + return { + 'entries': _atd_write_required_field('TrQueryCacheRequest', 'entries', _atd_write_array(writeTrCacheKey), x.entries, x), + }; +} + +export function readTrQueryCacheRequest(x: any, context: any = x): TrQueryCacheRequest { + return { + entries: _atd_read_required_field('TrQueryCacheRequest', 'entries', _atd_read_array(readTrCacheKey), x['entries'], x), + }; +} + +export function writeTrQueryCacheResponse(x: TrQueryCacheResponse, context: any = x): any { + return { + 'cached': _atd_write_required_field('TrQueryCacheResponse', 'cached', _atd_write_array(((x, context) => [writeTrCacheKey(x[0], x), writeTrCacheMatchResult(x[1], x)])), x.cached, x), + }; +} + +export function readTrQueryCacheResponse(x: any, context: any = x): TrQueryCacheResponse { + return { + cached: _atd_read_required_field('TrQueryCacheResponse', 'cached', _atd_read_array(((x, context): [TrCacheKey, TrCacheMatchResult] => { _atd_check_json_tuple(2, x, context); return [readTrCacheKey(x[0], x), readTrCacheMatchResult(x[1], x)] })), x['cached'], x), + }; +} + +export function writeTrAddCacheRequest(x: TrAddCacheRequest, context: any = x): any { + return { + 'new_entries': _atd_write_required_field('TrAddCacheRequest', 'new_entries', _atd_write_array(((x, context) => [writeTrCacheKey(x[0], x), writeTrCacheMatchResult(x[1], x)])), x.new_entries, x), + }; +} + +export function readTrAddCacheRequest(x: any, context: any = x): TrAddCacheRequest { + return { + new_entries: _atd_read_required_field('TrAddCacheRequest', 'new_entries', _atd_read_array(((x, context): [TrCacheKey, TrCacheMatchResult] => { _atd_check_json_tuple(2, x, context); return [readTrCacheKey(x[0], x), readTrCacheMatchResult(x[1], x)] })), x['new_entries'], x), + }; +} + export function writeCiConfigFromCloud(x: CiConfigFromCloud, context: any = x): any { return { 'repo_config': _atd_write_required_field('CiConfigFromCloud', 'repo_config', writeCiConfig, x.repo_config, x), diff --git a/semgrep_output_v1_j.ml b/semgrep_output_v1_j.ml index 9951c42d..833783c5 100644 --- a/semgrep_output_v1_j.ml +++ b/semgrep_output_v1_j.ml @@ -347,6 +347,56 @@ type transitive_reachability_filter_params = dependencies: resolved_dependency list } +type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { + metavars: metavars option; + message: string; + fix: string option; + fixed_lines: string list option; + metadata: raw_json; + severity: match_severity; + fingerprint: string; + lines: string; + is_ignored: bool option; + sca_info: sca_match option; + validation_state: validation_state option; + historical_info: historical_info option; + dataflow_trace: match_dataflow_trace option; + engine_kind: engine_of_finding option; + extra_extra: raw_json option +} + +type cli_match = Semgrep_output_v1_t.cli_match = { + check_id: rule_id; + path: fpath; + start: position; + end_ (*atd end *): position; + extra: cli_match_extra +} + +type tr_cache_match_result = Semgrep_output_v1_t.tr_cache_match_result = { + matches: cli_match list +} + +type tr_cache_key = Semgrep_output_v1_t.tr_cache_key = { + rule_id: rule_id; + rule_version: string; + engine_version: int; + package_url: string; + extra: string +} + +type tr_query_cache_response = Semgrep_output_v1_t.tr_query_cache_response = { + cached: (tr_cache_key * tr_cache_match_result) list +} + +type tr_query_cache_request = Semgrep_output_v1_t.tr_query_cache_request = { + entries: tr_cache_key list +} + +type tr_add_cache_request = Semgrep_output_v1_t.tr_add_cache_request = { + new_entries: (tr_cache_key * tr_cache_match_result) list +} + type todo = Semgrep_output_v1_t.todo type matching_diagnosis = Semgrep_output_v1_t.matching_diagnosis = { @@ -895,32 +945,6 @@ type dump_rule_partitions_params = output_dir: fpath } -type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { - metavars: metavars option; - message: string; - fix: string option; - fixed_lines: string list option; - metadata: raw_json; - severity: match_severity; - fingerprint: string; - lines: string; - is_ignored: bool option; - sca_info: sca_match option; - validation_state: validation_state option; - historical_info: historical_info option; - dataflow_trace: match_dataflow_trace option; - engine_kind: engine_of_finding option; - extra_extra: raw_json option -} - -type cli_match = Semgrep_output_v1_t.cli_match = { - check_id: rule_id; - path: fpath; - start: position; - end_ (*atd end *): position; - extra: cli_match_extra -} - type cli_output = Semgrep_output_v1_t.cli_output = { version: version option; results: cli_match list; @@ -12466,94 +12490,361 @@ let read_transitive_reachability_filter_params = ( ) let transitive_reachability_filter_params_of_string s = read_transitive_reachability_filter_params (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_todo = ( - Yojson.Safe.write_int +let write__string_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__string_list + ) ) -let string_of_todo ?(len = 1024) x = +let string_of__string_list_option ?(len = 1024) x = let ob = Buffer.create len in - write_todo ob x; + write__string_list_option ob x; Buffer.contents ob -let read_todo = ( - Atdgen_runtime.Oj_run.read_int +let read__string_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__string_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__string_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 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_list_option_of_string s = + read__string_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__metavars_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_metavars ) ) -let string_of__unexpected_no_match_diagnosis_list ?(len = 1024) x = +let string_of__metavars_option ?(len = 1024) x = let ob = Buffer.create len in - write__unexpected_no_match_diagnosis_list ob x; + write__metavars_option ob x; Buffer.contents ob -let read__unexpected_no_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_unexpected_no_match_diagnosis - ) +let read__metavars_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_metavars + ) 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_metavars + ) 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 _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 _metavars_option_of_string s = + read__metavars_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__engine_of_finding_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_engine_of_finding ) ) -let string_of__unexpected_match_diagnosis_list ?(len = 1024) x = +let string_of__engine_of_finding_option ?(len = 1024) x = let ob = Buffer.create len in - write__unexpected_match_diagnosis_list ob x; + write__engine_of_finding_option ob x; Buffer.contents ob -let read__unexpected_match_diagnosis_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_unexpected_match_diagnosis - ) +let read__engine_of_finding_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_engine_of_finding + ) 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_engine_of_finding + ) 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 _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 _engine_of_finding_option_of_string s = + read__engine_of_finding_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_match_extra : _ -> cli_match_extra -> _ = ( + fun ob (x : cli_match_extra) -> Buffer.add_char ob '{'; let is_first = ref true in + (match x.metavars with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"metavars\":"; + ( + write_metavars + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"target\":"; + Buffer.add_string ob "\"message\":"; ( - write_fpath + Yojson.Safe.write_string ) - ob x.target; + ob x.message; + (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.fixed_lines with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fixed_lines\":"; + ( + write__string_list + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"unexpected_match_diagnoses\":"; + Buffer.add_string ob "\"metadata\":"; ( - write__unexpected_match_diagnosis_list + write_raw_json ) - ob x.unexpected_match_diagnoses; + ob x.metadata; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"unexpected_no_match_diagnoses\":"; + Buffer.add_string ob "\"severity\":"; ( - write__unexpected_no_match_diagnosis_list + write_match_severity ) - ob x.unexpected_no_match_diagnoses; + ob x.severity; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fingerprint\":"; + ( + Yojson.Safe.write_string + ) + ob x.fingerprint; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lines\":"; + ( + Yojson.Safe.write_string + ) + ob x.lines; + (match x.is_ignored with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_ignored\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); + (match x.sca_info with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"sca_info\":"; + ( + 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.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.engine_kind with None -> () | Some 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; + ); + (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_matching_diagnosis ?(len = 1024) x = +let string_of_cli_match_extra ?(len = 1024) x = let ob = Buffer.create len in - write_matching_diagnosis ob x; + write_cli_match_extra ob x; Buffer.contents ob -let read_matching_diagnosis = ( +let read_cli_match_extra = ( 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_metavars = ref (None) in + let field_message = ref (None) in + let field_fix = ref (None) in + let field_fixed_lines = ref (None) in + let field_metadata = ref (None) in + let field_severity = ref (None) in + let field_fingerprint = ref (None) in + let field_lines = ref (None) in + let field_is_ignored = ref (None) in + let field_sca_info = ref (None) in + let field_validation_state = ref (None) in + let field_historical_info = ref (None) in + let field_dataflow_trace = ref (None) in + let field_engine_kind = ref (None) in + let field_extra_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -12563,62 +12854,320 @@ 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 + | 3 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 2 ) 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 + | 5 -> ( + 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) = 's' then ( + 7 ) 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 + | 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 ( + 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_target := ( - Some ( - ( - read_fpath - ) p lb + | 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 ( + 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 + ) + ) + | 's' -> ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( + 9 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if 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 + ) + ) + | _ -> ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - ); - | 1 -> - field_unexpected_match_diagnoses := ( + | 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 ( + 8 + ) + else ( + -1 + ) + ) + | 11 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + 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 ( + 13 + ) + 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 ( + 14 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' then ( + match String.unsafe_get s (pos+2) with + | 'n' -> ( + if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -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 ( + 12 + ) + 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 ( + 11 + ) + 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 ( + 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 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metavars := ( + Some ( + ( + read_metavars + ) p lb + ) + ); + ) + | 1 -> + field_message := ( Some ( ( - read__unexpected_match_diagnosis_list + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 2 -> - field_unexpected_no_match_diagnoses := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fixed_lines := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + ) + | 4 -> + field_metadata := ( Some ( ( - read__unexpected_no_match_diagnosis_list + read_raw_json + ) p lb + ) + ); + | 5 -> + field_severity := ( + Some ( + ( + read_match_severity + ) p lb + ) + ); + | 6 -> + field_fingerprint := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 7 -> + field_lines := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_ignored := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_info := ( + Some ( + ( + read_sca_match + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb + ) + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) p lb + ) + ); + ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb + ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_kind := ( + Some ( + ( + read_engine_of_finding + ) p lb + ) + ); + ) + | 14 -> + 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 ) @@ -12632,25 +13181,167 @@ 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 + | 3 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 2 ) 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 ( + | 5 -> ( + 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) = 's' then ( + 7 + ) + 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 ( 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 + | 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 ( + 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 + ) + ) + | 's' -> ( + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( + 9 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if 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 + ) + ) + | _ -> ( + -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 ( + 8 + ) + else ( + -1 + ) + ) + | 11 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + 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 ( + 13 + ) + 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 ( + 14 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' then ( + match String.unsafe_get s (pos+2) with + | 'n' -> ( + if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + else ( + -1 + ) + ) + | _ -> ( + -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 ( + 12 + ) + 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 ( + 11 + ) + 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 ( + 10 ) else ( -1 @@ -12665,209 +13356,145 @@ let read_matching_diagnosis = ( ( match i with | 0 -> - field_target := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metavars := ( + Some ( + ( + read_metavars + ) p lb + ) + ); + ) + | 1 -> + field_message := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 1 -> - field_unexpected_match_diagnoses := ( + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fixed_lines := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + ) + | 4 -> + field_metadata := ( Some ( ( - read__unexpected_match_diagnosis_list + read_raw_json ) p lb ) ); - | 2 -> - field_unexpected_no_match_diagnoses := ( + | 5 -> + field_severity := ( Some ( ( - read__unexpected_no_match_diagnosis_list + read_match_severity ) p lb ) ); - | _ -> ( - Yojson.Safe.skip_json p lb + | 6 -> + field_fingerprint := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 7 -> + field_lines := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_ignored := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) 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 + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_info := ( + Some ( + ( + read_sca_match + ) p lb ) - else ( - -1 + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb ) - ) - | _ -> ( - -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_expected_lines := ( - Some ( - ( - read__int_list - ) p lb + ); ) - ); - | 1 -> - field_reported_lines := ( - Some ( - ( - read__int_list - ) p lb + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) 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 = 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 - ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb ) - | '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 - ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_kind := ( + Some ( + ( + read_engine_of_finding + ) p lb ) - | _ -> ( - -1 + ); + ) + | 14 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra_extra := ( + Some ( + ( + read_raw_json + ) p lb ) - ) - 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_expected_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); - | 1 -> - field_reported_lines := ( - Some ( - ( - read__int_list - ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -12877,163 +13504,91 @@ 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"); + metavars = !field_metavars; + message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); + fix = !field_fix; + fixed_lines = !field_fixed_lines; + metadata = (match !field_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metadata"); + severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); + fingerprint = (match !field_fingerprint with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fingerprint"); + lines = (match !field_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lines"); + is_ignored = !field_is_ignored; + sca_info = !field_sca_info; + validation_state = !field_validation_state; + historical_info = !field_historical_info; + dataflow_trace = !field_dataflow_trace; + engine_kind = !field_engine_kind; + extra_extra = !field_extra_extra; } - : expected_reported) + : cli_match_extra) ) ) -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 = ( - 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) -> +let cli_match_extra_of_string s = + read_cli_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_match : _ -> cli_match -> _ = ( + fun ob (x : cli_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 "\"passed\":"; + Buffer.add_string ob "\"check_id\":"; ( - Yojson.Safe.write_bool + write_rule_id ) - ob x.passed; + ob x.check_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"matches\":"; + Buffer.add_string ob "\"path\":"; ( - write__x_0629659 + write_fpath ) - ob x.matches; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"errors\":"; + Buffer.add_string ob "\"start\":"; ( - write__todo_list + write_position ) - 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; - ); + 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_cli_match_extra + ) + ob x.extra; Buffer.add_char ob '}'; ) -let string_of_rule_result ?(len = 1024) x = +let string_of_cli_match ?(len = 1024) x = let ob = Buffer.create len in - write_rule_result ob x; + write_cli_match ob x; Buffer.contents ob -let read_rule_result = ( +let read_cli_match = ( 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_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; @@ -13043,19 +13598,35 @@ 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 = '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) = '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 + 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 ) ) - | '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) = '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 @@ -13065,17 +13636,9 @@ 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 - ) - 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 + | 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 @@ -13090,39 +13653,45 @@ let read_rule_result = ( ( match i with | 0 -> - field_passed := ( + field_check_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_rule_id ) p lb ) ); | 1 -> - field_matches := ( + field_path := ( Some ( ( - read__x_0629659 + read_fpath ) p lb ) ); | 2 -> - field_errors := ( + field_start := ( Some ( ( - read__todo_list + read_position ) p lb ) ); | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_diagnosis := ( - Some ( - ( - read_matching_diagnosis - ) p lb - ) - ); - ) + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + read_cli_match_extra + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -13136,19 +13705,35 @@ 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 = '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) = '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 + 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 ) ) - | '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) = '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 @@ -13158,17 +13743,9 @@ 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 - ) - 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 + | 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 @@ -13183,39 +13760,45 @@ let read_rule_result = ( ( match i with | 0 -> - field_passed := ( + field_check_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_rule_id ) p lb ) ); | 1 -> - field_matches := ( + field_path := ( Some ( ( - read__x_0629659 + read_fpath ) p lb ) ); | 2 -> - field_errors := ( + field_start := ( Some ( ( - read__todo_list + read_position ) p lb ) ); | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_diagnosis := ( - Some ( - ( - read_matching_diagnosis - ) p lb - ) - ); - ) + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + read_cli_match_extra + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -13225,40 +13808,57 @@ let read_rule_result = ( 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; + 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"); } - : rule_result) + : cli_match) ) ) -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) -> +let cli_match_of_string s = + read_cli_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__cli_match_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_cli_match + ) +) +let string_of__cli_match_list ?(len = 1024) x = + let ob = Buffer.create len in + write__cli_match_list ob x; + Buffer.contents ob +let read__cli_match_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_cli_match + ) +) +let _cli_match_list_of_string s = + read__cli_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tr_cache_match_result : _ -> tr_cache_match_result -> _ = ( + fun ob (x : tr_cache_match_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\":"; + Buffer.add_string ob "\"matches\":"; ( - Yojson.Safe.write_bool + write__cli_match_list ) - ob x.passed; + ob x.matches; Buffer.add_char ob '}'; ) -let string_of_fixtest_result ?(len = 1024) x = +let string_of_tr_cache_match_result ?(len = 1024) x = let ob = Buffer.create len in - write_fixtest_result ob x; + write_tr_cache_match_result ob x; Buffer.contents ob -let read_fixtest_result = ( +let read_tr_cache_match_result = ( 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 try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13267,7 +13867,7 @@ let read_fixtest_result = ( 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 ( + if len = 7 && 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 ( 0 ) else ( @@ -13279,10 +13879,10 @@ let read_fixtest_result = ( ( match i with | 0 -> - field_passed := ( + field_matches := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__cli_match_list ) p lb ) ); @@ -13298,7 +13898,7 @@ let read_fixtest_result = ( 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 ( + if len = 7 && 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 ( 0 ) else ( @@ -13310,10 +13910,10 @@ let read_fixtest_result = ( ( match i with | 0 -> - field_passed := ( + field_matches := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__cli_match_list ) p lb ) ); @@ -13326,84 +13926,77 @@ 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"); + matches = (match !field_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "matches"); } - : fixtest_result) + : tr_cache_match_result) ) ) -let fixtest_result_of_string s = - read_fixtest_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_config_error_reason : _ -> config_error_reason -> _ = ( - fun ob (x : config_error_reason) -> - 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 : config_error_reason) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "unparsable_rule" -> - (UnparsableRule : config_error_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 - ) -) -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 tr_cache_match_result_of_string s = + read_tr_cache_match_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tr_cache_key : _ -> tr_cache_key -> _ = ( + fun ob (x : tr_cache_key) -> 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 "\"rule_id\":"; ( - write_fpath + write_rule_id ) - ob x.file; + ob x.rule_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"reason\":"; + Buffer.add_string ob "\"rule_version\":"; ( - write_config_error_reason + Yojson.Safe.write_string ) - ob x.reason; + ob x.rule_version; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"engine_version\":"; + ( + Yojson.Safe.write_int + ) + ob x.engine_version; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"package_url\":"; + ( + Yojson.Safe.write_string + ) + ob x.package_url; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra\":"; + ( + Yojson.Safe.write_string + ) + ob x.extra; Buffer.add_char ob '}'; ) -let string_of_config_error ?(len = 1024) x = +let string_of_tr_cache_key ?(len = 1024) x = let ob = Buffer.create len in - write_config_error ob x; + write_tr_cache_key ob x; Buffer.contents ob -let read_config_error = ( +let read_tr_cache_key = ( 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_rule_id = ref (None) in + let field_rule_version = ref (None) in + let field_engine_version = ref (None) in + let field_package_url = ref (None) in + let field_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13413,22 +14006,46 @@ 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 ( + | 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 = '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) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( 0 ) 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 ( + | 11 -> ( + 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' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'l' then ( + 3 + ) + else ( + -1 + ) + ) + | 12 -> ( + 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) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( 1 ) else ( -1 ) ) + | 14 -> ( + 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) = 'v' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' then ( + 2 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -13438,18 +14055,42 @@ let read_config_error = ( ( match i with | 0 -> - field_file := ( + field_rule_id := ( Some ( ( - read_fpath + read_rule_id ) p lb ) ); | 1 -> - field_reason := ( + field_rule_version := ( Some ( ( - read_config_error_reason + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_engine_version := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 3 -> + field_package_url := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -13466,22 +14107,46 @@ 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 ( + | 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 = '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) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( 0 ) 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 ( + | 11 -> ( + 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' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'u' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'l' then ( + 3 + ) + else ( + -1 + ) + ) + | 12 -> ( + 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) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( 1 ) else ( -1 ) ) + | 14 -> ( + 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) = 'v' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'o' && String.unsafe_get s (pos+13) = 'n' then ( + 2 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -13491,18 +14156,42 @@ let read_config_error = ( ( match i with | 0 -> - field_file := ( + field_rule_id := ( Some ( ( - read_fpath + read_rule_id ) p lb ) ); | 1 -> - field_reason := ( + field_rule_version := ( Some ( ( - read_config_error_reason + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_engine_version := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 3 -> + field_package_url := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -13515,58 +14204,111 @@ let read_config_error = ( 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"); + rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); + rule_version = (match !field_rule_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_version"); + engine_version = (match !field_engine_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_version"); + package_url = (match !field_package_url with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "package_url"); + extra = (match !field_extra with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "extra"); } - : config_error) + : tr_cache_key) ) ) -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 tr_cache_key_of_string s = + read_tr_cache_key (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__list_b7af149 = ( + Atdgen_runtime.Oj_run.write_list ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_tr_cache_key + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write_tr_cache_match_result + ) ob x + ); + Buffer.add_char ob ']'; ) ) -let string_of__x_e141b07 ?(len = 1024) x = +let string_of__list_b7af149 ?(len = 1024) x = let ob = Buffer.create len in - write__x_e141b07 ob x; + write__list_b7af149 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 read__list_b7af149 = ( + 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_tr_cache_key + ) 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_tr_cache_match_result + ) 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_e141b07_of_string s = - read__x_e141b07 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_checks : _ -> checks -> _ = ( - fun ob (x : checks) -> +let _list_b7af149_of_string s = + read__list_b7af149 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tr_query_cache_response : _ -> tr_query_cache_response -> _ = ( + fun ob (x : tr_query_cache_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 "\"checks\":"; + Buffer.add_string ob "\"cached\":"; ( - write__x_e141b07 + write__list_b7af149 ) - ob x.checks; + ob x.cached; Buffer.add_char ob '}'; ) -let string_of_checks ?(len = 1024) x = +let string_of_tr_query_cache_response ?(len = 1024) x = let ob = Buffer.create len in - write_checks ob x; + write_tr_query_cache_response ob x; Buffer.contents ob -let read_checks = ( +let read_tr_query_cache_response = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_checks = ref (None) in + let field_cached = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13575,7 +14317,7 @@ let read_checks = ( 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 ( + if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( 0 ) else ( @@ -13587,10 +14329,10 @@ let read_checks = ( ( match i with | 0 -> - field_checks := ( + field_cached := ( Some ( ( - read__x_e141b07 + read__list_b7af149 ) p lb ) ); @@ -13606,7 +14348,7 @@ let read_checks = ( 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 ( + if len = 6 && String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'h' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'd' then ( 0 ) else ( @@ -13618,10 +14360,10 @@ let read_checks = ( ( match i with | 0 -> - field_checks := ( + field_cached := ( Some ( ( - read__x_e141b07 + read__list_b7af149 ) p lb ) ); @@ -13634,149 +14376,53 @@ 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"); + cached = (match !field_cached with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cached"); } - : checks) + : tr_query_cache_response) ) ) -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_fpath - ) -) -let string_of__fpath_list ?(len = 1024) x = - let ob = Buffer.create len in - write__fpath_list ob x; - Buffer.contents ob -let read__fpath_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_fpath - ) -) -let _fpath_list_of_string s = - read__fpath_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__config_error_list = ( +let tr_query_cache_response_of_string s = + read_tr_query_cache_response (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__tr_cache_key_list = ( Atdgen_runtime.Oj_run.write_list ( - write_config_error + write_tr_cache_key ) ) -let string_of__config_error_list ?(len = 1024) x = +let string_of__tr_cache_key_list ?(len = 1024) x = let ob = Buffer.create len in - write__config_error_list ob x; + write__tr_cache_key_list ob x; Buffer.contents ob -let read__config_error_list = ( +let read__tr_cache_key_list = ( Atdgen_runtime.Oj_run.read_list ( - read_config_error + read_tr_cache_key ) ) -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 _tr_cache_key_list_of_string s = + read__tr_cache_key_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tr_query_cache_request : _ -> tr_query_cache_request -> _ = ( + fun ob (x : tr_query_cache_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 "\"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\":"; - ( - 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\":"; + Buffer.add_string ob "\"entries\":"; ( - write__config_error_list + write__tr_cache_key_list ) - ob x.config_with_errors; + ob x.entries; Buffer.add_char ob '}'; ) -let string_of_tests_result ?(len = 1024) x = +let string_of_tr_query_cache_request ?(len = 1024) x = let ob = Buffer.create len in - write_tests_result ob x; + write_tr_query_cache_request ob x; Buffer.contents ob -let read_tests_result = ( +let read_tr_query_cache_request = ( 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_entries = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -13785,92 +14431,320 @@ let read_tests_result = ( 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 = '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 ( - 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 - ) + if len = 7 && String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '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_results := ( + field_entries := ( Some ( ( - read__x_e1142f7 + read__tr_cache_key_list ) p lb ) ); - | 1 -> - field_fixtest_results := ( - Some ( - ( - read__x_fc09e7b + | _ -> ( + 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 = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '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_entries := ( + Some ( + ( + read__tr_cache_key_list + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + entries = (match !field_entries with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "entries"); + } + : tr_query_cache_request) + ) +) +let tr_query_cache_request_of_string s = + read_tr_query_cache_request (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tr_add_cache_request : _ -> tr_add_cache_request -> _ = ( + fun ob (x : tr_add_cache_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 "\"new_entries\":"; + ( + write__list_b7af149 + ) + ob x.new_entries; + Buffer.add_char ob '}'; +) +let string_of_tr_add_cache_request ?(len = 1024) x = + let ob = Buffer.create len in + write_tr_add_cache_request ob x; + Buffer.contents ob +let read_tr_add_cache_request = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_new_entries = 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 = 11 && String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '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_new_entries := ( + Some ( + ( + read__list_b7af149 ) p lb ) ); - | 2 -> - field_config_missing_tests := ( + | _ -> ( + 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 = 11 && String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'w' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '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_new_entries := ( + Some ( + ( + read__list_b7af149 + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + new_entries = (match !field_new_entries with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "new_entries"); + } + : tr_add_cache_request) + ) +) +let tr_add_cache_request_of_string s = + read_tr_add_cache_request (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 "\"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; + Buffer.add_char ob '}'; +) +let string_of_matching_diagnosis ?(len = 1024) x = + let ob = Buffer.create len in + write_matching_diagnosis ob x; + Buffer.contents ob +let read_matching_diagnosis = ( + 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 + 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 + | 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 + ) + ) + | _ -> ( + -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_list + read_fpath ) p lb ) ); - | 3 -> - field_config_missing_fixtests := ( + | 1 -> + field_unexpected_match_diagnoses := ( Some ( ( - read__fpath_list + read__unexpected_match_diagnosis_list ) p lb ) ); - | 4 -> - field_config_with_errors := ( + | 2 -> + field_unexpected_no_match_diagnoses := ( Some ( ( - read__config_error_list + read__unexpected_no_match_diagnosis_list ) p lb ) ); @@ -13887,46 +14761,30 @@ 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 ( + | 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 ) ) - | 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 ( + | 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 ) ) - | 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 ( + | 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 ) ) - | 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 ) @@ -13936,42 +14794,26 @@ let read_tests_result = ( ( match i with | 0 -> - field_results := ( + field_target := ( Some ( ( - read__x_e1142f7 + read_fpath ) p lb ) ); | 1 -> - field_fixtest_results := ( + field_unexpected_match_diagnoses := ( Some ( ( - read__x_fc09e7b + read__unexpected_match_diagnosis_list ) 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_unexpected_no_match_diagnoses := ( Some ( ( - read__config_error_list + read__unexpected_no_match_diagnosis_list ) p lb ) ); @@ -13984,166 +14826,240 @@ 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"); + 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"); } - : tests_result) + : matching_diagnosis) ) ) -let tests_result_of_string s = - read_tests_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_project_root = ( - fun ob x -> - match x with - | `Filesystem x -> - Buffer.add_string ob "[\"Filesystem\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `Git_remote x -> - Buffer.add_string ob "[\"Git_remote\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_project_root ?(len = 1024) x = - let ob = Buffer.create len in - write_project_root ob x; - Buffer.contents ob -let read_project_root = ( - 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 - | "Filesystem" -> - 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; - `Filesystem x - | "Git_remote" -> - 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; - `Git_remote 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 - | "Filesystem" -> - 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; - `Filesystem x - | "Git_remote" -> - 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; - `Git_remote x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let project_root_of_string s = - read_project_root (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__string_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 ( + Yojson.Safe.write_int ) ) -let string_of__string_list_option ?(len = 1024) x = +let string_of__int_list ?(len = 1024) x = let ob = Buffer.create len in - write__string_list_option ob x; + write__int_list ob x; Buffer.contents ob -let read__string_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__string_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__string_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 _string_list_option_of_string s = - read__string_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__project_root_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_project_root +let read__int_list = ( + Atdgen_runtime.Oj_run.read_list ( + Atdgen_runtime.Oj_run.read_int ) ) -let string_of__project_root_option ?(len = 1024) x = +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__project_root_option ob x; + write_expected_reported ob x; Buffer.contents ob -let read__project_root_option = ( +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 + ) + ) + | _ -> ( + -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_expected_lines := ( + Some ( + ( + read__int_list + ) p lb + ) + ); + | 1 -> + field_reported_lines := ( + Some ( + ( + read__int_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 = 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 + ) + ) + | _ -> ( + -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_expected_lines := ( + Some ( + ( + read__int_list + ) p lb + ) + ); + | 1 -> + field_reported_lines := ( + Some ( + ( + read__int_list + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + 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"); + } + : expected_reported) + ) +) +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 = ( + 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 @@ -14156,7 +15072,7 @@ let read__project_root_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_project_root + read_matching_diagnosis ) p lb in Yojson.Safe.read_space p lb; @@ -14179,7 +15095,7 @@ let read__project_root_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_project_root + read_matching_diagnosis ) p lb in Yojson.Safe.read_space p lb; @@ -14189,138 +15105,64 @@ let read__project_root_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _project_root_option_of_string s = - read__project_root_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_targeting_conf : _ -> targeting_conf -> _ = ( - fun ob (x : targeting_conf) -> +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 "\"exclude\":"; - ( - write__string_list - ) - ob x.exclude; - (match x.include_ with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"include_\":"; - ( - write__string_list - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"max_target_bytes\":"; - ( - Yojson.Safe.write_int - ) - ob x.max_target_bytes; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"respect_gitignore\":"; - ( - Yojson.Safe.write_bool - ) - ob x.respect_gitignore; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"respect_semgrepignore_files\":"; - ( - Yojson.Safe.write_bool - ) - ob x.respect_semgrepignore_files; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"always_select_explicit_targets\":"; + Buffer.add_string ob "\"passed\":"; ( Yojson.Safe.write_bool ) - ob x.always_select_explicit_targets; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"explicit_targets\":"; - ( - write__string_list - ) - ob x.explicit_targets; - (match x.force_project_root with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"force_project_root\":"; - ( - write_project_root - ) - ob x; - ); + ob x.passed; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"force_novcs_project\":"; + Buffer.add_string ob "\"matches\":"; ( - Yojson.Safe.write_bool + write__x_0629659 ) - ob x.force_novcs_project; + ob x.matches; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"exclude_minified_files\":"; + Buffer.add_string ob "\"errors\":"; ( - Yojson.Safe.write_bool + write__todo_list ) - ob x.exclude_minified_files; - (match x.baseline_commit with None -> () | Some x -> + 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 "\"baseline_commit\":"; + Buffer.add_string ob "\"diagnosis\":"; ( - Yojson.Safe.write_string + write_matching_diagnosis ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_targeting_conf ?(len = 1024) x = +let string_of_rule_result ?(len = 1024) x = let ob = Buffer.create len in - write_targeting_conf ob x; + write_rule_result ob x; Buffer.contents ob -let read_targeting_conf = ( +let read_rule_result = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_exclude = ref (None) in - let field_include_ = ref (None) in - let field_max_target_bytes = ref (None) in - let field_respect_gitignore = ref (None) in - let field_respect_semgrepignore_files = ref (None) in - let field_always_select_explicit_targets = ref (None) in - let field_explicit_targets = ref (None) in - let field_force_project_root = ref (None) in - let field_force_novcs_project = ref (None) in - let field_exclude_minified_files = ref (None) in - let field_baseline_commit = 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; @@ -14330,43 +15172,19 @@ let read_targeting_conf = ( 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) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' then ( - 1 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'b' && 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) = 'l' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' then ( - 10 - ) - else ( - -1 - ) - ) - | 16 -> ( + | 6 -> ( 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) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && 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' && String.unsafe_get s (pos+15) = 's' then ( - 6 + 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 ) ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'b' && String.unsafe_get s (pos+12) = 'y' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 's' then ( - 2 + | '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 @@ -14376,49 +15194,17 @@ let read_targeting_conf = ( -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) = 'p' && 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) = 'g' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'e' then ( - 3 - ) - else ( - -1 - ) - ) - | 18 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'j' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 't' then ( - 7 - ) - else ( - -1 - ) - ) - | 19 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'j' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && 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) = 'm' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'f' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'f' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'l' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 27 -> ( - 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) = 'p' && 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) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'o' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 'f' && String.unsafe_get s (pos+23) = 'i' && String.unsafe_get s (pos+24) = 'l' && String.unsafe_get s (pos+25) = 'e' && String.unsafe_get s (pos+26) = 's' then ( - 4 + | 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 ) ) - | 30 -> ( - 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) = 'e' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'x' && String.unsafe_get s (pos+16) = 'p' && String.unsafe_get s (pos+17) = 'l' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = '_' && String.unsafe_get s (pos+23) = 't' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'r' && String.unsafe_get s (pos+26) = 'g' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 't' && String.unsafe_get s (pos+29) = 's' then ( - 5 + | 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 @@ -14433,95 +15219,35 @@ let read_targeting_conf = ( ( match i with | 0 -> - field_exclude := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_include_ := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 2 -> - field_max_target_bytes := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 3 -> - field_respect_gitignore := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 4 -> - field_respect_semgrepignore_files := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 5 -> - field_always_select_explicit_targets := ( + field_passed := ( Some ( ( Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 6 -> - field_explicit_targets := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_force_project_root := ( - Some ( - ( - read_project_root - ) p lb - ) - ); - ) - | 8 -> - field_force_novcs_project := ( + | 1 -> + field_matches := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__x_0629659 ) p lb ) ); - | 9 -> - field_exclude_minified_files := ( + | 2 -> + field_errors := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__todo_list ) p lb ) ); - | 10 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_baseline_commit := ( + field_diagnosis := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_matching_diagnosis ) p lb ) ); @@ -14539,43 +15265,19 @@ let read_targeting_conf = ( 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) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' then ( - 1 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'b' && 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) = 'l' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' then ( - 10 - ) - else ( - -1 - ) - ) - | 16 -> ( + | 6 -> ( 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) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && 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' && String.unsafe_get s (pos+15) = 's' then ( - 6 + 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 ) ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'b' && String.unsafe_get s (pos+12) = 'y' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 's' then ( - 2 + | '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 @@ -14585,49 +15287,17 @@ let read_targeting_conf = ( -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) = 'p' && 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) = 'g' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'e' then ( - 3 + | 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 ) ) - | 18 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'j' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 't' then ( - 7 - ) - else ( - -1 - ) - ) - | 19 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'j' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && 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) = 'm' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'f' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'f' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'l' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 27 -> ( - 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) = 'p' && 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) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'o' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 'f' && String.unsafe_get s (pos+23) = 'i' && String.unsafe_get s (pos+24) = 'l' && String.unsafe_get s (pos+25) = 'e' && String.unsafe_get s (pos+26) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | 30 -> ( - 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) = 'e' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'x' && String.unsafe_get s (pos+16) = 'p' && String.unsafe_get s (pos+17) = 'l' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = '_' && String.unsafe_get s (pos+23) = 't' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'r' && String.unsafe_get s (pos+26) = 'g' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 't' && String.unsafe_get s (pos+29) = 's' then ( - 5 + | 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 @@ -14642,99 +15312,140 @@ let read_targeting_conf = ( ( match i with | 0 -> - field_exclude := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_include_ := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 2 -> - field_max_target_bytes := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 3 -> - field_respect_gitignore := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 4 -> - field_respect_semgrepignore_files := ( + field_passed := ( Some ( ( Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 5 -> - field_always_select_explicit_targets := ( + | 1 -> + field_matches := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__x_0629659 ) p lb ) ); - | 6 -> - field_explicit_targets := ( + | 2 -> + field_errors := ( Some ( ( - read__string_list + read__todo_list ) p lb ) ); - | 7 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_force_project_root := ( + field_diagnosis := ( Some ( ( - read_project_root + read_matching_diagnosis ) p lb ) ); ) - | 8 -> - field_force_novcs_project := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - | 9 -> - field_exclude_minified_files := ( + | _ -> ( + 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 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 + ) + ); + | _ -> ( + 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 ) ); - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_baseline_commit := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -14744,234 +15455,84 @@ let read_targeting_conf = ( with Yojson.End_of_object -> ( ( { - exclude = (match !field_exclude with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exclude"); - include_ = !field_include_; - max_target_bytes = (match !field_max_target_bytes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "max_target_bytes"); - respect_gitignore = (match !field_respect_gitignore with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "respect_gitignore"); - respect_semgrepignore_files = (match !field_respect_semgrepignore_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "respect_semgrepignore_files"); - always_select_explicit_targets = (match !field_always_select_explicit_targets with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "always_select_explicit_targets"); - explicit_targets = (match !field_explicit_targets with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "explicit_targets"); - force_project_root = !field_force_project_root; - force_novcs_project = (match !field_force_novcs_project with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "force_novcs_project"); - exclude_minified_files = (match !field_exclude_minified_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exclude_minified_files"); - baseline_commit = !field_baseline_commit; + passed = (match !field_passed with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "passed"); } - : targeting_conf) + : fixtest_result) ) ) -let targeting_conf_of_string s = - read_targeting_conf (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_product = ( - fun ob x -> +let fixtest_result_of_string s = + read_fixtest_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_config_error_reason : _ -> config_error_reason -> _ = ( + fun ob (x : config_error_reason) -> match x with - | `SAST -> Buffer.add_string ob "\"sast\"" - | `SCA -> Buffer.add_string ob "\"sca\"" - | `Secrets -> Buffer.add_string ob "\"secrets\"" -) -let string_of_product ?(len = 1024) x = - let ob = Buffer.create len in - write_product ob x; - Buffer.contents ob -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 - | "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__x_7982d5d = ( - fun ob x -> ( - let x = ( Analyzer.unwrap ) x in ( - Yojson.Safe.write_string - ) ob x) -) -let string_of__x_7982d5d ?(len = 1024) x = - let ob = Buffer.create len in - write__x_7982d5d ob x; - Buffer.contents ob -let read__x_7982d5d = ( - fun p lb -> - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb in - ( Analyzer.wrap ) x -) -let _x_7982d5d_of_string s = - read__x_7982d5d (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_analyzer = ( - write__x_7982d5d -) -let string_of_analyzer ?(len = 1024) x = - let ob = Buffer.create len in - write_analyzer ob x; - Buffer.contents ob -let read_analyzer = ( - read__x_7982d5d -) -let analyzer_of_string s = - read_analyzer (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 - ) + | UnparsableRule -> Buffer.add_string ob "\"unparsable_rule\"" ) -let string_of__lockfile_option ?(len = 1024) x = +let string_of_config_error_reason ?(len = 1024) x = let ob = Buffer.create len in - write__lockfile_option ob x; + write_config_error_reason ob x; Buffer.contents ob -let read__lockfile_option = ( +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_lockfile - ) p lb - in + | "unparsable_rule" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + (UnparsableRule : config_error_reason) | 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 : config_error_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_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) -> +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; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"analyzer\":"; - ( - write_analyzer - ) - ob x.analyzer; + ob x.file; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"products\":"; + Buffer.add_string ob "\"reason\":"; ( - write__product_list + write_config_error_reason ) - 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.reason; Buffer.add_char ob '}'; ) -let string_of_code_target ?(len = 1024) x = +let string_of_config_error ?(len = 1024) x = let ob = Buffer.create len in - write_code_target ob x; + write_config_error ob x; Buffer.contents ob -let read_code_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_analyzer = ref (None) in - let field_products = ref (None) in - let field_lockfile_target = ref (None) in + let field_file = ref (None) in + let field_reason = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -14982,38 +15543,16 @@ let read_code_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 ( -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 + | 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 ( + 1 ) else ( -1 @@ -15028,7 +15567,7 @@ let read_code_target = ( ( match i with | 0 -> - field_path := ( + field_file := ( Some ( ( read_fpath @@ -15036,31 +15575,13 @@ let read_code_target = ( ) ); | 1 -> - field_analyzer := ( - Some ( - ( - read_analyzer - ) p lb - ) - ); - | 2 -> - field_products := ( + field_reason := ( Some ( ( - read__product_list + read_config_error_reason ) 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 ) @@ -15075,38 +15596,16 @@ let read_code_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 ( -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 + | 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 ( + 1 ) else ( -1 @@ -15121,7 +15620,7 @@ let read_code_target = ( ( match i with | 0 -> - field_path := ( + field_file := ( Some ( ( read_fpath @@ -15129,31 +15628,13 @@ let read_code_target = ( ) ); | 1 -> - field_analyzer := ( - Some ( - ( - read_analyzer - ) p lb - ) - ); - | 2 -> - field_products := ( + field_reason := ( Some ( ( - read__product_list + read_config_error_reason ) 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 ) @@ -15163,132 +15644,58 @@ 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; + 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"); } - : code_target) + : config_error) ) ) -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 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_target ?(len = 1024) x = +let string_of__x_e141b07 ?(len = 1024) x = let ob = Buffer.create len in - write_target ob x; + write__x_e141b07 ob x; Buffer.contents ob -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 read__x_e141b07 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_rule_result + ) ) -let target_of_string s = - read_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_scanning_roots : _ -> scanning_roots -> _ = ( - fun ob (x : scanning_roots) -> +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 "\"root_paths\":"; - ( - write__fpath_list - ) - ob x.root_paths; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"targeting_conf\":"; + Buffer.add_string ob "\"checks\":"; ( - write_targeting_conf + write__x_e141b07 ) - ob x.targeting_conf; + ob x.checks; Buffer.add_char ob '}'; ) -let string_of_scanning_roots ?(len = 1024) x = +let string_of_checks ?(len = 1024) x = let ob = Buffer.create len in - write_scanning_roots ob x; + write_checks ob x; Buffer.contents ob -let read_scanning_roots = ( +let read_checks = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_root_paths = ref (None) in - let field_targeting_conf = ref (None) in + let field_checks = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -15297,44 +15704,22 @@ let read_scanning_roots = ( 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 = 'r' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 14 -> ( - 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' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' then ( - 1 - ) - 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_root_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); - | 1 -> - field_targeting_conf := ( + field_checks := ( Some ( ( - read_targeting_conf + read__x_e141b07 ) p lb ) ); @@ -15350,44 +15735,22 @@ let read_scanning_roots = ( 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 = 'r' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 14 -> ( - 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' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' then ( - 1 - ) - 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_root_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); - | 1 -> - field_targeting_conf := ( + field_checks := ( Some ( ( - read_targeting_conf + read__x_e141b07 ) p lb ) ); @@ -15400,192 +15763,149 @@ let read_scanning_roots = ( with Yojson.End_of_object -> ( ( { - root_paths = (match !field_root_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "root_paths"); - targeting_conf = (match !field_targeting_conf with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "targeting_conf"); + checks = (match !field_checks with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "checks"); } - : scanning_roots) + : checks) ) ) -let scanning_roots_of_string s = - read_scanning_roots (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__target_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_target +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__target_list ?(len = 1024) x = +let string_of__x_fc09e7b ?(len = 1024) x = let ob = Buffer.create len in - write__target_list ob x; + write__x_fc09e7b ob x; Buffer.contents ob -let read__target_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_target +let read__x_fc09e7b = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_fixtest_result ) ) -let _target_list_of_string s = - read__target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_targets = ( - fun ob x -> - match x with - | `Scanning_roots x -> - Buffer.add_string ob "[\"Scanning_roots\","; - ( - write_scanning_roots - ) ob x; - Buffer.add_char ob ']' - | `Targets x -> - Buffer.add_string ob "[\"Targets\","; - ( - write__target_list - ) ob x; - Buffer.add_char ob ']' +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_targets ?(len = 1024) x = +let string_of__x_e1142f7 ?(len = 1024) x = let ob = Buffer.create len in - write_targets ob x; + write__x_e1142f7 ob x; Buffer.contents ob -let read_targets = ( - 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 - | "Scanning_roots" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_scanning_roots - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Scanning_roots x - | "Targets" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__target_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Targets 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 - | "Scanning_roots" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_scanning_roots - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Scanning_roots x - | "Targets" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__target_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Targets x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) +let read__x_e1142f7 = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_checks + ) ) -let targets_of_string s = - read_targets (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__float_list = ( +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 ( - Yojson.Safe.write_std_float + write_fpath ) ) -let string_of__float_list ?(len = 1024) x = +let string_of__fpath_list ?(len = 1024) x = let ob = Buffer.create len in - write__float_list ob x; + write__fpath_list ob x; Buffer.contents ob -let read__float_list = ( +let read__fpath_list = ( Atdgen_runtime.Oj_run.read_list ( - Atdgen_runtime.Oj_run.read_number + read_fpath ) ) -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 _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__config_error_list ?(len = 1024) x = + let ob = Buffer.create len in + write__config_error_list ob x; + Buffer.contents ob +let read__config_error_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_config_error + ) +) +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 "\"path\":"; + Buffer.add_string ob "\"results\":"; ( - write_fpath + write__x_e1142f7 ) - ob x.path; + ob x.results; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"num_bytes\":"; + Buffer.add_string ob "\"fixtest_results\":"; ( - Yojson.Safe.write_int + write__x_fc09e7b ) - ob x.num_bytes; + ob x.fixtest_results; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"match_times\":"; + Buffer.add_string ob "\"config_missing_tests\":"; ( - write__float_list + write__fpath_list ) - ob x.match_times; + ob x.config_missing_tests; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"parse_times\":"; + Buffer.add_string ob "\"config_missing_fixtests\":"; ( - write__float_list + write__fpath_list ) - ob x.parse_times; + ob x.config_missing_fixtests; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"run_time\":"; + Buffer.add_string ob "\"config_with_errors\":"; ( - Yojson.Safe.write_std_float + write__config_error_list ) - ob x.run_time; + ob x.config_with_errors; Buffer.add_char ob '}'; ) -let string_of_target_times ?(len = 1024) x = +let string_of_tests_result ?(len = 1024) x = let ob = Buffer.create len in - write_target_times ob x; + write_tests_result ob x; Buffer.contents ob -let read_target_times = ( +let read_tests_result = ( 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_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; @@ -15595,51 +15915,45 @@ 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 ( + | 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 ) ) - | 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 ( + | 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 + ) + ) + | 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 ) ) - | 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 + | 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 ) ) - | 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 - ) + | 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 @@ -15650,42 +15964,42 @@ let read_target_times = ( ( match i with | 0 -> - field_path := ( + field_results := ( Some ( ( - read_fpath + read__x_e1142f7 ) p lb ) ); | 1 -> - field_num_bytes := ( + field_fixtest_results := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__x_fc09e7b ) p lb ) ); | 2 -> - field_match_times := ( + field_config_missing_tests := ( Some ( ( - read__float_list + read__fpath_list ) p lb ) ); | 3 -> - field_parse_times := ( + field_config_missing_fixtests := ( Some ( ( - read__float_list + read__fpath_list ) p lb ) ); | 4 -> - field_run_time := ( + field_config_with_errors := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read__config_error_list ) p lb ) ); @@ -15702,51 +16016,45 @@ 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 ( + | 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 ) ) - | 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 ( + | 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 + ) + ) + | 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 ) ) - | 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 + | 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 ) ) - | 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 - ) + | 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 @@ -15757,42 +16065,42 @@ let read_target_times = ( ( match i with | 0 -> - field_path := ( + field_results := ( Some ( ( - read_fpath + read__x_e1142f7 ) p lb ) ); | 1 -> - field_num_bytes := ( + field_fixtest_results := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__x_fc09e7b ) p lb ) ); | 2 -> - field_match_times := ( + field_config_missing_tests := ( Some ( ( - read__float_list + read__fpath_list ) p lb ) ); | 3 -> - field_parse_times := ( + field_config_missing_fixtests := ( Some ( ( - read__float_list + read__fpath_list ) p lb ) ); | 4 -> - field_run_time := ( + field_config_with_errors := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read__config_error_list ) p lb ) ); @@ -15805,176 +16113,109 @@ 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"); + 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"); } - : target_times) + : tests_result) ) ) -let target_times_of_string s = - read_target_times (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_skip_reason : _ -> skip_reason -> _ = ( - fun ob (x : skip_reason) -> +let tests_result_of_string s = + read_tests_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_project_root = ( + fun ob x -> 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\"" + | `Filesystem x -> + Buffer.add_string ob "[\"Filesystem\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `Git_remote x -> + Buffer.add_string ob "[\"Git_remote\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' ) -let string_of_skip_reason ?(len = 1024) x = +let string_of_project_root ?(len = 1024) x = let ob = Buffer.create len in - write_skip_reason ob x; + write_project_root ob x; Buffer.contents ob -let read_skip_reason = ( +let read_project_root = ( 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" -> + | "Filesystem" -> + 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; - (Nonexistent_file : skip_reason) - | "insufficient_permissions" -> + `Filesystem x + | "Git_remote" -> + 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; - (Insufficient_permissions : skip_reason) + `Git_remote x | 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 + | "Filesystem" -> + 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; + `Filesystem x + | "Git_remote" -> + 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; + `Git_remote x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let skip_reason_of_string s = - read_skip_reason (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__rule_id_option = ( +let project_root_of_string s = + read_project_root (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__project_root_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_rule_id + write_project_root ) ) -let string_of__rule_id_option ?(len = 1024) x = +let string_of__project_root_option ?(len = 1024) x = let ob = Buffer.create len in - write__rule_id_option ob x; + write__project_root_option ob x; Buffer.contents ob -let read__rule_id_option = ( +let read__project_root_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -15987,7 +16228,7 @@ let read__rule_id_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_rule_id + read_project_root ) p lb in Yojson.Safe.read_space p lb; @@ -16010,7 +16251,7 @@ let read__rule_id_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_rule_id + read_project_root ) p lb in Yojson.Safe.read_space p lb; @@ -16020,66 +16261,138 @@ let read__rule_id_option = ( 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 _project_root_option_of_string s = + read__project_root_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_targeting_conf : _ -> targeting_conf -> _ = ( + fun ob (x : targeting_conf) -> 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 "\"exclude\":"; ( - write_fpath + write__string_list ) - ob x.path; + ob x.exclude; + (match x.include_ with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"include_\":"; + ( + write__string_list + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"reason\":"; + Buffer.add_string ob "\"max_target_bytes\":"; ( - write_skip_reason + Yojson.Safe.write_int ) - ob x.reason; - (match x.details with None -> () | Some x -> + ob x.max_target_bytes; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"respect_gitignore\":"; + ( + Yojson.Safe.write_bool + ) + ob x.respect_gitignore; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"respect_semgrepignore_files\":"; + ( + Yojson.Safe.write_bool + ) + ob x.respect_semgrepignore_files; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"always_select_explicit_targets\":"; + ( + Yojson.Safe.write_bool + ) + ob x.always_select_explicit_targets; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"explicit_targets\":"; + ( + write__string_list + ) + ob x.explicit_targets; + (match x.force_project_root with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"details\":"; + Buffer.add_string ob "\"force_project_root\":"; ( - Yojson.Safe.write_string + write_project_root ) 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 "\"force_novcs_project\":"; + ( + Yojson.Safe.write_bool + ) + ob x.force_novcs_project; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"exclude_minified_files\":"; + ( + Yojson.Safe.write_bool + ) + ob x.exclude_minified_files; + (match x.baseline_commit with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_id\":"; + Buffer.add_string ob "\"baseline_commit\":"; ( - write_rule_id + Yojson.Safe.write_string ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_skipped_target ?(len = 1024) x = +let string_of_targeting_conf ?(len = 1024) x = let ob = Buffer.create len in - write_skipped_target ob x; + write_targeting_conf ob x; Buffer.contents ob -let read_skipped_target = ( +let read_targeting_conf = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - 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 + let field_exclude = ref (None) in + let field_include_ = ref (None) in + let field_max_target_bytes = ref (None) in + let field_respect_gitignore = ref (None) in + let field_respect_semgrepignore_files = ref (None) in + let field_always_select_explicit_targets = ref (None) in + let field_explicit_targets = ref (None) in + let field_force_project_root = ref (None) in + let field_force_novcs_project = ref (None) in + let field_exclude_minified_files = ref (None) in + let field_baseline_commit = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -16089,35 +16402,43 @@ let read_skipped_target = ( 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 ( + | 7 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' then ( 0 ) 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 ( + | 8 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' then ( 1 ) else ( -1 ) ) - | 7 -> ( + | 15 -> ( + if String.unsafe_get s pos = 'b' && 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) = 'l' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' then ( + 10 + ) + 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) = '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 + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && 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' && String.unsafe_get s (pos+15) = 's' 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) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'b' && String.unsafe_get s (pos+12) = 'y' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 's' then ( + 2 ) else ( -1 @@ -16127,6 +16448,54 @@ let read_skipped_target = ( -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) = 'p' && 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) = 'g' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'j' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 't' then ( + 7 + ) + else ( + -1 + ) + ) + | 19 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'j' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( + 8 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && 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) = 'm' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'f' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'f' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'l' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = 's' then ( + 9 + ) + else ( + -1 + ) + ) + | 27 -> ( + 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) = 'p' && 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) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'o' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 'f' && String.unsafe_get s (pos+23) = 'i' && String.unsafe_get s (pos+24) = 'l' && String.unsafe_get s (pos+25) = 'e' && String.unsafe_get s (pos+26) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 30 -> ( + 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) = 'e' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'x' && String.unsafe_get s (pos+16) = 'p' && String.unsafe_get s (pos+17) = 'l' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = '_' && String.unsafe_get s (pos+23) = 't' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'r' && String.unsafe_get s (pos+26) = 'g' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 't' && String.unsafe_get s (pos+29) = 's' then ( + 5 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -16136,42 +16505,100 @@ let read_skipped_target = ( ( match i with | 0 -> - field_path := ( + field_exclude := ( Some ( ( - read_fpath + read__string_list ) 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 := ( + field_include_ := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__string_list ) p lb ) ); ) + | 2 -> + field_max_target_bytes := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); | 3 -> + field_respect_gitignore := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 4 -> + field_respect_semgrepignore_files := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 5 -> + field_always_select_explicit_targets := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 6 -> + field_explicit_targets := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( + field_force_project_root := ( Some ( ( - read_rule_id + read_project_root ) p lb ) ); ) - | _ -> ( + | 8 -> + field_force_novcs_project := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 9 -> + field_exclude_minified_files := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_baseline_commit := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | _ -> ( Yojson.Safe.skip_json p lb ) ); @@ -16184,35 +16611,43 @@ let read_skipped_target = ( 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 ( + | 7 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' then ( 0 ) 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 ( + | 8 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = '_' then ( 1 ) else ( -1 ) ) - | 7 -> ( + | 15 -> ( + if String.unsafe_get s pos = 'b' && 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) = 'l' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'm' && String.unsafe_get s (pos+12) = 'm' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 't' then ( + 10 + ) + 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) = '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 + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && 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' && String.unsafe_get s (pos+15) = 's' 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) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'b' && String.unsafe_get s (pos+12) = 'y' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 's' then ( + 2 ) else ( -1 @@ -16222,6 +16657,54 @@ let read_skipped_target = ( -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) = 'p' && 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) = 'g' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'g' && String.unsafe_get s (pos+13) = 'n' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'e' then ( + 3 + ) + else ( + -1 + ) + ) + | 18 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'j' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'r' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 't' then ( + 7 + ) + else ( + -1 + ) + ) + | 19 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 's' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'j' && String.unsafe_get s (pos+16) = 'e' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( + 8 + ) + else ( + -1 + ) + ) + | 22 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'u' && 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) = 'm' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'f' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = '_' && String.unsafe_get s (pos+17) = 'f' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'l' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = 's' then ( + 9 + ) + else ( + -1 + ) + ) + | 27 -> ( + 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) = 'p' && 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) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' && String.unsafe_get s (pos+15) = 'i' && String.unsafe_get s (pos+16) = 'g' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 'o' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'e' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 'f' && String.unsafe_get s (pos+23) = 'i' && String.unsafe_get s (pos+24) = 'l' && String.unsafe_get s (pos+25) = 'e' && String.unsafe_get s (pos+26) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 30 -> ( + 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) = 'e' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'c' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'x' && String.unsafe_get s (pos+16) = 'p' && String.unsafe_get s (pos+17) = 'l' && String.unsafe_get s (pos+18) = 'i' && String.unsafe_get s (pos+19) = 'c' && String.unsafe_get s (pos+20) = 'i' && String.unsafe_get s (pos+21) = 't' && String.unsafe_get s (pos+22) = '_' && String.unsafe_get s (pos+23) = 't' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'r' && String.unsafe_get s (pos+26) = 'g' && String.unsafe_get s (pos+27) = 'e' && String.unsafe_get s (pos+28) = 't' && String.unsafe_get s (pos+29) = 's' then ( + 5 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -16231,37 +16714,95 @@ let read_skipped_target = ( ( match i with | 0 -> - field_path := ( + field_exclude := ( Some ( ( - read_fpath + read__string_list ) p lb ) ); | 1 -> - field_reason := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_include_ := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + ) + | 2 -> + field_max_target_bytes := ( Some ( ( - read_skip_reason + Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 2 -> + | 3 -> + field_respect_gitignore := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 4 -> + field_respect_semgrepignore_files := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 5 -> + field_always_select_explicit_targets := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 6 -> + field_explicit_targets := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_details := ( + field_force_project_root := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_project_root ) p lb ) ); ) - | 3 -> + | 8 -> + field_force_novcs_project := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 9 -> + field_exclude_minified_files := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 10 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( + field_baseline_commit := ( Some ( ( - read_rule_id + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -16275,26 +16816,131 @@ 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"); - 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; + exclude = (match !field_exclude with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exclude"); + include_ = !field_include_; + max_target_bytes = (match !field_max_target_bytes with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "max_target_bytes"); + respect_gitignore = (match !field_respect_gitignore with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "respect_gitignore"); + respect_semgrepignore_files = (match !field_respect_semgrepignore_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "respect_semgrepignore_files"); + always_select_explicit_targets = (match !field_always_select_explicit_targets with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "always_select_explicit_targets"); + explicit_targets = (match !field_explicit_targets with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "explicit_targets"); + force_project_root = !field_force_project_root; + force_novcs_project = (match !field_force_novcs_project with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "force_novcs_project"); + exclude_minified_files = (match !field_exclude_minified_files with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exclude_minified_files"); + baseline_commit = !field_baseline_commit; } - : skipped_target) + : targeting_conf) ) ) -let skipped_target_of_string s = - read_skipped_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__version_option = ( +let targeting_conf_of_string s = + read_targeting_conf (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_product ?(len = 1024) x = + let ob = Buffer.create len in + write_product ob x; + Buffer.contents ob +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 + | "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__x_7982d5d = ( + fun ob x -> ( + let x = ( Analyzer.unwrap ) x in ( + Yojson.Safe.write_string + ) ob x) +) +let string_of__x_7982d5d ?(len = 1024) x = + let ob = Buffer.create len in + write__x_7982d5d ob x; + Buffer.contents ob +let read__x_7982d5d = ( + fun p lb -> + let x = ( + Atdgen_runtime.Oj_run.read_string + ) p lb in + ( Analyzer.wrap ) x +) +let _x_7982d5d_of_string s = + read__x_7982d5d (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_analyzer = ( + write__x_7982d5d +) +let string_of_analyzer ?(len = 1024) x = + let ob = Buffer.create len in + write_analyzer ob x; + Buffer.contents ob +let read_analyzer = ( + read__x_7982d5d +) +let analyzer_of_string s = + read_analyzer (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_version + write_lockfile ) ) -let string_of__version_option ?(len = 1024) x = +let string_of__lockfile_option ?(len = 1024) x = let ob = Buffer.create len in - write__version_option ob x; + write__lockfile_option ob x; Buffer.contents ob -let read__version_option = ( +let read__lockfile_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -16307,7 +16953,7 @@ let read__version_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_version + read_lockfile ) p lb in Yojson.Safe.read_space p lb; @@ -16330,7 +16976,7 @@ let read__version_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_version + read_lockfile ) p lb in Yojson.Safe.read_space p lb; @@ -16340,66 +16986,64 @@ let read__version_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _version_option_of_string s = - read__version_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_incompatible_rule : _ -> incompatible_rule -> _ = ( - fun ob (x : incompatible_rule) -> +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 "\"rule_id\":"; + Buffer.add_string ob "\"path\":"; ( - write_rule_id + write_fpath ) - ob x.rule_id; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"this_version\":"; + Buffer.add_string ob "\"analyzer\":"; ( - write_version + write_analyzer ) - ob x.this_version; - (match x.min_version with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"min_version\":"; - ( - write_version - ) - ob x; - ); - (match x.max_version with None -> () | Some x -> + ob x.analyzer; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"products\":"; + ( + write__product_list + ) + 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 "\"max_version\":"; + Buffer.add_string ob "\"lockfile_target\":"; ( - write_version + write_lockfile ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_incompatible_rule ?(len = 1024) x = +let string_of_code_target ?(len = 1024) x = let ob = Buffer.create len in - write_incompatible_rule ob x; + write_code_target ob x; Buffer.contents ob -let read_incompatible_rule = ( +let read_code_target = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_rule_id = ref (None) in - let field_this_version = ref (None) in - let field_min_version = ref (None) in - let field_max_version = ref (None) 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; @@ -16409,44 +17053,39 @@ let read_incompatible_rule = ( 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) = '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 ( + | 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 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'm' then ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'x' && 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 ( - 3 - ) - 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 ) - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && 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 ( - 2 - ) - else ( - -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 ) - ) - else ( - -1 - ) + ) + | _ -> ( + -1 + ) ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( - 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 ) else ( -1 @@ -16461,37 +17100,35 @@ let read_incompatible_rule = ( ( match i with | 0 -> - field_rule_id := ( + field_path := ( Some ( ( - read_rule_id + read_fpath ) p lb ) ); | 1 -> - field_this_version := ( + field_analyzer := ( Some ( ( - read_version + read_analyzer ) p lb ) ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_min_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) + field_products := ( + Some ( + ( + read__product_list + ) p lb + ) + ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_max_version := ( + field_lockfile_target := ( Some ( ( - read_version + read_lockfile ) p lb ) ); @@ -16509,44 +17146,39 @@ let read_incompatible_rule = ( 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) = '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 ( + | 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 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'm' then ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'x' && 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 ( - 3 - ) - 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 ) - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && 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 ( - 2 - ) - else ( - -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 ) - ) - else ( - -1 - ) + ) + | _ -> ( + -1 + ) ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( - 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 ) else ( -1 @@ -16561,37 +17193,35 @@ let read_incompatible_rule = ( ( match i with | 0 -> - field_rule_id := ( + field_path := ( Some ( ( - read_rule_id + read_fpath ) p lb ) ); | 1 -> - field_this_version := ( + field_analyzer := ( Some ( ( - read_version + read_analyzer ) p lb ) ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_min_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) + field_products := ( + Some ( + ( + read__product_list + ) p lb + ) + ); | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_max_version := ( + field_lockfile_target := ( Some ( ( - read_version + read_lockfile ) p lb ) ); @@ -16605,508 +17235,132 @@ let read_incompatible_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"); - this_version = (match !field_this_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "this_version"); - min_version = !field_min_version; - max_version = !field_max_version; + 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; } - : incompatible_rule) + : code_target) ) ) -let incompatible_rule_of_string s = - read_incompatible_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__location_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_location - ) -) -let string_of__location_list ?(len = 1024) x = - let ob = Buffer.create len in - write__location_list ob x; - Buffer.contents ob -let read__location_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_location - ) -) -let _location_list_of_string s = - read__location_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_error_type : _ -> error_type -> _ = ( - fun ob (x : error_type) -> +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 - | LexicalError -> Buffer.add_string ob "\"Lexical error\"" - | ParseError -> Buffer.add_string ob "\"Syntax error\"" - | OtherParseError -> Buffer.add_string ob "\"Other syntax error\"" - | AstBuilderError -> Buffer.add_string ob "\"AST builder error\"" - | RuleParseError -> Buffer.add_string ob "\"Rule parse error\"" - | SemgrepWarning -> Buffer.add_string ob "\"SemgrepWarning\"" - | SemgrepError -> Buffer.add_string ob "\"SemgrepError\"" - | InvalidRuleSchemaError -> Buffer.add_string ob "\"InvalidRuleSchemaError\"" - | UnknownLanguageError -> Buffer.add_string ob "\"UnknownLanguageError\"" - | InvalidYaml -> Buffer.add_string ob "\"Invalid YAML\"" - | MatchingError -> Buffer.add_string ob "\"Internal matching error\"" - | SemgrepMatchFound -> Buffer.add_string ob "\"Semgrep match found\"" - | TooManyMatches -> Buffer.add_string ob "\"Too many matches\"" - | FatalError -> Buffer.add_string ob "\"Fatal error\"" - | Timeout -> Buffer.add_string ob "\"Timeout\"" - | OutOfMemory -> Buffer.add_string ob "\"Out of memory\"" - | StackOverflow -> Buffer.add_string ob "\"Stack overflow\"" - | TimeoutDuringInterfile -> Buffer.add_string ob "\"Timeout during interfile analysis\"" - | OutOfMemoryDuringInterfile -> Buffer.add_string ob "\"OOM during interfile analysis\"" - | MissingPlugin -> Buffer.add_string ob "\"Missing plugin\"" - | PatternParseError x -> - Buffer.add_string ob "[\"PatternParseError\","; - ( - write__string_list - ) ob x; - Buffer.add_char ob ']' - | PartialParsing x -> - Buffer.add_string ob "[\"PartialParsing\","; - ( - write__location_list - ) ob x; - Buffer.add_char ob ']' - | IncompatibleRule x -> - Buffer.add_string ob "[\"IncompatibleRule\","; + | `CodeTarget x -> + Buffer.add_string ob "[\"CodeTarget\","; ( - write_incompatible_rule + write_code_target ) ob x; Buffer.add_char ob ']' - | PatternParseError0 -> Buffer.add_string ob "\"Pattern parse error\"" - | IncompatibleRule0 -> Buffer.add_string ob "\"Incompatible rule\"" - | DependencyResolutionError x -> - Buffer.add_string ob "[\"DependencyResolutionError\","; + | `LockfileTarget x -> + Buffer.add_string ob "[\"LockfileTarget\","; ( - write_resolution_error_kind + write_lockfile ) ob x; Buffer.add_char ob ']' ) -let string_of_error_type ?(len = 1024) x = +let string_of_target ?(len = 1024) x = let ob = Buffer.create len in - write_error_type ob x; + write_target ob x; Buffer.contents ob -let read_error_type = ( +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 - | "Lexical error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (LexicalError : error_type) - | "Syntax error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (ParseError : error_type) - | "Other syntax error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OtherParseError : error_type) - | "AST builder error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (AstBuilderError : error_type) - | "Rule parse error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (RuleParseError : error_type) - | "SemgrepWarning" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepWarning : error_type) - | "SemgrepError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepError : error_type) - | "InvalidRuleSchemaError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (InvalidRuleSchemaError : error_type) - | "UnknownLanguageError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (UnknownLanguageError : error_type) - | "Invalid YAML" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (InvalidYaml : error_type) - | "Internal matching error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (MatchingError : error_type) - | "Semgrep match found" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepMatchFound : error_type) - | "Too many matches" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (TooManyMatches : error_type) - | "Fatal error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (FatalError : error_type) - | "Timeout" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Timeout : error_type) - | "Out of memory" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OutOfMemory : error_type) - | "Stack overflow" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (StackOverflow : error_type) - | "Timeout during interfile analysis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (TimeoutDuringInterfile : error_type) - | "OOM during interfile analysis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OutOfMemoryDuringInterfile : error_type) - | "Missing plugin" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (MissingPlugin : error_type) - | "PatternParseError" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PatternParseError x : error_type) - | "PartialParsing" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__location_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PartialParsing x : error_type) - | "IncompatibleRule" -> + | "CodeTarget" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_incompatible_rule + read_code_target ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (IncompatibleRule x : error_type) - | "Pattern parse error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PatternParseError0 : error_type) - | "Incompatible rule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (IncompatibleRule0 : error_type) - | "DependencyResolutionError" -> + `CodeTarget x + | "LockfileTarget" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_resolution_error_kind + read_lockfile ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (DependencyResolutionError x : error_type) + `LockfileTarget x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "Lexical error" -> - (LexicalError : error_type) - | "Syntax error" -> - (ParseError : error_type) - | "Other syntax error" -> - (OtherParseError : error_type) - | "AST builder error" -> - (AstBuilderError : error_type) - | "Rule parse error" -> - (RuleParseError : error_type) - | "SemgrepWarning" -> - (SemgrepWarning : error_type) - | "SemgrepError" -> - (SemgrepError : error_type) - | "InvalidRuleSchemaError" -> - (InvalidRuleSchemaError : error_type) - | "UnknownLanguageError" -> - (UnknownLanguageError : error_type) - | "Invalid YAML" -> - (InvalidYaml : error_type) - | "Internal matching error" -> - (MatchingError : error_type) - | "Semgrep match found" -> - (SemgrepMatchFound : error_type) - | "Too many matches" -> - (TooManyMatches : error_type) - | "Fatal error" -> - (FatalError : error_type) - | "Timeout" -> - (Timeout : error_type) - | "Out of memory" -> - (OutOfMemory : error_type) - | "Stack overflow" -> - (StackOverflow : error_type) - | "Timeout during interfile analysis" -> - (TimeoutDuringInterfile : error_type) - | "OOM during interfile analysis" -> - (OutOfMemoryDuringInterfile : error_type) - | "Missing plugin" -> - (MissingPlugin : error_type) - | "Pattern parse error" -> - (PatternParseError0 : error_type) - | "Incompatible rule" -> - (IncompatibleRule0 : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "PatternParseError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (PatternParseError x : error_type) - | "PartialParsing" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__location_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (PartialParsing x : error_type) - | "IncompatibleRule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_incompatible_rule - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (IncompatibleRule x : error_type) - | "DependencyResolutionError" -> + | "CodeTarget" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_resolution_error_kind + read_code_target ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (DependencyResolutionError x : error_type) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let error_type_of_string s = - read_error_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_error_severity = ( - fun ob x -> - match x with - | `Error -> Buffer.add_string ob "\"error\"" - | `Warning -> Buffer.add_string ob "\"warn\"" - | `Info -> Buffer.add_string ob "\"info\"" -) -let string_of_error_severity ?(len = 1024) x = - let ob = Buffer.create len in - write_error_severity ob x; - Buffer.contents ob -let read_error_severity = ( - 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 - | "warn" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Warning - | "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 - | "warn" -> - `Warning - | "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 error_severity_of_string s = - read_error_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__location_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_location - ) -) -let string_of__location_option ?(len = 1024) x = - let ob = Buffer.create len in - write__location_option ob x; - Buffer.contents ob -let read__location_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_location - ) 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" -> + `CodeTarget x + | "LockfileTarget" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_location + read_lockfile ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + `LockfileTarget x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _location_option_of_string s = - read__location_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_core_error : _ -> core_error -> _ = ( - fun ob (x : core_error) -> +let target_of_string s = + read_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_scanning_roots : _ -> scanning_roots -> _ = ( + fun ob (x : scanning_roots) -> 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 "\"error_type\":"; - ( - write_error_type - ) - ob x.error_type; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"severity\":"; + Buffer.add_string ob "\"root_paths\":"; ( - write_error_severity + write__fpath_list ) - ob x.severity; + ob x.root_paths; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; + Buffer.add_string ob "\"targeting_conf\":"; ( - Yojson.Safe.write_string + write_targeting_conf ) - ob x.message; - (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.location with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"location\":"; - ( - write_location - ) - 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; - ); + ob x.targeting_conf; Buffer.add_char ob '}'; ) -let string_of_core_error ?(len = 1024) x = +let string_of_scanning_roots ?(len = 1024) x = let ob = Buffer.create len in - write_core_error ob x; + write_scanning_roots ob x; Buffer.contents ob -let read_core_error = ( +let read_scanning_roots = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_error_type = ref (None) in - let field_severity = ref (None) in - let field_message = ref (None) in - let field_details = ref (None) in - let field_location = ref (None) in - let field_rule_id = ref (None) in + let field_root_paths = ref (None) in + let field_targeting_conf = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -17116,66 +17370,22 @@ let read_core_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 - | 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 ( - 3 - ) - else ( - -1 - ) - ) - | 'm' -> ( - if 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 ( - 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 ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - 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) = 'a' && 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 ( - 4 - ) - 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 ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 10 -> ( - if String.unsafe_get s pos = 'e' && 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) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' then ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 's' then ( 0 ) else ( -1 ) ) + | 14 -> ( + 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' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' then ( + 1 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -17185,59 +17395,21 @@ let read_core_error = ( ( match i with | 0 -> - field_error_type := ( + field_root_paths := ( Some ( ( - read_error_type + read__fpath_list ) p lb ) ); | 1 -> - field_severity := ( - Some ( - ( - read_error_severity - ) p lb - ) - ); - | 2 -> - field_message := ( + field_targeting_conf := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_targeting_conf ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_location := ( - Some ( - ( - read_location - ) p lb - ) - ); - ) - | 5 -> - 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 ) @@ -17251,66 +17423,22 @@ let read_core_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 - | 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 ( - 3 - ) - else ( - -1 - ) - ) - | 'm' -> ( - if 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 ( - 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 ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - 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) = 'a' && 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 ( - 4 - ) - 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 ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) | 10 -> ( - if String.unsafe_get s pos = 'e' && 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) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' then ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 's' then ( 0 ) else ( -1 ) ) + | 14 -> ( + 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' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = '_' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' then ( + 1 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -17320,59 +17448,21 @@ let read_core_error = ( ( match i with | 0 -> - field_error_type := ( + field_root_paths := ( Some ( ( - read_error_type + read__fpath_list ) p lb ) ); | 1 -> - field_severity := ( - Some ( - ( - read_error_severity - ) p lb - ) - ); - | 2 -> - field_message := ( + field_targeting_conf := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_targeting_conf ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_details := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_location := ( - Some ( - ( - read_location - ) p lb - ) - ); - ) - | 5 -> - 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 ) @@ -17382,94 +17472,192 @@ let read_core_error = ( with Yojson.End_of_object -> ( ( { - error_type = (match !field_error_type with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "error_type"); - severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); - message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); - details = !field_details; - location = !field_location; - rule_id = !field_rule_id; + root_paths = (match !field_root_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "root_paths"); + targeting_conf = (match !field_targeting_conf with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "targeting_conf"); } - : core_error) + : scanning_roots) ) ) -let core_error_of_string s = - read_core_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__skipped_target_list = ( +let scanning_roots_of_string s = + read_scanning_roots (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__target_list = ( Atdgen_runtime.Oj_run.write_list ( - write_skipped_target + write_target ) ) -let string_of__skipped_target_list ?(len = 1024) x = +let string_of__target_list ?(len = 1024) x = let ob = Buffer.create len in - write__skipped_target_list ob x; + write__target_list ob x; Buffer.contents ob -let read__skipped_target_list = ( +let read__target_list = ( Atdgen_runtime.Oj_run.read_list ( - read_skipped_target + read_target ) ) -let _skipped_target_list_of_string s = - read__skipped_target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__core_error_list = ( +let _target_list_of_string s = + read__target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_targets = ( + fun ob x -> + match x with + | `Scanning_roots x -> + Buffer.add_string ob "[\"Scanning_roots\","; + ( + write_scanning_roots + ) ob x; + Buffer.add_char ob ']' + | `Targets x -> + Buffer.add_string ob "[\"Targets\","; + ( + write__target_list + ) ob x; + Buffer.add_char ob ']' +) +let string_of_targets ?(len = 1024) x = + let ob = Buffer.create len in + write_targets ob x; + Buffer.contents ob +let read_targets = ( + 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 + | "Scanning_roots" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_scanning_roots + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Scanning_roots x + | "Targets" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__target_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Targets 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 + | "Scanning_roots" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_scanning_roots + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Scanning_roots x + | "Targets" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__target_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `Targets x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +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 ( - write_core_error + Yojson.Safe.write_std_float ) ) -let string_of__core_error_list ?(len = 1024) x = +let string_of__float_list ?(len = 1024) x = let ob = Buffer.create len in - write__core_error_list ob x; + write__float_list ob x; Buffer.contents ob -let read__core_error_list = ( +let read__float_list = ( Atdgen_runtime.Oj_run.read_list ( - read_core_error + Atdgen_runtime.Oj_run.read_number ) ) -let _core_error_list_of_string s = - read__core_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_target_discovery_result : _ -> target_discovery_result -> _ = ( - fun ob (x : target_discovery_result) -> +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 "\"target_paths\":"; + Buffer.add_string ob "\"path\":"; ( - write__fpath_list + write_fpath ) - ob x.target_paths; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"errors\":"; + Buffer.add_string ob "\"num_bytes\":"; ( - write__core_error_list + Yojson.Safe.write_int ) - ob x.errors; + ob x.num_bytes; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"skipped\":"; + Buffer.add_string ob "\"match_times\":"; ( - write__skipped_target_list + write__float_list ) - ob x.skipped; + 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_target_discovery_result ?(len = 1024) x = +let string_of_target_times ?(len = 1024) x = let ob = Buffer.create len in - write_target_discovery_result ob x; + write_target_times ob x; Buffer.contents ob -let read_target_discovery_result = ( +let read_target_times = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_target_paths = ref (None) in - let field_errors = ref (None) in - let field_skipped = 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; @@ -17479,30 +17667,52 @@ let read_target_discovery_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 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 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 ) ) - | 7 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'k' && 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 ( - 2 + | 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 ) ) - | 12 -> ( - 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' && 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) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 's' then ( - 0 + | 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 ) @@ -17512,26 +17722,42 @@ let read_target_discovery_result = ( ( match i with | 0 -> - field_target_paths := ( + field_path := ( Some ( ( - read__fpath_list + read_fpath ) p lb ) ); | 1 -> - field_errors := ( + field_num_bytes := ( Some ( ( - read__core_error_list + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_skipped := ( + field_match_times := ( Some ( ( - read__skipped_target_list + 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 ) ); @@ -17548,30 +17774,52 @@ let read_target_discovery_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 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 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 ) ) - | 7 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'k' && 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 ( - 2 + | 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 ) ) - | 12 -> ( - 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' && 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) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 's' then ( - 0 + | 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 ) @@ -17581,26 +17829,42 @@ let read_target_discovery_result = ( ( match i with | 0 -> - field_target_paths := ( + field_path := ( Some ( ( - read__fpath_list + read_fpath ) p lb ) ); | 1 -> - field_errors := ( + field_num_bytes := ( Some ( ( - read__core_error_list + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_skipped := ( + field_match_times := ( Some ( ( - read__skipped_target_list + 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 ) ); @@ -17613,159 +17877,281 @@ let read_target_discovery_result = ( with Yojson.End_of_object -> ( ( { - target_paths = (match !field_target_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "target_paths"); - errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); - skipped = (match !field_skipped with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "skipped"); - } - : target_discovery_result) - ) + 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"); + } + : target_times) + ) ) -let target_discovery_result_of_string s = - read_target_discovery_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_tag = ( - Yojson.Safe.write_string +let target_times_of_string s = + read_target_times (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_tag ?(len = 1024) x = +let string_of_skip_reason ?(len = 1024) x = let ob = Buffer.create len in - write_tag ob x; + write_skip_reason ob x; Buffer.contents ob -let read_tag = ( - Atdgen_runtime.Oj_run.read_string +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 + ) ) -let tag_of_string s = - read_tag (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_symbol : _ -> symbol -> _ = ( - fun ob (x : symbol) -> - 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 "\"fqn\":"; - ( - write__string_list - ) - ob x.fqn; - Buffer.add_char ob '}'; +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 string_of_symbol ?(len = 1024) x = +let string_of__rule_id_option ?(len = 1024) x = let ob = Buffer.create len in - write_symbol ob x; + write__rule_id_option ob x; Buffer.contents ob -let read_symbol = ( +let read__rule_id_option = ( fun p lb -> Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_fqn = 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 = 3 && String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'q' && String.unsafe_get s (pos+2) = 'n' 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_fqn := ( - Some ( - ( - read__string_list + 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 - ) - ); - | _ -> ( - 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 = 3 && String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'q' && String.unsafe_get s (pos+2) = 'n' 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_fqn := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - fqn = (match !field_fqn with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fqn"); - } - : symbol) - ) + 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_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 symbol_of_string s = - read_symbol (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_symbol_usage : _ -> symbol_usage -> _ = ( - fun ob (x : symbol_usage) -> +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 "\"symbol\":"; + Buffer.add_string ob "\"path\":"; ( - write_symbol + write_fpath ) - ob x.symbol; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"locs\":"; + Buffer.add_string ob "\"reason\":"; ( - write__location_list + write_skip_reason ) - ob x.locs; + 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_symbol_usage ?(len = 1024) x = +let string_of_skipped_target ?(len = 1024) x = let ob = Buffer.create len in - write_symbol_usage ob x; + write_skipped_target ob x; Buffer.contents ob -let read_symbol_usage = ( +let read_skipped_target = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_symbol = ref (None) in - let field_locs = 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; @@ -17776,21 +18162,43 @@ let read_symbol_usage = ( 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 = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 's' then ( - 1 + 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 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' then ( - 0 + 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 ) ) + | 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 ) @@ -17800,21 +18208,41 @@ let read_symbol_usage = ( ( match i with | 0 -> - field_symbol := ( + field_path := ( Some ( ( - read_symbol + read_fpath ) p lb ) ); | 1 -> - field_locs := ( + field_reason := ( Some ( ( - read__location_list + 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 + ) + ); + ) + | 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 ) @@ -17829,21 +18257,43 @@ let read_symbol_usage = ( 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 = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 's' then ( - 1 + 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 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' then ( - 0 + 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 ) ) + | 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 ) @@ -17853,21 +18303,41 @@ let read_symbol_usage = ( ( match i with | 0 -> - field_symbol := ( + field_path := ( Some ( ( - read_symbol + read_fpath ) p lb ) ); | 1 -> - field_locs := ( + field_reason := ( Some ( ( - read__location_list + 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 + ) + ); + ) + | 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 ) @@ -17877,375 +18347,131 @@ let read_symbol_usage = ( with Yojson.End_of_object -> ( ( { - symbol = (match !field_symbol with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "symbol"); - locs = (match !field_locs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "locs"); + 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; } - : symbol_usage) + : skipped_target) ) ) -let symbol_usage_of_string s = - read_symbol_usage (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__symbol_usage_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_symbol_usage - ) -) -let string_of__symbol_usage_list ?(len = 1024) x = - let ob = Buffer.create len in - write__symbol_usage_list ob x; - Buffer.contents ob -let read__symbol_usage_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_symbol_usage +let skipped_target_of_string s = + read_skipped_target (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__version_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_version ) ) -let _symbol_usage_list_of_string s = - read__symbol_usage_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_symbol_analysis = ( - write__symbol_usage_list -) -let string_of_symbol_analysis ?(len = 1024) x = +let string_of__version_option ?(len = 1024) x = let ob = Buffer.create len in - write_symbol_analysis ob x; + write__version_option ob x; Buffer.contents ob -let read_symbol_analysis = ( - read__symbol_usage_list -) -let symbol_analysis_of_string s = - read_symbol_analysis (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 - | "LockfileParsing" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LockfileParsing - | "DynamicResolution" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DynamicResolution - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "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_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_dependency_source_file_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_dependency_source_file_kind ob x; - Buffer.contents ob -let read_dependency_source_file_kind = ( +let read__version_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 - | "Lockfile" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_lockfile_kind - ) p lb - in + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Lockfile x - | "Manifest" -> + (None : _ option) + | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_manifest_kind + read_version ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Manifest x + (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 - | "Lockfile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_lockfile_kind - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Lockfile x - | "Manifest" -> + | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_manifest_kind + read_version ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - `Manifest x + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -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 _version_option_of_string s = + read__version_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_incompatible_rule : _ -> incompatible_rule -> _ = ( + fun ob (x : incompatible_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 "\"kind\":"; + Buffer.add_string ob "\"rule_id\":"; ( - write_dependency_source_file_kind + write_rule_id ) - ob x.kind; + ob x.rule_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; + Buffer.add_string ob "\"this_version\":"; ( - write_fpath + write_version ) - ob x.path; - Buffer.add_char ob '}'; -) -let string_of_dependency_source_file ?(len = 1024) x = - let ob = Buffer.create len in - write_dependency_source_file ob x; - Buffer.contents ob -let read_dependency_source_file = ( - 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 - 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 ( - 0 - ) - 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' 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; + ob x.this_version; + (match x.min_version with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"min_version\":"; ( - match i with - | 0 -> - field_kind := ( - Some ( - ( - read_dependency_source_file_kind - ) p lb - ) - ); - | 1 -> - field_path := ( - 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); - 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 - ) - ) - | '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 ( - ( - read_dependency_source_file_kind - ) p lb - ) - ); - | 1 -> - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - 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"); - } - : dependency_source_file) + write_version ) -) -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 "\"resolution_method\":"; - ( - write_resolution_method - ) - ob x.resolution_method; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_count\":"; - ( - Yojson.Safe.write_int - ) - ob x.dependency_count; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ecosystem\":"; - ( - write_ecosystem - ) - ob x.ecosystem; + ob x; + ); + (match x.max_version with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"max_version\":"; + ( + write_version + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_dependency_resolution_stats ?(len = 1024) x = +let string_of_incompatible_rule ?(len = 1024) x = let ob = Buffer.create len in - write_dependency_resolution_stats ob x; + write_incompatible_rule ob x; Buffer.contents ob -let read_dependency_resolution_stats = ( +let read_incompatible_rule = ( 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_rule_id = ref (None) in + let field_this_version = ref (None) in + let field_min_version = ref (None) in + let field_max_version = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18255,25 +18481,44 @@ 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 + | 7 -> ( + 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) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' 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 ( - 1 + | 11 -> ( + if String.unsafe_get s pos = 'm' then ( + match String.unsafe_get s (pos+1) with + | 'a' -> ( + if String.unsafe_get s (pos+2) = 'x' && 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 ( + 3 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+2) = 'n' && 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 ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -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 + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( + 1 ) else ( -1 @@ -18288,29 +18533,41 @@ let read_dependency_resolution_stats = ( ( match i with | 0 -> - field_resolution_method := ( + field_rule_id := ( Some ( ( - read_resolution_method + read_rule_id ) p lb ) ); | 1 -> - field_dependency_count := ( + field_this_version := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_version ) p lb ) ); | 2 -> - field_ecosystem := ( - Some ( - ( - read_ecosystem - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_min_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_max_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -18324,25 +18581,44 @@ 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 + | 7 -> ( + 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) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' 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 ( - 1 + | 11 -> ( + if String.unsafe_get s pos = 'm' then ( + match String.unsafe_get s (pos+1) with + | 'a' -> ( + if String.unsafe_get s (pos+2) = 'x' && 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 ( + 3 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+2) = 'n' && 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 ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -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 + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( + 1 ) else ( -1 @@ -18357,29 +18633,41 @@ let read_dependency_resolution_stats = ( ( match i with | 0 -> - field_resolution_method := ( + field_rule_id := ( Some ( ( - read_resolution_method + read_rule_id ) p lb ) ); | 1 -> - field_dependency_count := ( + field_this_version := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_version ) p lb ) ); | 2 -> - field_ecosystem := ( - Some ( - ( - read_ecosystem - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_min_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_max_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -18389,98 +18677,381 @@ 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"); + rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); + this_version = (match !field_this_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "this_version"); + min_version = !field_min_version; + max_version = !field_max_version; } - : dependency_resolution_stats) + : incompatible_rule) ) ) -let dependency_resolution_stats_of_string s = - read_dependency_resolution_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__unresolved_reason_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_unresolved_reason +let incompatible_rule_of_string s = + read_incompatible_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__location_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_location ) ) -let string_of__unresolved_reason_option ?(len = 1024) x = +let string_of__location_list ?(len = 1024) x = let ob = Buffer.create len in - write__unresolved_reason_option ob x; + write__location_list ob x; Buffer.contents ob -let read__unresolved_reason_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_unresolved_reason - ) 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 -> ( +let read__location_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_location + ) +) +let _location_list_of_string s = + read__location_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_error_type : _ -> error_type -> _ = ( + fun ob (x : error_type) -> + match x with + | LexicalError -> Buffer.add_string ob "\"Lexical error\"" + | ParseError -> Buffer.add_string ob "\"Syntax error\"" + | OtherParseError -> Buffer.add_string ob "\"Other syntax error\"" + | AstBuilderError -> Buffer.add_string ob "\"AST builder error\"" + | RuleParseError -> Buffer.add_string ob "\"Rule parse error\"" + | SemgrepWarning -> Buffer.add_string ob "\"SemgrepWarning\"" + | SemgrepError -> Buffer.add_string ob "\"SemgrepError\"" + | InvalidRuleSchemaError -> Buffer.add_string ob "\"InvalidRuleSchemaError\"" + | UnknownLanguageError -> Buffer.add_string ob "\"UnknownLanguageError\"" + | InvalidYaml -> Buffer.add_string ob "\"Invalid YAML\"" + | MatchingError -> Buffer.add_string ob "\"Internal matching error\"" + | SemgrepMatchFound -> Buffer.add_string ob "\"Semgrep match found\"" + | TooManyMatches -> Buffer.add_string ob "\"Too many matches\"" + | FatalError -> Buffer.add_string ob "\"Fatal error\"" + | Timeout -> Buffer.add_string ob "\"Timeout\"" + | OutOfMemory -> Buffer.add_string ob "\"Out of memory\"" + | StackOverflow -> Buffer.add_string ob "\"Stack overflow\"" + | TimeoutDuringInterfile -> Buffer.add_string ob "\"Timeout during interfile analysis\"" + | OutOfMemoryDuringInterfile -> Buffer.add_string ob "\"OOM during interfile analysis\"" + | MissingPlugin -> Buffer.add_string ob "\"Missing plugin\"" + | PatternParseError x -> + Buffer.add_string ob "[\"PatternParseError\","; + ( + write__string_list + ) ob x; + Buffer.add_char ob ']' + | PartialParsing x -> + Buffer.add_string ob "[\"PartialParsing\","; + ( + write__location_list + ) ob x; + Buffer.add_char ob ']' + | IncompatibleRule x -> + Buffer.add_string ob "[\"IncompatibleRule\","; + ( + write_incompatible_rule + ) ob x; + Buffer.add_char ob ']' + | PatternParseError0 -> Buffer.add_string ob "\"Pattern parse error\"" + | IncompatibleRule0 -> Buffer.add_string ob "\"Incompatible rule\"" + | DependencyResolutionError x -> + Buffer.add_string ob "[\"DependencyResolutionError\","; + ( + write_resolution_error_kind + ) ob x; + Buffer.add_char ob ']' +) +let string_of_error_type ?(len = 1024) x = + let ob = Buffer.create len in + write_error_type ob x; + Buffer.contents ob +let read_error_type = ( + 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 + | "Lexical error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (LexicalError : error_type) + | "Syntax error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (ParseError : error_type) + | "Other syntax error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (OtherParseError : error_type) + | "AST builder error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (AstBuilderError : error_type) + | "Rule parse error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (RuleParseError : error_type) + | "SemgrepWarning" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SemgrepWarning : error_type) + | "SemgrepError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SemgrepError : error_type) + | "InvalidRuleSchemaError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (InvalidRuleSchemaError : error_type) + | "UnknownLanguageError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (UnknownLanguageError : error_type) + | "Invalid YAML" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (InvalidYaml : error_type) + | "Internal matching error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MatchingError : error_type) + | "Semgrep match found" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SemgrepMatchFound : error_type) + | "Too many matches" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TooManyMatches : error_type) + | "Fatal error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (FatalError : error_type) + | "Timeout" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Timeout : error_type) + | "Out of memory" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (OutOfMemory : error_type) + | "Stack overflow" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (StackOverflow : error_type) + | "Timeout during interfile analysis" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TimeoutDuringInterfile : error_type) + | "OOM during interfile analysis" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (OutOfMemoryDuringInterfile : error_type) + | "Missing plugin" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MissingPlugin : error_type) + | "PatternParseError" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__string_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PatternParseError x : error_type) + | "PartialParsing" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__location_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PartialParsing x : error_type) + | "IncompatibleRule" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_incompatible_rule + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (IncompatibleRule x : error_type) + | "Pattern parse error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PatternParseError0 : error_type) + | "Incompatible rule" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (IncompatibleRule0 : error_type) + | "DependencyResolutionError" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_resolution_error_kind + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (DependencyResolutionError x : error_type) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "Lexical error" -> + (LexicalError : error_type) + | "Syntax error" -> + (ParseError : error_type) + | "Other syntax error" -> + (OtherParseError : error_type) + | "AST builder error" -> + (AstBuilderError : error_type) + | "Rule parse error" -> + (RuleParseError : error_type) + | "SemgrepWarning" -> + (SemgrepWarning : error_type) + | "SemgrepError" -> + (SemgrepError : error_type) + | "InvalidRuleSchemaError" -> + (InvalidRuleSchemaError : error_type) + | "UnknownLanguageError" -> + (UnknownLanguageError : error_type) + | "Invalid YAML" -> + (InvalidYaml : error_type) + | "Internal matching error" -> + (MatchingError : error_type) + | "Semgrep match found" -> + (SemgrepMatchFound : error_type) + | "Too many matches" -> + (TooManyMatches : error_type) + | "Fatal error" -> + (FatalError : error_type) + | "Timeout" -> + (Timeout : error_type) + | "Out of memory" -> + (OutOfMemory : error_type) + | "Stack overflow" -> + (StackOverflow : error_type) + | "Timeout during interfile analysis" -> + (TimeoutDuringInterfile : error_type) + | "OOM during interfile analysis" -> + (OutOfMemoryDuringInterfile : error_type) + | "Missing plugin" -> + (MissingPlugin : error_type) + | "Pattern parse error" -> + (PatternParseError0 : error_type) + | "Incompatible rule" -> + (IncompatibleRule0 : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> + | "PatternParseError" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_unresolved_reason + read__string_list ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + (PatternParseError x : error_type) + | "PartialParsing" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__location_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (PartialParsing x : error_type) + | "IncompatibleRule" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_incompatible_rule + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (IncompatibleRule x : error_type) + | "DependencyResolutionError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_resolution_error_kind + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (DependencyResolutionError x : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _unresolved_reason_option_of_string s = - read__unresolved_reason_option (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 error_type_of_string s = + read_error_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_error_severity = ( + fun ob x -> + match x with + | `Error -> Buffer.add_string ob "\"error\"" + | `Warning -> Buffer.add_string ob "\"warn\"" + | `Info -> Buffer.add_string ob "\"info\"" ) -let string_of__dependency_source_file_list ?(len = 1024) x = +let string_of_error_severity ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_source_file_list ob x; + write_error_severity ob x; Buffer.contents ob -let read__dependency_source_file_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_dependency_source_file - ) +let read_error_severity = ( + 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 + | "warn" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Warning + | "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 + | "warn" -> + `Warning + | "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 _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 = ( +let error_severity_of_string s = + read_error_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__location_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_dependency_resolution_stats + write_location ) ) -let string_of__dependency_resolution_stats_option ?(len = 1024) x = +let string_of__location_option ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_resolution_stats_option ob x; + write__location_option ob x; Buffer.contents ob -let read__dependency_resolution_stats_option = ( +let read__location_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -18493,7 +19064,7 @@ let read__dependency_resolution_stats_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_dependency_resolution_stats + read_location ) p lb in Yojson.Safe.read_space p lb; @@ -18516,7 +19087,7 @@ let read__dependency_resolution_stats_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_dependency_resolution_stats + read_location ) p lb in Yojson.Safe.read_space p lb; @@ -18526,76 +19097,88 @@ let read__dependency_resolution_stats_option = ( 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 _location_option_of_string s = + read__location_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_core_error : _ -> core_error -> _ = ( + fun ob (x : core_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 "\"subproject_id\":"; + Buffer.add_string ob "\"error_type\":"; ( - Yojson.Safe.write_string + write_error_type ) - ob x.subproject_id; + ob x.error_type; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_sources\":"; + Buffer.add_string ob "\"severity\":"; ( - write__dependency_source_file_list + write_error_severity ) - ob x.dependency_sources; - (match x.resolved_stats with None -> () | Some x -> + ob x.severity; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"message\":"; + ( + Yojson.Safe.write_string + ) + ob x.message; + (match x.details with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"resolved_stats\":"; + Buffer.add_string ob "\"details\":"; ( - write_dependency_resolution_stats + Yojson.Safe.write_string ) ob x; ); - (match x.unresolved_reason with None -> () | Some x -> + (match x.location with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"unresolved_reason\":"; + Buffer.add_string ob "\"location\":"; ( - write_unresolved_reason + write_location + ) + 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; ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"errors\":"; - ( - write__sca_error_list - ) - ob x.errors; Buffer.add_char ob '}'; ) -let string_of_subproject_stats ?(len = 1024) x = +let string_of_core_error ?(len = 1024) x = let ob = Buffer.create len in - write_subproject_stats ob x; + write_core_error ob x; Buffer.contents ob -let read_subproject_stats = ( +let read_core_error = ( 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_unresolved_reason = ref (None) in - let field_errors = ref ([]) in + let field_error_type = ref (None) in + let field_severity = ref (None) in + let field_message = ref (None) in + let field_details = ref (None) in + let field_location = ref (None) in + let field_rule_id = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18605,48 +19188,68 @@ let read_subproject_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 - | 6 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 4 - ) - else ( - -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 ( + 3 + ) + else ( + -1 + ) + ) + | 'm' -> ( + if 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 ( + 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 ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 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 ( + | 8 -> ( + 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) = 'a' && 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 ( + 4 + ) + 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 ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 10 -> ( + if String.unsafe_get s pos = 'e' && 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) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' 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 - ) - ) - | 17 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'v' && 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) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'n' then ( - 3 - ) - 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 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 + | _ -> ( + -1 ) in let i = Yojson.Safe.map_ident p f lb in @@ -18654,47 +19257,57 @@ let read_subproject_stats = ( ( match i with | 0 -> - field_subproject_id := ( + field_error_type := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_error_type ) p lb ) ); | 1 -> - field_dependency_sources := ( + field_severity := ( Some ( ( - read__dependency_source_file_list + read_error_severity ) p lb ) ); | 2 -> + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_stats := ( + field_details := ( Some ( ( - read_dependency_resolution_stats + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 3 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_unresolved_reason := ( + field_location := ( Some ( ( - read_unresolved_reason + read_location ) p lb ) ); ) - | 4 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_errors := ( - ( - read__sca_error_list - ) p lb + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) ); ) | _ -> ( @@ -18710,41 +19323,61 @@ let read_subproject_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 - | 6 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 4 - ) - else ( - -1 - ) - ) - | 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 - ) + | 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 ( + 3 + ) + else ( + -1 + ) + ) + | 'm' -> ( + if 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 ( + 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 ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 17 -> ( - if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'v' && 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) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'n' then ( - 3 - ) - else ( - -1 - ) + | 8 -> ( + 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) = 'a' && 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 ( + 4 + ) + 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 ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( + -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 + | 10 -> ( + if String.unsafe_get s pos = 'e' && 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) = '_' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' && String.unsafe_get s (pos+8) = 'p' && String.unsafe_get s (pos+9) = 'e' then ( + 0 ) else ( -1 @@ -18759,47 +19392,57 @@ let read_subproject_stats = ( ( match i with | 0 -> - field_subproject_id := ( + field_error_type := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_error_type ) p lb ) ); | 1 -> - field_dependency_sources := ( + field_severity := ( Some ( ( - read__dependency_source_file_list + read_error_severity ) p lb ) ); | 2 -> + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_resolved_stats := ( + field_details := ( Some ( ( - read_dependency_resolution_stats + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 3 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_unresolved_reason := ( + field_location := ( Some ( ( - read_unresolved_reason + read_location ) p lb ) ); ) - | 4 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_errors := ( - ( - read__sca_error_list - ) p lb + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) ); ) | _ -> ( @@ -18811,175 +19454,94 @@ 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; - unresolved_reason = !field_unresolved_reason; - errors = !field_errors; + error_type = (match !field_error_type with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "error_type"); + severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); + message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); + details = !field_details; + location = !field_location; + rule_id = !field_rule_id; } - : subproject_stats) + : core_error) ) ) -let subproject_stats_of_string s = - read_subproject_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__subproject_stats_list = ( +let core_error_of_string s = + read_core_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__skipped_target_list = ( Atdgen_runtime.Oj_run.write_list ( - write_subproject_stats + write_skipped_target ) ) -let string_of__subproject_stats_list ?(len = 1024) x = +let string_of__skipped_target_list ?(len = 1024) x = let ob = Buffer.create len in - write__subproject_stats_list ob x; + write__skipped_target_list ob x; Buffer.contents ob -let read__subproject_stats_list = ( +let read__skipped_target_list = ( Atdgen_runtime.Oj_run.read_list ( - read_subproject_stats + read_skipped_target ) ) -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 _skipped_target_list_of_string s = + read__skipped_target_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__core_error_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_core_error + ) ) -let string_of_supply_chain_stats ?(len = 1024) x = +let string_of__core_error_list ?(len = 1024) x = let ob = Buffer.create len in - write_supply_chain_stats ob x; + write__core_error_list 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__subproject_stats_list - ) 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 read__core_error_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_core_error + ) ) -let supply_chain_stats_of_string s = - read_supply_chain_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_skipped_rule : _ -> skipped_rule -> _ = ( - fun ob (x : skipped_rule) -> +let _core_error_list_of_string s = + read__core_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_target_discovery_result : _ -> target_discovery_result -> _ = ( + fun ob (x : target_discovery_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 "\"rule_id\":"; + Buffer.add_string ob "\"target_paths\":"; ( - write_rule_id + write__fpath_list ) - ob x.rule_id; + ob x.target_paths; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"details\":"; + Buffer.add_string ob "\"errors\":"; ( - Yojson.Safe.write_string + write__core_error_list ) - ob x.details; + ob x.errors; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"position\":"; + Buffer.add_string ob "\"skipped\":"; ( - write_position + write__skipped_target_list ) - ob x.position; + ob x.skipped; Buffer.add_char ob '}'; ) -let string_of_skipped_rule ?(len = 1024) x = +let string_of_target_discovery_result ?(len = 1024) x = let ob = Buffer.create len in - write_skipped_rule ob x; + write_target_discovery_result ob x; Buffer.contents ob -let read_skipped_rule = ( +let read_target_discovery_result = ( 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_target_paths = ref (None) in + let field_errors = ref (None) in + let field_skipped = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18989,36 +19551,30 @@ let read_skipped_rule = ( 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 - ) + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( + 1 + ) + else ( + -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 ( + | 7 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'k' && 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 ( 2 ) else ( -1 ) ) + | 12 -> ( + 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' && 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) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 's' then ( + 0 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -19028,26 +19584,26 @@ let read_skipped_rule = ( ( match i with | 0 -> - field_rule_id := ( + field_target_paths := ( Some ( ( - read_rule_id + read__fpath_list ) p lb ) ); | 1 -> - field_details := ( + field_errors := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__core_error_list ) p lb ) ); | 2 -> - field_position := ( + field_skipped := ( Some ( ( - read_position + read__skipped_target_list ) p lb ) ); @@ -19064,36 +19620,30 @@ let read_skipped_rule = ( 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 - ) + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( + 1 + ) + else ( + -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 ( + | 7 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'k' && 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 ( 2 ) else ( -1 ) ) + | 12 -> ( + 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' && 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) = 't' && String.unsafe_get s (pos+10) = 'h' && String.unsafe_get s (pos+11) = 's' then ( + 0 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -19103,26 +19653,26 @@ let read_skipped_rule = ( ( match i with | 0 -> - field_rule_id := ( + field_target_paths := ( Some ( ( - read_rule_id + read__fpath_list ) p lb ) ); | 1 -> - field_details := ( + field_errors := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__core_error_list ) p lb ) ); | 2 -> - field_position := ( + field_skipped := ( Some ( ( - read_position + read__skipped_target_list ) p lb ) ); @@ -19135,108 +19685,51 @@ 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"); + target_paths = (match !field_target_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "target_paths"); + errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); + skipped = (match !field_skipped with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "skipped"); } - : skipped_rule) + : target_discovery_result) ) ) -let skipped_rule_of_string s = - read_skipped_rule (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 target_discovery_result_of_string s = + read_target_discovery_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_tag = ( + Yojson.Safe.write_string ) -let string_of__skipped_target_list_option ?(len = 1024) x = +let string_of_tag ?(len = 1024) x = let ob = Buffer.create len in - write__skipped_target_list_option ob x; + write_tag 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 = ( +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_symbol : _ -> symbol -> _ = ( + fun ob (x : symbol) -> + 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 "\"fqn\":"; + ( + write__string_list + ) + ob x.fqn; + Buffer.add_char ob '}'; +) +let string_of_symbol ?(len = 1024) x = + let ob = Buffer.create len in + write_symbol ob x; + Buffer.contents ob +let read_symbol = ( 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_fqn = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -19245,27 +19738,8 @@ 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 - ) - ) - | '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 - ) + if len = 3 && String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'q' && String.unsafe_get s (pos+2) = 'n' then ( + 0 ) else ( -1 @@ -19276,23 +19750,13 @@ let read_scanned_and_skipped = ( ( match i with | 0 -> - field_scanned := ( + field_fqn := ( Some ( ( - read__fpath_list + read__string_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 ) @@ -19305,27 +19769,8 @@ 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 - ) - ) - | '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 - ) + if len = 3 && String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'q' && String.unsafe_get s (pos+2) = 'n' then ( + 0 ) else ( -1 @@ -19336,23 +19781,13 @@ let read_scanned_and_skipped = ( ( match i with | 0 -> - field_scanned := ( + field_fqn := ( Some ( ( - read__fpath_list + read__string_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 ) @@ -19362,70 +19797,47 @@ 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; + fqn = (match !field_fqn with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fqn"); } - : scanned_and_skipped) + : symbol) ) ) -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) -> +let symbol_of_string s = + read_symbol (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_symbol_usage : _ -> symbol_usage -> _ = ( + fun ob (x : symbol_usage) -> 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 "\"symbol\":"; ( - Yojson.Safe.write_int + write_symbol ) - ob x.deployment_id; + ob x.symbol; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deployment_name\":"; + Buffer.add_string ob "\"locs\":"; ( - Yojson.Safe.write_string + write__location_list ) - ob x.deployment_name; + ob x.locs; Buffer.add_char ob '}'; ) -let string_of_scan_info ?(len = 1024) x = +let string_of_symbol_usage ?(len = 1024) x = let ob = Buffer.create len in - write_scan_info ob x; + write_symbol_usage ob x; Buffer.contents ob -let read_scan_info = ( +let read_symbol_usage = ( 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_symbol = ref (None) in + let field_locs = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -19435,33 +19847,17 @@ let read_scan_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 - | 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 + | 4 -> ( + 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) = 's' then ( + 1 ) 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 + | 6 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' then ( + 0 ) else ( -1 @@ -19476,36 +19872,18 @@ let read_scan_info = ( ( 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_symbol := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_symbol ) p lb ) ); - | 3 -> - field_deployment_name := ( + | 1 -> + field_locs := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__location_list ) p lb ) ); @@ -19522,33 +19900,17 @@ let read_scan_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 - | 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 + | 4 -> ( + 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) = 's' then ( + 1 ) 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 + | 6 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' then ( + 0 ) else ( -1 @@ -19563,36 +19925,18 @@ let read_scan_info = ( ( 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_symbol := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_symbol ) p lb ) ); - | 3 -> - field_deployment_name := ( + | 1 -> + field_locs := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read__location_list ) p lb ) ); @@ -19605,60 +19949,202 @@ 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"); + symbol = (match !field_symbol with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "symbol"); + locs = (match !field_locs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "locs"); } - : scan_info) + : symbol_usage) ) ) -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 symbol_usage_of_string s = + read_symbol_usage (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__symbol_usage_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_symbol_usage + ) +) +let string_of__symbol_usage_list ?(len = 1024) x = + let ob = Buffer.create len in + write__symbol_usage_list ob x; + Buffer.contents ob +let read__symbol_usage_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_symbol_usage + ) +) +let _symbol_usage_list_of_string s = + read__symbol_usage_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_symbol_analysis = ( + write__symbol_usage_list +) +let string_of_symbol_analysis ?(len = 1024) x = + let ob = Buffer.create len in + write_symbol_analysis ob x; + Buffer.contents ob +let read_symbol_analysis = ( + read__symbol_usage_list +) +let symbol_analysis_of_string s = + read_symbol_analysis (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 + | "LockfileParsing" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `LockfileParsing + | "DynamicResolution" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `DynamicResolution + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "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_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_dependency_source_file_kind ?(len = 1024) x = + let ob = Buffer.create len in + write_dependency_source_file_kind ob x; + Buffer.contents ob +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 + | "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; + `Lockfile x + | "Manifest" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_manifest_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 + ) 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 + ) 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 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 "\"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\":"; + Buffer.add_string ob "\"kind\":"; ( - write__string_list + write_dependency_source_file_kind ) - ob x.triage_ignored_syntactic_ids; + ob x.kind; 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 "\"path\":"; ( - write__string_list + write_fpath ) - ob x.triage_ignored_match_based_ids; + ob x.path; Buffer.add_char ob '}'; ) -let string_of_scan_configuration ?(len = 1024) x = +let string_of_dependency_source_file ?(len = 1024) x = let ob = Buffer.create len in - write_scan_configuration ob x; + write_dependency_source_file ob x; Buffer.contents ob -let read_scan_configuration = ( +let read_dependency_source_file = ( 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_kind = ref (None) in + let field_path = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -19667,63 +20153,52 @@ let read_scan_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 - | 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 + 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 + ) ) - ) - | 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 + | '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 -> - field_rules := ( + field_kind := ( Some ( ( - read_raw_json + read_dependency_source_file_kind ) 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 := ( + field_path := ( + Some ( ( - read__string_list + read_fpath ) p lb - ); - ) + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -19736,63 +20211,52 @@ let read_scan_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 - | 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 + 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 + ) ) - ) - | 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 + | '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 -> - field_rules := ( + field_kind := ( Some ( ( - read_raw_json + read_dependency_source_file_kind ) 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 := ( + field_path := ( + Some ( ( - read__string_list + read_fpath ) p lb - ); - ) + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -19802,161 +20266,58 @@ 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; + 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_configuration) + : dependency_source_file) ) ) -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) -> +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 "\"enabled\":"; + Buffer.add_string ob "\"resolution_method\":"; ( - Yojson.Safe.write_bool + write_resolution_method ) - 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.resolution_method; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dependency_count\":"; + ( + Yojson.Safe.write_int + ) + ob x.dependency_count; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"ecosystem\":"; + ( + write_ecosystem + ) + ob x.ecosystem; Buffer.add_char ob '}'; ) -let string_of_historical_configuration ?(len = 1024) x = +let string_of_dependency_resolution_stats ?(len = 1024) x = let ob = Buffer.create len in - write_historical_configuration ob x; + write_dependency_resolution_stats ob x; Buffer.contents ob -let read_historical_configuration = ( +let read_dependency_resolution_stats = ( 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_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; @@ -19966,22 +20327,30 @@ 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 ( - 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 ) ) - | 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 ( + | 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 ) ) + | 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 + ) + ) | _ -> ( -1 ) @@ -19991,23 +20360,29 @@ let read_historical_configuration = ( ( match i with | 0 -> - field_enabled := ( + field_resolution_method := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_resolution_method ) 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_dependency_count := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -20021,22 +20396,30 @@ 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 ( - 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 ) ) - | 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 ( + | 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 ) ) + | 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 + ) + ) | _ -> ( -1 ) @@ -20046,23 +20429,29 @@ let read_historical_configuration = ( ( match i with | 0 -> - field_enabled := ( + field_resolution_method := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_resolution_method ) 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_dependency_count := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_ecosystem := ( + Some ( + ( + read_ecosystem + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -20072,24 +20461,25 @@ 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; + 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"); } - : historical_configuration) + : dependency_resolution_stats) ) ) -let historical_configuration_of_string s = - read_historical_configuration (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__product_ignored_files_option = ( +let dependency_resolution_stats_of_string s = + read_dependency_resolution_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__unresolved_reason_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_product_ignored_files + write_unresolved_reason ) ) -let string_of__product_ignored_files_option ?(len = 1024) x = +let string_of__unresolved_reason_option ?(len = 1024) x = let ob = Buffer.create len in - write__product_ignored_files_option ob x; + write__unresolved_reason_option ob x; Buffer.contents ob -let read__product_ignored_files_option = ( +let read__unresolved_reason_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -20102,7 +20492,7 @@ let read__product_ignored_files_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_product_ignored_files + read_unresolved_reason ) p lb in Yojson.Safe.read_space p lb; @@ -20125,7 +20515,7 @@ let read__product_ignored_files_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_product_ignored_files + read_unresolved_reason ) p lb in Yojson.Safe.read_space p lb; @@ -20135,18 +20525,34 @@ let read__product_ignored_files_option = ( 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 = ( +let _unresolved_reason_option_of_string s = + read__unresolved_reason_option (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_historical_configuration + write_dependency_resolution_stats ) ) -let string_of__historical_configuration_option ?(len = 1024) x = +let string_of__dependency_resolution_stats_option ?(len = 1024) x = let ob = Buffer.create len in - write__historical_configuration_option ob x; + write__dependency_resolution_stats_option ob x; Buffer.contents ob -let read__historical_configuration_option = ( +let read__dependency_resolution_stats_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -20159,7 +20565,7 @@ let read__historical_configuration_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_historical_configuration + read_dependency_resolution_stats ) p lb in Yojson.Safe.read_space p lb; @@ -20182,7 +20588,7 @@ let read__historical_configuration_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_historical_configuration + read_dependency_resolution_stats ) p lb in Yojson.Safe.read_space p lb; @@ -20192,136 +20598,76 @@ let read__historical_configuration_option = ( 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_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 "\"autofix\":"; + Buffer.add_string ob "\"subproject_id\":"; ( - Yojson.Safe.write_bool + Yojson.Safe.write_string ) - ob x.autofix; + ob x.subproject_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"deepsemgrep\":"; + Buffer.add_string ob "\"dependency_sources\":"; ( - Yojson.Safe.write_bool + write__dependency_source_file_list ) - ob x.deepsemgrep; + 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; + ); + (match x.unresolved_reason with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"unresolved_reason\":"; + ( + write_unresolved_reason + ) + ob x; + ); if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_query\":"; + Buffer.add_string ob "\"errors\":"; ( - Yojson.Safe.write_bool + write__sca_error_list ) - 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 "\"scan_all_deps_in_diff_scan\":"; - ( - Yojson.Safe.write_bool - ) - ob x.scan_all_deps_in_diff_scan; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"symbol_analysis\":"; - ( - Yojson.Safe.write_bool - ) - ob x.symbol_analysis; - 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\":"; - ( - 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; + ob x.errors; Buffer.add_char ob '}'; ) -let string_of_engine_configuration ?(len = 1024) x = +let string_of_subproject_stats ?(len = 1024) x = let ob = Buffer.create len in - write_engine_configuration ob x; + write_subproject_stats ob x; Buffer.contents ob -let read_engine_configuration = ( +let read_subproject_stats = ( 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_scan_all_deps_in_diff_scan = ref (false) in - let field_symbol_analysis = 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_subproject_id = ref (None) in + let field_dependency_sources = ref (None) in + let field_resolved_stats = ref (None) in + let field_unresolved_reason = ref (None) in + let field_errors = ref ([]) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -20331,40 +20677,24 @@ let read_engine_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 = '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 + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( + 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 ( - 6 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 's' then ( - 5 + 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 ) ) - | 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 ( + | 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 ( @@ -20372,54 +20702,16 @@ let read_engine_configuration = ( ) ) | 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 ( - 9 - ) - 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 ( - 8 - ) - 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 ( - 7 - ) - 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 ( - 10 + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'v' && 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) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'n' then ( + 3 ) else ( -1 ) ) - | 26 -> ( - 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) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && 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) = 'f' && String.unsafe_get s (pos+20) = 'f' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 's' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'n' then ( - 4 + | 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 ) else ( -1 @@ -20434,94 +20726,46 @@ let read_engine_configuration = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( + field_subproject_id := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_string ) p lb - ); - ) + ) + ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( + field_dependency_sources := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__dependency_source_file_list ) 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_scan_all_deps_in_diff_scan := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_symbol_analysis := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( - ( - read__string_list - ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_product_ignored_files := ( + field_resolved_stats := ( Some ( ( - read_product_ignored_files + read_dependency_resolution_stats ) p lb ) ); ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_generic_slow_rollout := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 9 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_config := ( + field_unresolved_reason := ( Some ( ( - read_historical_configuration + read_unresolved_reason ) p lb ) ); ) - | 10 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_always_suppress_errors := ( + field_errors := ( ( - Atdgen_runtime.Oj_run.read_bool + read__sca_error_list ) p lb ); ) @@ -20538,40 +20782,24 @@ let read_engine_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 = '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 + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( + 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 ( - 6 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 's' then ( - 5 + 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 ) ) - | 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 ( + | 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 ( @@ -20579,54 +20807,16 @@ let read_engine_configuration = ( ) ) | 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 ( - 9 - ) - 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 ( - 8 - ) - 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 ( - 7 - ) - 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 ( - 10 + if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'v' && 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) = 'r' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'n' then ( + 3 ) else ( -1 ) ) - | 26 -> ( - 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) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && 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) = 'f' && String.unsafe_get s (pos+20) = 'f' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 's' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'n' then ( - 4 + | 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 ) else ( -1 @@ -20641,94 +20831,46 @@ let read_engine_configuration = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_autofix := ( + field_subproject_id := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_string ) p lb - ); - ) + ) + ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_deepsemgrep := ( + field_dependency_sources := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__dependency_source_file_list ) 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_scan_all_deps_in_diff_scan := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_symbol_analysis := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_ignored_files := ( - ( - read__string_list - ) p lb - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_product_ignored_files := ( + field_resolved_stats := ( Some ( ( - read_product_ignored_files + read_dependency_resolution_stats ) p lb ) ); ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_generic_slow_rollout := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 9 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_config := ( + field_unresolved_reason := ( Some ( ( - read_historical_configuration + read_unresolved_reason ) p lb ) ); ) - | 10 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_always_suppress_errors := ( + field_errors := ( ( - Atdgen_runtime.Oj_run.read_bool + read__sca_error_list ) p lb ); ) @@ -20741,67 +20883,57 @@ 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; - scan_all_deps_in_diff_scan = !field_scan_all_deps_in_diff_scan; - symbol_analysis = !field_symbol_analysis; - 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; + 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; + unresolved_reason = !field_unresolved_reason; + errors = !field_errors; } - : engine_configuration) + : subproject_stats) ) ) -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 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 "\"info\":"; - ( - write_scan_info - ) - ob x.info; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"config\":"; - ( - write_scan_configuration - ) - ob x.config; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_params\":"; + Buffer.add_string ob "\"subprojects_stats\":"; ( - write_engine_configuration + write__subproject_stats_list ) - ob x.engine_params; + ob x.subprojects_stats; Buffer.add_char ob '}'; ) -let string_of_scan_response ?(len = 1024) x = +let string_of_supply_chain_stats ?(len = 1024) x = let ob = Buffer.create len in - write_scan_response ob x; + write_supply_chain_stats ob x; Buffer.contents ob -let read_scan_response = ( +let read_supply_chain_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_subprojects_stats = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -20810,60 +20942,22 @@ let read_scan_response = ( 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 = '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 - ) - ) - | 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 - ) - ) - | 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 - ) - ) - | _ -> ( - -1 - ) + 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_info := ( - Some ( - ( - read_scan_info - ) p lb - ) - ); - | 1 -> - field_config := ( - Some ( - ( - read_scan_configuration - ) p lb - ) - ); - | 2 -> - field_engine_params := ( + field_subprojects_stats := ( Some ( ( - read_engine_configuration + read__subproject_stats_list ) p lb ) ); @@ -20879,60 +20973,22 @@ let read_scan_response = ( 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 = '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 - ) - ) - | 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 - ) - ) - | 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 - ) - ) - | _ -> ( - -1 - ) + 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_info := ( - Some ( - ( - read_scan_info - ) p lb - ) - ); - | 1 -> - field_config := ( - Some ( - ( - read_scan_configuration - ) p lb - ) - ); - | 2 -> - field_engine_params := ( + field_subprojects_stats := ( Some ( ( - read_engine_configuration + read__subproject_stats_list ) p lb ) ); @@ -20945,81 +21001,57 @@ 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"); + subprojects_stats = (match !field_subprojects_stats with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "subprojects_stats"); } - : scan_response) + : supply_chain_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) -> +let supply_chain_stats_of_string s = + read_supply_chain_stats (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 "\"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\":"; + Buffer.add_string ob "\"rule_id\":"; ( - write_uuid + write_rule_id ) - ob x.unique_id; + ob x.rule_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"requested_products\":"; + Buffer.add_string ob "\"details\":"; ( - write__product_list + Yojson.Safe.write_string ) - ob x.requested_products; + ob x.details; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dry_run\":"; + Buffer.add_string ob "\"position\":"; ( - Yojson.Safe.write_bool + write_position ) - 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; - ); + ob x.position; Buffer.add_char ob '}'; ) -let string_of_scan_metadata ?(len = 1024) x = +let string_of_skipped_rule ?(len = 1024) x = let ob = Buffer.create len in - write_scan_metadata ob x; + write_skipped_rule ob x; Buffer.contents ob -let read_scan_metadata = ( +let read_skipped_rule = ( 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_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; @@ -21030,34 +21062,18 @@ let read_scan_metadata = ( 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 - ) - 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 - ) - 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 + | '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 ) ) - | '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 + | '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 @@ -21067,8 +21083,8 @@ let read_scan_metadata = ( -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 ( + | 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 ( @@ -21084,47 +21100,29 @@ let read_scan_metadata = ( ( match i with | 0 -> - field_cli_version := ( + field_rule_id := ( Some ( ( - read_version + read_rule_id ) p lb ) ); | 1 -> - field_unique_id := ( + field_details := ( Some ( ( - read_uuid + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 2 -> - field_requested_products := ( + field_position := ( Some ( ( - read__product_list + read_position ) 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 ) @@ -21139,34 +21137,18 @@ let read_scan_metadata = ( 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 - ) - 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 - ) - 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 + | '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 ) ) - | '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 + | '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 @@ -21176,8 +21158,8 @@ let read_scan_metadata = ( -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 ( + | 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 ( @@ -21193,47 +21175,29 @@ let read_scan_metadata = ( ( match i with | 0 -> - field_cli_version := ( + field_rule_id := ( Some ( ( - read_version + read_rule_id ) p lb ) ); | 1 -> - field_unique_id := ( + field_details := ( Some ( ( - read_uuid + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 2 -> - field_requested_products := ( + field_position := ( Some ( ( - read__product_list + read_position ) 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 ) @@ -21243,84 +21207,25 @@ 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; + 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"); } - : scan_metadata) + : skipped_rule) ) ) -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 = ( +let skipped_rule_of_string s = + read_skipped_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__skipped_target_list_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_datetime + write__skipped_target_list ) ) -let string_of__datetime_option ?(len = 1024) x = +let string_of__skipped_target_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__datetime_option ob x; + write__skipped_target_list_option ob x; Buffer.contents ob -let read__datetime_option = ( +let read__skipped_target_list_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -21333,7 +21238,7 @@ let read__datetime_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_datetime + read__skipped_target_list ) p lb in Yojson.Safe.read_space p lb; @@ -21356,7 +21261,7 @@ let read__datetime_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_datetime + read__skipped_target_list ) p lb in Yojson.Safe.read_space p lb; @@ -21366,300 +21271,233 @@ let read__datetime_option = ( 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_project_metadata : _ -> project_metadata -> _ = ( - fun ob (x : project_metadata) -> +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 "\"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\":"; + Buffer.add_string ob "\"scanned\":"; ( - write__uri_nullable + write__fpath_list ) - 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 -> + 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 "\"repo_display_name\":"; + Buffer.add_string ob "\"skipped\":"; ( - Yojson.Safe.write_string + write__skipped_target_list ) 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\":"; + 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 + ) + ) + | '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; ( - 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; + 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 + ) + ) + | '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 "\"commit_author_image_url\":"; + Buffer.add_string ob "\"enabled_products\":"; ( - write__uri_nullable + write__product_list ) - ob x.commit_author_image_url; + ob x.enabled_products; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"ci_job_url\":"; + Buffer.add_string ob "\"deployment_id\":"; ( - write__uri_nullable + Yojson.Safe.write_int ) - ob x.ci_job_url; + ob x.deployment_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"on\":"; + Buffer.add_string ob "\"deployment_name\":"; ( 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; - ); + ob x.deployment_name; Buffer.add_char ob '}'; ) -let string_of_project_metadata ?(len = 1024) x = +let string_of_scan_info ?(len = 1024) x = let ob = Buffer.create len in - write_project_metadata ob x; + write_scan_info ob x; Buffer.contents ob -let read_project_metadata = ( +let read_scan_info = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - 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_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; @@ -21670,261 +21508,257 @@ let read_project_metadata = ( 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 ( - 15 + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' 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 ( - 6 - ) - 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 ( - 7 - ) - 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 ( - 4 - ) - 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 ( - 3 + | 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 ) ) - | 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 ( - 20 - ) - 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 ( - 2 - ) - 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 ( - 21 + | 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 ) ) - | 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 ( - 14 - ) - 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 ( - 1 - ) - 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 ( - 23 + | 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 ) ) - | 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 ( - 8 - ) - 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 ( - 24 - ) - 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 ( - 22 - ) - 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 ( - 25 - ) - 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 ( - 18 - ) - 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 ) - | 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 ( - 9 - ) - 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 ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + ); + | 2 -> + field_deployment_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb ) - | 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 ( - 5 - ) - else ( - -1 - ) + ); + | 3 -> + field_deployment_name := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb ) - | 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 ( - 11 - ) - 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 ( - 19 - ) - 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 ( - 10 + ); + | _ -> ( + 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 + ) ) - else ( + | 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 + ) + 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 + ) + ); ) - | 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 ( - 12 + | 1 -> + field_enabled_products := ( + Some ( + ( + read__product_list + ) p lb ) - else ( - -1 + ); + | 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 ) - | 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 ( - 13 + ); + 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 = '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 ( - 16 + 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 ) ) - | 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 ( - 17 + | 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 @@ -21939,229 +21773,27 @@ let read_project_metadata = ( ( match i with | 0 -> - field_scan_environment := ( + field_rules := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_raw_json ) p lb ) ); | 1 -> - field_repository := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - field_repo_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_org_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_repo_display_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 6 -> - field_branch := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 7 -> - field_commit := ( - Some ( - ( - read__sha1_nullable - ) p lb - ) - ); - | 8 -> - field_commit_title := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 9 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_commit_timestamp := ( - Some ( - ( - read_datetime - ) p lb - ) - ); - ) - | 10 -> - field_commit_author_email := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 11 -> - field_commit_author_name := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 12 -> - field_commit_author_username := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 13 -> - field_commit_author_image_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 14 -> - field_ci_job_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 15 -> - field_on := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 16 -> - field_pull_request_author_username := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 17 -> - field_pull_request_author_image_url := ( - Some ( - ( - read__uri_nullable - ) p lb - ) - ); - | 18 -> - field_pull_request_id := ( - Some ( - ( - read__string_nullable - ) p lb - ) - ); - | 19 -> - field_pull_request_title := ( - Some ( + field_triage_ignored_syntactic_ids := ( ( - read__string_nullable + read__string_list ) p lb - ) - ); - | 20 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_base_sha := ( - Some ( - ( - read_sha1 - ) p lb - ) ); ) - | 21 -> + | 2 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_start_sha := ( - Some ( - ( - read_sha1 - ) p lb - ) - ); - ) - | 22 -> - field_is_full_scan := ( - Some ( + field_triage_ignored_match_based_ids := ( ( - Atdgen_runtime.Oj_run.read_bool + read__string_list ) p lb - ) - ); - | 23 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_sca_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 24 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_code_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 25 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_secrets_scan := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) ); ) | _ -> ( @@ -22177,111 +21809,2551 @@ 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 ( - 15 + | 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 ) ) - | 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 ( - 6 - ) - 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 ( - 7 - ) - 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 ( - 4 - ) - 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 ( - 3 + | 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 - | '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 ( - 20 - ) - 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 ( - 2 - ) - 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 ( - 21 + | 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 ) ) - | 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 ( - 14 - ) - 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 ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -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 ( - 23 - ) - 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_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 + ) + ); + 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 + ) + 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 ( + 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_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 ( + ( + 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 + | 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 + ) + ) + | 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 + ) + 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_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 ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + 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; + } + : historical_configuration) + ) +) +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__product_ignored_files_option ?(len = 1024) x = + let ob = Buffer.create len in + write__product_ignored_files_option ob x; + Buffer.contents ob +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 _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 string_of__historical_configuration_option ?(len = 1024) x = + let ob = Buffer.create len in + write__historical_configuration_option ob x; + Buffer.contents ob +let read__historical_configuration_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_historical_configuration + ) 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_historical_configuration + ) 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 _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 "\"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 "\"scan_all_deps_in_diff_scan\":"; + ( + Yojson.Safe.write_bool + ) + ob x.scan_all_deps_in_diff_scan; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"symbol_analysis\":"; + ( + Yojson.Safe.write_bool + ) + ob x.symbol_analysis; + 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\":"; + ( + 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_engine_configuration ?(len = 1024) x = + let ob = Buffer.create len in + write_engine_configuration ob x; + Buffer.contents ob +let read_engine_configuration = ( + 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_scan_all_deps_in_diff_scan = ref (false) in + let field_symbol_analysis = 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; + 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 = '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 ( + 6 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 's' then ( + 5 + ) + 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 ( + 9 + ) + 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 ( + 8 + ) + 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 ( + 7 + ) + 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 ( + 10 + ) + else ( + -1 + ) + ) + | 26 -> ( + 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) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && 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) = 'f' && String.unsafe_get s (pos+20) = 'f' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 's' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'n' then ( + 4 + ) + 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_scan_all_deps_in_diff_scan := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_symbol_analysis := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list + ) p lb + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_product_ignored_files := ( + Some ( + ( + read_product_ignored_files + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_generic_slow_rollout := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_config := ( + Some ( + ( + read_historical_configuration + ) p lb + ) + ); + ) + | 10 -> + 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 + ) + ); + 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 = '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 ( + 6 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'y' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 's' then ( + 5 + ) + 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 ( + 9 + ) + 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 ( + 8 + ) + 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 ( + 7 + ) + 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 ( + 10 + ) + else ( + -1 + ) + ) + | 26 -> ( + 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) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && 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) = 'f' && String.unsafe_get s (pos+20) = 'f' && String.unsafe_get s (pos+21) = '_' && String.unsafe_get s (pos+22) = 's' && String.unsafe_get s (pos+23) = 'c' && String.unsafe_get s (pos+24) = 'a' && String.unsafe_get s (pos+25) = 'n' then ( + 4 + ) + 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_scan_all_deps_in_diff_scan := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_symbol_analysis := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_ignored_files := ( + ( + read__string_list + ) p lb + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_product_ignored_files := ( + Some ( + ( + read_product_ignored_files + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_generic_slow_rollout := ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_config := ( + Some ( + ( + read_historical_configuration + ) p lb + ) + ); + ) + | 10 -> + 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 + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + autofix = !field_autofix; + deepsemgrep = !field_deepsemgrep; + dependency_query = !field_dependency_query; + path_to_transitivity = !field_path_to_transitivity; + scan_all_deps_in_diff_scan = !field_scan_all_deps_in_diff_scan; + symbol_analysis = !field_symbol_analysis; + 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; + } + : engine_configuration) + ) +) +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 "\"info\":"; + ( + write_scan_info + ) + ob x.info; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"config\":"; + ( + write_scan_configuration + ) + 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_response ?(len = 1024) x = + let ob = Buffer.create len in + write_scan_response ob x; + Buffer.contents ob +let read_scan_response = ( + 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 + 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 + | 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 + ) + 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 ( + 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 + ) + 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_info := ( + Some ( + ( + read_scan_info + ) p lb + ) + ); + | 1 -> + field_config := ( + Some ( + ( + read_scan_configuration + ) p lb + ) + ); + | 2 -> + field_engine_params := ( + Some ( + ( + read_engine_configuration + ) 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 + | 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 + ) + 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 ( + 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 + ) + 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_info := ( + Some ( + ( + read_scan_info + ) p lb + ) + ); + | 1 -> + field_config := ( + Some ( + ( + read_scan_configuration + ) p lb + ) + ); + | 2 -> + field_engine_params := ( + Some ( + ( + read_engine_configuration + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + 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"); + } + : scan_response) + ) +) +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; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"requested_products\":"; + ( + write__product_list + ) + ob x.requested_products; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dry_run\":"; + ( + Yojson.Safe.write_bool + ) + 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_scan_metadata ?(len = 1024) x = + let ob = Buffer.create len in + write_scan_metadata ob x; + Buffer.contents ob +let read_scan_metadata = ( + 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 + 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 = '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 + ) + ) + | 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 + ) + ) + | 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 + ) + 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_cli_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + | 1 -> + field_unique_id := ( + Some ( + ( + read_uuid + ) 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 := ( + 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 = '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 + ) + ) + | 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 + ) + ) + | 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 + ) + 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_cli_version := ( + Some ( + ( + read_version + ) p lb + ) + ); + | 1 -> + field_unique_id := ( + Some ( + ( + read_uuid + ) 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 := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + 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; + } + : scan_metadata) + ) +) +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 string_of__datetime_option ?(len = 1024) x = + let ob = Buffer.create len in + write__datetime_option ob x; + Buffer.contents ob +let read__datetime_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_datetime + ) 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_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_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 "\"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\":"; + ( + 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_project_metadata ?(len = 1024) x = + let ob = Buffer.create len in + write_project_metadata ob x; + Buffer.contents ob +let read_project_metadata = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + 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; + 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) = 'n' then ( + 15 + ) + 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 ( + 6 + ) + 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 ( + 7 + ) + 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 ( + 4 + ) + 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 ( + 3 + ) + 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 ( + 20 + ) + 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 ( + 2 + ) + 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 ( + 21 + ) + 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 ( + 14 + ) + 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 ( + 1 + ) + 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 ( + 23 + ) + 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 ( + 8 + ) + 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 ( + 24 + ) + 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 ( + 22 + ) + 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 ( + 25 + ) + 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 ( + 18 + ) + 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 ( + 9 + ) + 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 ( + 0 + ) + 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 ( + 5 + ) + 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 ( + 11 + ) + 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 ( + 19 + ) + 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 ( + 10 + ) + 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 ( + 12 + ) + 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 ( + 13 + ) + 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 ( + 16 + ) + 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 ( + 17 + ) + 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_scan_environment := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 1 -> + field_repository := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 2 -> + field_repo_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_repo_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_org_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_repo_display_name := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 6 -> + field_branch := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 7 -> + field_commit := ( + Some ( + ( + read__sha1_nullable + ) p lb + ) + ); + | 8 -> + field_commit_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_commit_timestamp := ( + Some ( + ( + read_datetime + ) p lb + ) + ); + ) + | 10 -> + field_commit_author_email := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 11 -> + field_commit_author_name := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 12 -> + field_commit_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 13 -> + field_commit_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 14 -> + field_ci_job_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 15 -> + field_on := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + | 16 -> + field_pull_request_author_username := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 17 -> + field_pull_request_author_image_url := ( + Some ( + ( + read__uri_nullable + ) p lb + ) + ); + | 18 -> + field_pull_request_id := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 19 -> + field_pull_request_title := ( + Some ( + ( + read__string_nullable + ) p lb + ) + ); + | 20 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_base_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 21 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_start_sha := ( + Some ( + ( + read_sha1 + ) p lb + ) + ); + ) + | 22 -> + field_is_full_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 23 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_sca_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 24 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_code_scan := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 25 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_secrets_scan := ( + 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); + match len with + | 2 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'n' then ( + 15 + ) + 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 ( + 6 + ) + 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 ( + 7 + ) + 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 ( + 4 + ) + 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 ( + 3 + ) + 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 ( + 20 + ) + 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 ( + 2 + ) + 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 ( + 21 + ) + 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 ( + 14 + ) + 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 ( + 1 + ) + 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 ( + 23 + ) + else ( + -1 + ) ) | 12 -> ( match String.unsafe_get s pos with @@ -27170,63 +29242,6 @@ let read__finding_hashes_option = ( ) let _finding_hashes_option_of_string s = read__finding_hashes_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__engine_of_finding_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_engine_of_finding - ) -) -let string_of__engine_of_finding_option ?(len = 1024) x = - let ob = Buffer.create len in - write__engine_of_finding_option ob x; - Buffer.contents ob -let read__engine_of_finding_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_engine_of_finding - ) 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_engine_of_finding - ) 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 _engine_of_finding_option_of_string s = - read__engine_of_finding_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_finding : _ -> finding -> _ = ( fun ob (x : finding) -> Buffer.add_char ob '{'; @@ -29088,226 +31103,17 @@ let read_contributor = ( 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 - | 18 -> ( - 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) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( - 0 - ) - else ( - -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 ( - 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_commit_author_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 1 -> - field_commit_author_email := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - 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_email = (match !field_commit_author_email with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_email"); - } - : contributor) - ) -) -let contributor_of_string s = - read_contributor (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_contribution : _ -> contribution -> _ = ( - fun ob (x : contribution) -> - 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 "\"commit_hash\":"; - ( - Yojson.Safe.write_string - ) - ob x.commit_hash; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"commit_timestamp\":"; - ( - write_datetime - ) - ob x.commit_timestamp; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"contributor\":"; - ( - write_contributor - ) - ob x.contributor; - Buffer.add_char ob '}'; -) -let string_of_contribution ?(len = 1024) x = - let ob = Buffer.create len in - write_contribution ob x; - Buffer.contents ob -let read_contribution = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_commit_hash = ref (None) in - let field_commit_timestamp = ref (None) in - let field_contributor = 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 - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' then ( - match String.unsafe_get s (pos+2) with - | 'm' -> ( - if 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) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( - 0 - ) - else ( - -1 - ) - ) - | 'n' -> ( - if String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'r' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 16 -> ( - 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) = '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 ( - 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_commit_hash := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 1 -> - field_commit_timestamp := ( - Some ( - ( - read_datetime - ) p lb - ) - ); - | 2 -> - field_contributor := ( - Some ( - ( - read_contributor - ) 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 - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' then ( - match String.unsafe_get s (pos+2) with - | 'm' -> ( - if 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) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( - 0 - ) - else ( - -1 - ) - ) - | 'n' -> ( - if String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'r' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + match len with + | 18 -> ( + 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) = 'n' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 'm' && String.unsafe_get s (pos+17) = 'e' then ( + 0 ) else ( -1 ) ) - | 16 -> ( - 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) = '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 ( + | 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 ( 1 ) else ( @@ -29323,7 +31129,7 @@ let read_contribution = ( ( match i with | 0 -> - field_commit_hash := ( + field_commit_author_name := ( Some ( ( Atdgen_runtime.Oj_run.read_string @@ -29331,18 +31137,10 @@ let read_contribution = ( ) ); | 1 -> - field_commit_timestamp := ( - Some ( - ( - read_datetime - ) p lb - ) - ); - | 2 -> - field_contributor := ( + field_commit_author_email := ( Some ( ( - read_contributor + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -29355,244 +31153,58 @@ let read_contribution = ( with Yojson.End_of_object -> ( ( { - commit_hash = (match !field_commit_hash with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_hash"); - commit_timestamp = (match !field_commit_timestamp with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_timestamp"); - contributor = (match !field_contributor with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "contributor"); + 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_email = (match !field_commit_author_email with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_author_email"); } - : contribution) + : contributor) ) ) -let contribution_of_string s = - read_contribution (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__contribution_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_contribution - ) -) -let string_of__contribution_list ?(len = 1024) x = - let ob = Buffer.create len in - write__contribution_list ob x; - Buffer.contents ob -let read__contribution_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_contribution - ) -) -let _contribution_list_of_string s = - read__contribution_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_contributions = ( - write__contribution_list -) -let string_of_contributions ?(len = 1024) x = - let ob = Buffer.create len in - write_contributions ob x; - Buffer.contents ob -let read_contributions = ( - read__contribution_list -) -let contributions_of_string s = - read_contributions (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__error_span_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_error_span - ) -) -let string_of__error_span_list ?(len = 1024) x = - let ob = Buffer.create len in - write__error_span_list ob x; - Buffer.contents ob -let read__error_span_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_error_span - ) -) -let _error_span_list_of_string s = - read__error_span_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__error_span_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__error_span_list - ) -) -let string_of__error_span_list_option ?(len = 1024) x = - let ob = Buffer.create len in - write__error_span_list_option ob x; - Buffer.contents ob -let read__error_span_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__error_span_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__error_span_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 _error_span_list_option_of_string s = - read__error_span_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_error : _ -> cli_error -> _ = ( - fun ob (x : cli_error) -> +let contributor_of_string s = + read_contributor (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_contribution : _ -> contribution -> _ = ( + fun ob (x : contribution) -> 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 "\"code\":"; + Buffer.add_string ob "\"commit_hash\":"; ( - Yojson.Safe.write_int + Yojson.Safe.write_string ) - ob x.code; + ob x.commit_hash; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"level\":"; + Buffer.add_string ob "\"commit_timestamp\":"; ( - write_error_severity + write_datetime ) - ob x.level; + ob x.commit_timestamp; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"type\":"; + Buffer.add_string ob "\"contributor\":"; ( - write_error_type + write_contributor ) - ob x.type_; - (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; - ); - (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.path with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x; - ); - (match x.long_msg with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"long_msg\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.short_msg with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"short_msg\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.spans with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"spans\":"; - ( - write__error_span_list - ) - ob x; - ); - (match x.help with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"help\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); + ob x.contributor; Buffer.add_char ob '}'; ) -let string_of_cli_error ?(len = 1024) x = +let string_of_contribution ?(len = 1024) x = let ob = Buffer.create len in - write_cli_error ob x; + write_contribution ob x; Buffer.contents ob -let read_cli_error = ( +let read_contribution = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_code = ref (None) in - let field_level = ref (None) in - let field_type_ = ref (None) in - let field_rule_id = ref (None) in - let field_message = ref (None) in - let field_path = ref (None) in - let field_long_msg = ref (None) in - let field_short_msg = ref (None) in - let field_spans = ref (None) in - let field_help = ref (None) in + let field_commit_hash = ref (None) in + let field_commit_timestamp = ref (None) in + let field_contributor = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -29602,99 +31214,36 @@ let read_cli_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 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'h' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( - 9 - ) - 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' then ( - 5 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 5 -> ( - match String.unsafe_get s pos with - | 'l' -> ( - 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) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if 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 ( - 4 - ) - else ( - -1 + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' then ( + match String.unsafe_get s (pos+2) with + | 'm' -> ( + if 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) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( + 0 + ) + 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 + | 'n' -> ( + if String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'r' then ( + 2 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( - 6 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && 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) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( - 7 + | 16 -> ( + 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) = '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 ( + 1 ) else ( -1 @@ -29709,99 +31258,29 @@ let read_cli_error = ( ( match i with | 0 -> - field_code := ( + field_commit_hash := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_level := ( + field_commit_timestamp := ( Some ( ( - read_error_severity + read_datetime ) p lb ) ); | 2 -> - field_type_ := ( + field_contributor := ( Some ( ( - read_error_type + read_contributor ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_long_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_short_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_spans := ( - Some ( - ( - read__error_span_list - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_help := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -29815,99 +31294,36 @@ let read_cli_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 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'h' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( - 9 - ) - 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' then ( - 5 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 5 -> ( - match String.unsafe_get s pos with - | 'l' -> ( - 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) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if 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 ( - 4 - ) - else ( - -1 + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' then ( + match String.unsafe_get s (pos+2) with + | 'm' -> ( + if 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) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( + 0 + ) + 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 + | 'n' -> ( + if String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'r' then ( + 2 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( - 6 ) else ( -1 ) ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && 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) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( - 7 + | 16 -> ( + 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) = '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 ( + 1 ) else ( -1 @@ -29922,99 +31338,29 @@ let read_cli_error = ( ( match i with | 0 -> - field_code := ( + field_commit_hash := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_level := ( + field_commit_timestamp := ( Some ( ( - read_error_severity + read_datetime ) p lb ) ); | 2 -> - field_type_ := ( + field_contributor := ( Some ( ( - read_error_type + read_contributor ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_long_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_short_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_spans := ( - Some ( - ( - read__error_span_list - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_help := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -30024,153 +31370,69 @@ let read_cli_error = ( with Yojson.End_of_object -> ( ( { - code = (match !field_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "code"); - level = (match !field_level with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "level"); - type_ = (match !field_type_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "type_"); - rule_id = !field_rule_id; - message = !field_message; - path = !field_path; - long_msg = !field_long_msg; - short_msg = !field_short_msg; - spans = !field_spans; - help = !field_help; + commit_hash = (match !field_commit_hash with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_hash"); + commit_timestamp = (match !field_commit_timestamp with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "commit_timestamp"); + contributor = (match !field_contributor with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "contributor"); } - : cli_error) + : contribution) ) ) -let cli_error_of_string s = - read_cli_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__found_dependency_list = ( +let contribution_of_string s = + read_contribution (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__contribution_list = ( Atdgen_runtime.Oj_run.write_list ( - write_found_dependency + write_contribution ) ) -let string_of__found_dependency_list ?(len = 1024) x = +let string_of__contribution_list ?(len = 1024) x = let ob = Buffer.create len in - write__found_dependency_list ob x; + write__contribution_list ob x; Buffer.contents ob -let read__found_dependency_list = ( +let read__contribution_list = ( Atdgen_runtime.Oj_run.read_list ( - read_found_dependency - ) -) -let _found_dependency_list_of_string s = - read__found_dependency_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_a534bf0 = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - write__found_dependency_list - ) -) -let string_of__x_a534bf0 ?(len = 1024) x = - let ob = Buffer.create len in - write__x_a534bf0 ob x; - Buffer.contents ob -let read__x_a534bf0 = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - read__found_dependency_list + read_contribution ) ) -let _x_a534bf0_of_string s = - read__x_a534bf0 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_scan_dependencies = ( - write__x_a534bf0 +let _contribution_list_of_string s = + read__contribution_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_contributions = ( + write__contribution_list ) -let string_of_ci_scan_dependencies ?(len = 1024) x = +let string_of_contributions ?(len = 1024) x = let ob = Buffer.create len in - write_ci_scan_dependencies ob x; + write_contributions ob x; Buffer.contents ob -let read_ci_scan_dependencies = ( - read__x_a534bf0 +let read_contributions = ( + read__contribution_list ) -let ci_scan_dependencies_of_string s = - read_ci_scan_dependencies (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__finding_list = ( +let contributions_of_string s = + read_contributions (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__error_span_list = ( Atdgen_runtime.Oj_run.write_list ( - write_finding + write_error_span ) ) -let string_of__finding_list ?(len = 1024) x = +let string_of__error_span_list ?(len = 1024) x = let ob = Buffer.create len in - write__finding_list ob x; + write__error_span_list ob x; Buffer.contents ob -let read__finding_list = ( +let read__error_span_list = ( Atdgen_runtime.Oj_run.read_list ( - read_finding - ) -) -let _finding_list_of_string s = - read__finding_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__contributions_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_contributions + read_error_span ) ) -let string_of__contributions_option ?(len = 1024) x = - let ob = Buffer.create len in - write__contributions_option ob x; - Buffer.contents ob -let read__contributions_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_contributions - ) 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_contributions - ) 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 _contributions_option_of_string s = - read__contributions_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ci_scan_dependencies_option = ( +let _error_span_list_of_string s = + read__error_span_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__error_span_list_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_ci_scan_dependencies + write__error_span_list ) ) -let string_of__ci_scan_dependencies_option ?(len = 1024) x = +let string_of__error_span_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__ci_scan_dependencies_option ob x; + write__error_span_list_option ob x; Buffer.contents ob -let read__ci_scan_dependencies_option = ( +let read__error_span_list_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -30183,7 +31445,7 @@ let read__ci_scan_dependencies_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_ci_scan_dependencies + read__error_span_list ) p lb in Yojson.Safe.read_space p lb; @@ -30206,7 +31468,7 @@ let read__ci_scan_dependencies_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_ci_scan_dependencies + read__error_span_list ) p lb in Yojson.Safe.read_space p lb; @@ -30216,106 +31478,136 @@ let read__ci_scan_dependencies_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _ci_scan_dependencies_option_of_string s = - read__ci_scan_dependencies_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_scan_results : _ -> ci_scan_results -> _ = ( - fun ob (x : ci_scan_results) -> +let _error_span_list_option_of_string s = + read__error_span_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_error : _ -> cli_error -> _ = ( + fun ob (x : cli_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 "\"findings\":"; - ( - write__finding_list - ) - ob x.findings; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ignores\":"; - ( - write__finding_list - ) - ob x.ignores; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"token\":"; - ( - write__string_nullable - ) - ob x.token; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"searched_paths\":"; + Buffer.add_string ob "\"code\":"; ( - write__fpath_list + Yojson.Safe.write_int ) - ob x.searched_paths; + ob x.code; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"renamed_paths\":"; + Buffer.add_string ob "\"level\":"; ( - write__fpath_list + write_error_severity ) - ob x.renamed_paths; + ob x.level; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_ids\":"; + Buffer.add_string ob "\"type\":"; ( - write__rule_id_list + write_error_type ) - ob x.rule_ids; - (match x.contributions with None -> () | Some x -> + ob x.type_; + (match x.rule_id with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"contributions\":"; + Buffer.add_string ob "\"rule_id\":"; ( - write_contributions + write_rule_id ) ob x; ); - (match x.dependencies with None -> () | Some x -> + (match x.message with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dependencies\":"; + Buffer.add_string ob "\"message\":"; ( - write_ci_scan_dependencies + Yojson.Safe.write_string + ) + ob x; + ); + (match x.path with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path\":"; + ( + write_fpath + ) + ob x; + ); + (match x.long_msg with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"long_msg\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.short_msg with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"short_msg\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.spans with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"spans\":"; + ( + write__error_span_list + ) + ob x; + ); + (match x.help with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"help\":"; + ( + Yojson.Safe.write_string ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_ci_scan_results ?(len = 1024) x = +let string_of_cli_error ?(len = 1024) x = let ob = Buffer.create len in - write_ci_scan_results ob x; + write_cli_error ob x; Buffer.contents ob -let read_ci_scan_results = ( +let read_cli_error = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_findings = ref (None) in - let field_ignores = ref (None) in - let field_token = ref (None) in - let field_searched_paths = ref (None) in - let field_renamed_paths = ref (None) in - let field_rule_ids = ref (None) in - let field_contributions = ref (None) in - let field_dependencies = ref (None) in + let field_code = ref (None) in + let field_level = ref (None) in + let field_type_ = ref (None) in + let field_rule_id = ref (None) in + let field_message = ref (None) in + let field_path = ref (None) in + let field_long_msg = ref (None) in + let field_short_msg = ref (None) in + let field_spans = ref (None) in + let field_help = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -30325,65 +31617,79 @@ let read_ci_scan_results = ( 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 = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'k' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | 7 -> ( - 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) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( + | 4 -> ( match String.unsafe_get s pos with - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) 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' && String.unsafe_get s (pos+7) = 's' then ( + | 'h' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( + 9 + ) + 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' then ( 5 ) else ( -1 ) ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( + 2 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) ) - | 12 -> ( - 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 7 - ) - else ( - -1 - ) + | 5 -> ( + match String.unsafe_get s pos with + | 'l' -> ( + 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) = 'l' then ( + 1 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 13 -> ( + | 7 -> ( match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' then ( - 6 + | 'm' -> ( + if 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 ( + 4 ) else ( -1 ) ) | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'm' && 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) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 's' then ( - 4 + 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 @@ -30393,9 +31699,17 @@ let read_ci_scan_results = ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' && 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) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' && String.unsafe_get s (pos+13) = 's' then ( - 3 + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( + 6 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && 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) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( + 7 ) else ( -1 @@ -30410,69 +31724,95 @@ let read_ci_scan_results = ( ( match i with | 0 -> - field_findings := ( + field_code := ( Some ( ( - read__finding_list + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_ignores := ( + field_level := ( Some ( ( - read__finding_list + read_error_severity ) p lb ) ); | 2 -> - field_token := ( + field_type_ := ( Some ( ( - read__string_nullable + read_error_type ) p lb ) ); | 3 -> - field_searched_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + ) | 4 -> - field_renamed_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | 5 -> - field_rule_ids := ( - Some ( - ( - read__rule_id_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_contributions := ( + field_long_msg := ( Some ( ( - read_contributions + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependencies := ( + field_short_msg := ( Some ( ( - read_ci_scan_dependencies + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_spans := ( + Some ( + ( + read__error_span_list + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_help := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -30490,65 +31830,79 @@ let read_ci_scan_results = ( 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 = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'k' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | 7 -> ( - 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) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( + | 4 -> ( match String.unsafe_get s pos with - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( 0 ) 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' && String.unsafe_get s (pos+7) = 's' then ( + | 'h' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( + 9 + ) + 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' then ( 5 ) else ( -1 ) ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( + 2 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) ) - | 12 -> ( - 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 7 - ) - else ( - -1 - ) + | 5 -> ( + match String.unsafe_get s pos with + | 'l' -> ( + 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) = 'l' then ( + 1 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 13 -> ( + | 7 -> ( match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' then ( - 6 + | 'm' -> ( + if 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 ( + 4 ) else ( -1 ) ) | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'm' && 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) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 's' then ( - 4 + 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 @@ -30558,9 +31912,17 @@ let read_ci_scan_results = ( -1 ) ) - | 14 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' && 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) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' && String.unsafe_get s (pos+13) = 's' then ( - 3 + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( + 6 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && 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) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( + 7 ) else ( -1 @@ -30575,69 +31937,95 @@ let read_ci_scan_results = ( ( match i with | 0 -> - field_findings := ( + field_code := ( Some ( ( - read__finding_list + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_ignores := ( + field_level := ( Some ( ( - read__finding_list + read_error_severity ) p lb ) ); | 2 -> - field_token := ( + field_type_ := ( Some ( ( - read__string_nullable + read_error_type ) p lb ) ); | 3 -> - field_searched_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + ) | 4 -> - field_renamed_paths := ( - Some ( - ( - read__fpath_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | 5 -> - field_rule_ids := ( - Some ( - ( - read__rule_id_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + ) | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_contributions := ( + field_long_msg := ( Some ( ( - read_contributions + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependencies := ( + field_short_msg := ( Some ( ( - read_ci_scan_dependencies + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_spans := ( + Some ( + ( + read__error_span_list + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_help := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -30651,223 +32039,96 @@ let read_ci_scan_results = ( with Yojson.End_of_object -> ( ( { - findings = (match !field_findings with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "findings"); - ignores = (match !field_ignores with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ignores"); - token = (match !field_token with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "token"); - searched_paths = (match !field_searched_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "searched_paths"); - renamed_paths = (match !field_renamed_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "renamed_paths"); - rule_ids = (match !field_rule_ids with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_ids"); - contributions = !field_contributions; - dependencies = !field_dependencies; + code = (match !field_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "code"); + level = (match !field_level with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "level"); + type_ = (match !field_type_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "type_"); + rule_id = !field_rule_id; + message = !field_message; + path = !field_path; + long_msg = !field_long_msg; + short_msg = !field_short_msg; + spans = !field_spans; + help = !field_help; } - : ci_scan_results) + : cli_error) ) ) -let ci_scan_results_of_string s = - read_ci_scan_results (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_scan_failure : _ -> ci_scan_failure -> _ = ( - fun ob (x : ci_scan_failure) -> - 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 "\"exit_code\":"; - ( - Yojson.Safe.write_int - ) - ob x.exit_code; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"stderr\":"; - ( - Yojson.Safe.write_string - ) - ob x.stderr; - Buffer.add_char ob '}'; +let cli_error_of_string s = + read_cli_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__found_dependency_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_found_dependency + ) ) -let string_of_ci_scan_failure ?(len = 1024) x = +let string_of__found_dependency_list ?(len = 1024) x = let ob = Buffer.create len in - write_ci_scan_failure ob x; + write__found_dependency_list ob x; Buffer.contents ob -let read_ci_scan_failure = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_exit_code = ref (None) in - let field_stderr = 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 - | 6 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'r' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' 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_exit_code := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_stderr := ( - 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 - | 6 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'r' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' 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_exit_code := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 1 -> - field_stderr := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - exit_code = (match !field_exit_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exit_code"); - stderr = (match !field_stderr with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "stderr"); - } - : ci_scan_failure) - ) +let read__found_dependency_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_found_dependency + ) ) -let ci_scan_failure_of_string s = - read_ci_scan_failure (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_a95369c = ( +let _found_dependency_list_of_string s = + read__found_dependency_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_a534bf0 = ( Atdgen_runtime.Oj_run.write_assoc_list ( Yojson.Safe.write_string ) ( - write_parsing_stats + write__found_dependency_list ) ) -let string_of__x_a95369c ?(len = 1024) x = +let string_of__x_a534bf0 ?(len = 1024) x = let ob = Buffer.create len in - write__x_a95369c ob x; + write__x_a534bf0 ob x; Buffer.contents ob -let read__x_a95369c = ( +let read__x_a534bf0 = ( Atdgen_runtime.Oj_run.read_assoc_list ( Atdgen_runtime.Oj_run.read_string ) ( - read_parsing_stats + read__found_dependency_list ) ) -let _x_a95369c_of_string s = - read__x_a95369c (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_852c7ec = ( - Atdgen_runtime.Oj_run.write_assoc_list ( - Yojson.Safe.write_string - ) ( - Yojson.Safe.write_int +let _x_a534bf0_of_string s = + read__x_a534bf0 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_scan_dependencies = ( + write__x_a534bf0 +) +let string_of_ci_scan_dependencies ?(len = 1024) x = + let ob = Buffer.create len in + write_ci_scan_dependencies ob x; + Buffer.contents ob +let read_ci_scan_dependencies = ( + read__x_a534bf0 +) +let ci_scan_dependencies_of_string s = + read_ci_scan_dependencies (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__finding_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_finding ) ) -let string_of__x_852c7ec ?(len = 1024) x = +let string_of__finding_list ?(len = 1024) x = let ob = Buffer.create len in - write__x_852c7ec ob x; + write__finding_list ob x; Buffer.contents ob -let read__x_852c7ec = ( - Atdgen_runtime.Oj_run.read_assoc_list ( - Atdgen_runtime.Oj_run.read_string - ) ( - Atdgen_runtime.Oj_run.read_int +let read__finding_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_finding ) ) -let _x_852c7ec_of_string s = - read__x_852c7ec (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_122e274 = ( +let _finding_list_of_string s = + read__finding_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__contributions_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write__x_852c7ec + write_contributions ) ) -let string_of__x_122e274 ?(len = 1024) x = +let string_of__contributions_option ?(len = 1024) x = let ob = Buffer.create len in - write__x_122e274 ob x; + write__contributions_option ob x; Buffer.contents ob -let read__x_122e274 = ( +let read__contributions_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -30880,7 +32141,7 @@ let read__x_122e274 = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__x_852c7ec + read_contributions ) p lb in Yojson.Safe.read_space p lb; @@ -30903,7 +32164,7 @@ let read__x_122e274 = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__x_852c7ec + read_contributions ) p lb in Yojson.Safe.read_space p lb; @@ -30913,18 +32174,18 @@ let read__x_122e274 = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _x_122e274_of_string s = - read__x_122e274 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__supply_chain_stats_option = ( +let _contributions_option_of_string s = + read__contributions_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__ci_scan_dependencies_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_supply_chain_stats + write_ci_scan_dependencies ) ) -let string_of__supply_chain_stats_option ?(len = 1024) x = +let string_of__ci_scan_dependencies_option ?(len = 1024) x = let ob = Buffer.create len in - write__supply_chain_stats_option ob x; + write__ci_scan_dependencies_option ob x; Buffer.contents ob -let read__supply_chain_stats_option = ( +let read__ci_scan_dependencies_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -30937,7 +32198,7 @@ let read__supply_chain_stats_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_supply_chain_stats + read_ci_scan_dependencies ) p lb in Yojson.Safe.read_space p lb; @@ -30960,7 +32221,7 @@ let read__supply_chain_stats_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_supply_chain_stats + read_ci_scan_dependencies ) p lb in Yojson.Safe.read_space p lb; @@ -30970,26 +32231,10 @@ let read__supply_chain_stats_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _supply_chain_stats_option_of_string s = - read__supply_chain_stats_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__cli_error_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_cli_error - ) -) -let string_of__cli_error_list ?(len = 1024) x = - let ob = Buffer.create len in - write__cli_error_list ob x; - Buffer.contents ob -let read__cli_error_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_cli_error - ) -) -let _cli_error_list_of_string s = - read__cli_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_scan_complete_stats : _ -> ci_scan_complete_stats -> _ = ( - fun ob (x : ci_scan_complete_stats) -> +let _ci_scan_dependencies_option_of_string s = + read__ci_scan_dependencies_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_scan_results : _ -> ci_scan_results -> _ = ( + fun ob (x : ci_scan_results) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then @@ -30998,106 +32243,94 @@ let write_ci_scan_complete_stats : _ -> ci_scan_complete_stats -> _ = ( Buffer.add_char ob ','; Buffer.add_string ob "\"findings\":"; ( - Yojson.Safe.write_int + write__finding_list ) ob x.findings; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"errors\":"; + Buffer.add_string ob "\"ignores\":"; ( - write__cli_error_list + write__finding_list ) - ob x.errors; + ob x.ignores; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"total_time\":"; + Buffer.add_string ob "\"token\":"; ( - Yojson.Safe.write_std_float + write__string_nullable ) - ob x.total_time; + ob x.token; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"unsupported_exts\":"; + Buffer.add_string ob "\"searched_paths\":"; ( - write__x_852c7ec + write__fpath_list ) - ob x.unsupported_exts; + ob x.searched_paths; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"lockfile_scan_info\":"; + Buffer.add_string ob "\"renamed_paths\":"; ( - write__x_852c7ec + write__fpath_list ) - ob x.lockfile_scan_info; + ob x.renamed_paths; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"parse_rate\":"; + Buffer.add_string ob "\"rule_ids\":"; ( - write__x_a95369c + write__rule_id_list ) - ob x.parse_rate; - (match x.engine_requested with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_requested\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.findings_by_product with None -> () | Some x -> + ob x.rule_ids; + (match x.contributions with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"findings_by_product\":"; + Buffer.add_string ob "\"contributions\":"; ( - write__x_852c7ec + write_contributions ) ob x; ); - (match x.supply_chain_stats with None -> () | Some x -> + (match x.dependencies with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"supply_chain_stats\":"; + Buffer.add_string ob "\"dependencies\":"; ( - write_supply_chain_stats + write_ci_scan_dependencies ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_ci_scan_complete_stats ?(len = 1024) x = +let string_of_ci_scan_results ?(len = 1024) x = let ob = Buffer.create len in - write_ci_scan_complete_stats ob x; + write_ci_scan_results ob x; Buffer.contents ob -let read_ci_scan_complete_stats = ( +let read_ci_scan_results = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; let field_findings = ref (None) in - let field_errors = ref (None) in - let field_total_time = ref (None) in - let field_unsupported_exts = ref (None) in - let field_lockfile_scan_info = ref (None) in - let field_parse_rate = ref (None) in - let field_engine_requested = ref (None) in - let field_findings_by_product = ref (None) in - let field_supply_chain_stats = ref (None) in + let field_ignores = ref (None) in + let field_token = ref (None) in + let field_searched_paths = ref (None) in + let field_renamed_paths = ref (None) in + let field_rule_ids = ref (None) in + let field_contributions = ref (None) in + let field_dependencies = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -31107,35 +32340,35 @@ let read_ci_scan_complete_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 - | 6 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 1 + | 5 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'k' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' then ( + 2 ) else ( -1 ) ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( - 0 + | 7 -> ( + 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) = 's' then ( + 1 ) else ( -1 ) ) - | 10 -> ( + | 8 -> ( match String.unsafe_get s pos with - | '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) = 'r' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' then ( - 5 + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + 0 ) else ( -1 ) ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && 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' then ( - 2 + | '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' && String.unsafe_get s (pos+7) = 's' then ( + 5 ) else ( -1 @@ -31145,53 +32378,39 @@ let read_ci_scan_complete_stats = ( -1 ) ) - | 16 -> ( + | 12 -> ( + 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( + 7 + ) + else ( + -1 + ) + ) + | 13 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if 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) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'q' && String.unsafe_get s (pos+10) = 'u' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' then ( + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' then ( 6 ) else ( -1 ) ) - | 'u' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'x' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 18 -> ( - 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) = 's' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'o' then ( + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'm' && 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) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 's' then ( 4 ) else ( -1 ) ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( - 8 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) ) - | 19 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'y' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( - 7 + | 14 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' && 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) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' && String.unsafe_get s (pos+13) = 's' then ( + 3 ) else ( -1 @@ -31209,76 +32428,66 @@ let read_ci_scan_complete_stats = ( field_findings := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__finding_list ) p lb ) ); | 1 -> - field_errors := ( + field_ignores := ( Some ( ( - read__cli_error_list + read__finding_list ) p lb ) ); | 2 -> - field_total_time := ( + field_token := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read__string_nullable ) p lb ) ); | 3 -> - field_unsupported_exts := ( + field_searched_paths := ( Some ( ( - read__x_852c7ec + read__fpath_list ) p lb ) ); | 4 -> - field_lockfile_scan_info := ( + field_renamed_paths := ( Some ( ( - read__x_852c7ec + read__fpath_list ) p lb ) ); | 5 -> - field_parse_rate := ( + field_rule_ids := ( Some ( ( - read__x_a95369c + read__rule_id_list ) p lb ) ); | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_requested := ( + field_contributions := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_contributions ) p lb ) ); ) | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_findings_by_product := ( - Some ( - ( - read__x_852c7ec - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_supply_chain_stats := ( + field_dependencies := ( Some ( ( - read_supply_chain_stats + read_ci_scan_dependencies ) p lb ) ); @@ -31296,35 +32505,35 @@ let read_ci_scan_complete_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 - | 6 -> ( - if String.unsafe_get s pos = 'e' && 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 ( - 1 + | 5 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'k' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' then ( + 2 ) else ( -1 ) ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( - 0 + | 7 -> ( + 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) = 's' then ( + 1 ) else ( -1 ) ) - | 10 -> ( + | 8 -> ( match String.unsafe_get s pos with - | '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) = 'r' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' then ( - 5 + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + 0 ) else ( -1 ) ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && 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' then ( - 2 + | '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' && String.unsafe_get s (pos+7) = 's' then ( + 5 ) else ( -1 @@ -31334,53 +32543,39 @@ let read_ci_scan_complete_stats = ( -1 ) ) - | 16 -> ( + | 12 -> ( + 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( + 7 + ) + else ( + -1 + ) + ) + | 13 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if 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) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'q' && String.unsafe_get s (pos+10) = 'u' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' then ( + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'b' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 's' then ( 6 ) else ( -1 ) ) - | 'u' -> ( - if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'x' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 18 -> ( - 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) = 's' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'o' then ( + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'm' && 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) = 'a' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = 'h' && String.unsafe_get s (pos+12) = 's' then ( 4 ) else ( -1 ) ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( - 8 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) ) - | 19 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'y' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( - 7 + | 14 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'h' && 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) = 'p' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 't' && String.unsafe_get s (pos+12) = 'h' && String.unsafe_get s (pos+13) = 's' then ( + 3 ) else ( -1 @@ -31398,76 +32593,66 @@ let read_ci_scan_complete_stats = ( field_findings := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__finding_list ) p lb ) ); | 1 -> - field_errors := ( + field_ignores := ( Some ( ( - read__cli_error_list + read__finding_list ) p lb ) ); | 2 -> - field_total_time := ( + field_token := ( Some ( ( - Atdgen_runtime.Oj_run.read_number + read__string_nullable ) p lb ) ); | 3 -> - field_unsupported_exts := ( + field_searched_paths := ( Some ( ( - read__x_852c7ec + read__fpath_list ) p lb ) ); | 4 -> - field_lockfile_scan_info := ( + field_renamed_paths := ( Some ( ( - read__x_852c7ec + read__fpath_list ) p lb ) ); | 5 -> - field_parse_rate := ( + field_rule_ids := ( Some ( ( - read__x_a95369c + read__rule_id_list ) p lb ) ); | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_requested := ( + field_contributions := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_contributions ) p lb ) ); ) | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_findings_by_product := ( - Some ( - ( - read__x_852c7ec - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_supply_chain_stats := ( + field_dependencies := ( Some ( ( - read_supply_chain_stats + read_ci_scan_dependencies ) p lb ) ); @@ -31482,95 +32667,21 @@ let read_ci_scan_complete_stats = ( ( { findings = (match !field_findings with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "findings"); - errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); - total_time = (match !field_total_time with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "total_time"); - unsupported_exts = (match !field_unsupported_exts with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unsupported_exts"); - lockfile_scan_info = (match !field_lockfile_scan_info with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lockfile_scan_info"); - parse_rate = (match !field_parse_rate with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "parse_rate"); - engine_requested = !field_engine_requested; - findings_by_product = !field_findings_by_product; - supply_chain_stats = !field_supply_chain_stats; + ignores = (match !field_ignores with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ignores"); + token = (match !field_token with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "token"); + searched_paths = (match !field_searched_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "searched_paths"); + renamed_paths = (match !field_renamed_paths with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "renamed_paths"); + rule_ids = (match !field_rule_ids with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_ids"); + contributions = !field_contributions; + dependencies = !field_dependencies; } - : ci_scan_complete_stats) + : ci_scan_results) ) ) -let ci_scan_complete_stats_of_string s = - read_ci_scan_complete_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_parser_error_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_dependency_parser_error - ) -) -let string_of__dependency_parser_error_list ?(len = 1024) x = - let ob = Buffer.create len in - write__dependency_parser_error_list ob x; - Buffer.contents ob -let read__dependency_parser_error_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_dependency_parser_error - ) -) -let _dependency_parser_error_list_of_string s = - read__dependency_parser_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_parser_error_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__dependency_parser_error_list - ) -) -let string_of__dependency_parser_error_list_option ?(len = 1024) x = - let ob = Buffer.create len in - write__dependency_parser_error_list_option ob x; - Buffer.contents ob -let read__dependency_parser_error_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_parser_error_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_parser_error_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 _dependency_parser_error_list_option_of_string s = - read__dependency_parser_error_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ci_scan_complete : _ -> ci_scan_complete -> _ = ( - fun ob (x : ci_scan_complete) -> +let ci_scan_results_of_string s = + read_ci_scan_results (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_scan_failure : _ -> ci_scan_failure -> _ = ( + fun ob (x : ci_scan_failure) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then @@ -31586,71 +32697,23 @@ let write_ci_scan_complete : _ -> ci_scan_complete -> _ = ( is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"stats\":"; + Buffer.add_string ob "\"stderr\":"; ( - write_ci_scan_complete_stats + Yojson.Safe.write_string ) - ob x.stats; - (match x.dependencies with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dependencies\":"; - ( - write_ci_scan_dependencies - ) - ob x; - ); - (match x.dependency_parser_errors with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"dependency_parser_errors\":"; - ( - write__dependency_parser_error_list - ) - ob x; - ); - (match x.task_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"task_id\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.final_attempt with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"final_attempt\":"; - ( - Yojson.Safe.write_bool - ) - ob x; - ); + ob x.stderr; Buffer.add_char ob '}'; ) -let string_of_ci_scan_complete ?(len = 1024) x = +let string_of_ci_scan_failure ?(len = 1024) x = let ob = Buffer.create len in - write_ci_scan_complete ob x; + write_ci_scan_failure ob x; Buffer.contents ob -let read_ci_scan_complete = ( +let read_ci_scan_failure = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; let field_exit_code = ref (None) in - let field_stats = ref (None) in - let field_dependencies = ref (None) in - let field_dependency_parser_errors = ref (None) in - let field_task_id = ref (None) in - let field_final_attempt = ref (None) in + let field_stderr = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -31660,22 +32723,14 @@ let read_ci_scan_complete = ( 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 = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 's' then ( + | 6 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'r' then ( 1 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) | 9 -> ( if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' then ( 0 @@ -31684,30 +32739,6 @@ let read_ci_scan_complete = ( -1 ) ) - | 12 -> ( - 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 't' then ( - 5 - ) - else ( - -1 - ) - ) - | 24 -> ( - 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) = 'r' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = '_' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 'o' && String.unsafe_get s (pos+22) = 'r' && String.unsafe_get s (pos+23) = 's' then ( - 3 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) @@ -31725,53 +32756,13 @@ let read_ci_scan_complete = ( ) ); | 1 -> - field_stats := ( + field_stderr := ( Some ( ( - read_ci_scan_complete_stats + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependencies := ( - Some ( - ( - read_ci_scan_dependencies - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_parser_errors := ( - Some ( - ( - read__dependency_parser_error_list - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_task_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_final_attempt := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -31785,22 +32776,14 @@ let read_ci_scan_complete = ( 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 = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 's' then ( + | 6 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'r' then ( 1 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 4 - ) - else ( - -1 - ) - ) | 9 -> ( if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' then ( 0 @@ -31809,30 +32792,6 @@ let read_ci_scan_complete = ( -1 ) ) - | 12 -> ( - 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 't' then ( - 5 - ) - else ( - -1 - ) - ) - | 24 -> ( - 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) = 'r' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = '_' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 'o' && String.unsafe_get s (pos+22) = 'r' && String.unsafe_get s (pos+23) = 's' then ( - 3 - ) - else ( - -1 - ) - ) | _ -> ( -1 ) @@ -31850,53 +32809,13 @@ let read_ci_scan_complete = ( ) ); | 1 -> - field_stats := ( + field_stderr := ( Some ( ( - read_ci_scan_complete_stats + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependencies := ( - Some ( - ( - read_ci_scan_dependencies - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dependency_parser_errors := ( - Some ( - ( - read__dependency_parser_error_list - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_task_id := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_final_attempt := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -31907,360 +32826,293 @@ let read_ci_scan_complete = ( ( { exit_code = (match !field_exit_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exit_code"); - stats = (match !field_stats with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "stats"); - dependencies = !field_dependencies; - dependency_parser_errors = !field_dependency_parser_errors; - task_id = !field_task_id; - final_attempt = !field_final_attempt; + stderr = (match !field_stderr with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "stderr"); } - : ci_scan_complete) + : ci_scan_failure) ) ) -let ci_scan_complete_of_string s = - read_ci_scan_complete (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_partial_scan_result = ( - fun ob x -> - match x with - | `PartialScanOk x -> - Buffer.add_string ob "[\"PartialScanOk\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ci_scan_results - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_ci_scan_complete - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PartialScanError x -> - Buffer.add_string ob "[\"PartialScanError\","; - ( - write_ci_scan_failure - ) ob x; - Buffer.add_char ob ']' +let ci_scan_failure_of_string s = + read_ci_scan_failure (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_a95369c = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + write_parsing_stats + ) ) -let string_of_partial_scan_result ?(len = 1024) x = +let string_of__x_a95369c ?(len = 1024) x = let ob = Buffer.create len in - write_partial_scan_result ob x; + write__x_a95369c ob x; Buffer.contents ob -let read_partial_scan_result = ( +let read__x_a95369c = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + read_parsing_stats + ) +) +let _x_a95369c_of_string s = + read__x_a95369c (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_852c7ec = ( + Atdgen_runtime.Oj_run.write_assoc_list ( + Yojson.Safe.write_string + ) ( + Yojson.Safe.write_int + ) +) +let string_of__x_852c7ec ?(len = 1024) x = + let ob = Buffer.create len in + write__x_852c7ec ob x; + Buffer.contents ob +let read__x_852c7ec = ( + Atdgen_runtime.Oj_run.read_assoc_list ( + Atdgen_runtime.Oj_run.read_string + ) ( + Atdgen_runtime.Oj_run.read_int + ) +) +let _x_852c7ec_of_string s = + read__x_852c7ec (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__x_122e274 = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__x_852c7ec + ) +) +let string_of__x_122e274 ?(len = 1024) x = + let ob = Buffer.create len in + write__x_122e274 ob x; + Buffer.contents ob +let read__x_122e274 = ( 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 - | "PartialScanOk" -> - 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_ci_scan_results - ) 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_scan_complete - ) 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 ]); - ) p lb - in + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `PartialScanOk x - | "PartialScanError" -> + (None : _ option) + | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_ci_scan_failure + read__x_852c7ec ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `PartialScanError x + (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 - | "PartialScanOk" -> - 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_ci_scan_results - ) 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_scan_complete - ) 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 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PartialScanOk x - | "PartialScanError" -> + | "Some" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_ci_scan_failure + read__x_852c7ec ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - `PartialScanError x + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let partial_scan_result_of_string s = - read_partial_scan_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_output_format : _ -> output_format -> _ = ( - fun ob (x : output_format) -> - match x with - | Text -> Buffer.add_string ob "\"Text\"" - | Json -> Buffer.add_string ob "\"Json\"" - | Emacs -> Buffer.add_string ob "\"Emacs\"" - | Vim -> Buffer.add_string ob "\"Vim\"" - | Sarif -> Buffer.add_string ob "\"Sarif\"" - | Gitlab_sast -> Buffer.add_string ob "\"Gitlab_sast\"" - | Gitlab_secrets -> Buffer.add_string ob "\"Gitlab_secrets\"" - | Junit_xml -> Buffer.add_string ob "\"Junit_xml\"" - | Files_with_matches -> Buffer.add_string ob "\"Files_with_matches\"" - | Incremental -> Buffer.add_string ob "\"Incremental\"" +let _x_122e274_of_string s = + read__x_122e274 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__supply_chain_stats_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_supply_chain_stats + ) ) -let string_of_output_format ?(len = 1024) x = +let string_of__supply_chain_stats_option ?(len = 1024) x = let ob = Buffer.create len in - write_output_format ob x; + write__supply_chain_stats_option ob x; Buffer.contents ob -let read_output_format = ( +let read__supply_chain_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 - | "Text" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Text : output_format) - | "Json" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Json : output_format) - | "Emacs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Emacs : output_format) - | "Vim" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Vim : output_format) - | "Sarif" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Sarif : output_format) - | "Gitlab_sast" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Gitlab_sast : output_format) - | "Gitlab_secrets" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Gitlab_secrets : output_format) - | "Junit_xml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Junit_xml : output_format) - | "Files_with_matches" -> + | "None" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Files_with_matches : output_format) - | "Incremental" -> + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_supply_chain_stats + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Incremental : output_format) + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "Text" -> - (Text : output_format) - | "Json" -> - (Json : output_format) - | "Emacs" -> - (Emacs : output_format) - | "Vim" -> - (Vim : output_format) - | "Sarif" -> - (Sarif : output_format) - | "Gitlab_sast" -> - (Gitlab_sast : output_format) - | "Gitlab_secrets" -> - (Gitlab_secrets : output_format) - | "Junit_xml" -> - (Junit_xml : output_format) - | "Files_with_matches" -> - (Files_with_matches : output_format) - | "Incremental" -> - (Incremental : output_format) + | "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_supply_chain_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 output_format_of_string s = - read_output_format (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_match_based_id = ( - Yojson.Safe.write_string +let _supply_chain_stats_option_of_string s = + read__supply_chain_stats_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__cli_error_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_cli_error + ) ) -let string_of_match_based_id ?(len = 1024) x = +let string_of__cli_error_list ?(len = 1024) x = let ob = Buffer.create len in - write_match_based_id ob x; + write__cli_error_list ob x; Buffer.contents ob -let read_match_based_id = ( - Atdgen_runtime.Oj_run.read_string +let read__cli_error_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_cli_error + ) ) -let match_based_id_of_string s = - read_match_based_id (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_has_features : _ -> has_features -> _ = ( - fun ob (x : has_features) -> +let _cli_error_list_of_string s = + read__cli_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_scan_complete_stats : _ -> ci_scan_complete_stats -> _ = ( + fun ob (x : ci_scan_complete_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 "\"has_autofix\":"; + Buffer.add_string ob "\"findings\":"; + ( + Yojson.Safe.write_int + ) + ob x.findings; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"errors\":"; + ( + write__cli_error_list + ) + ob x.errors; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"total_time\":"; ( - Yojson.Safe.write_bool + Yojson.Safe.write_std_float ) - ob x.has_autofix; + ob x.total_time; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"has_deepsemgrep\":"; + Buffer.add_string ob "\"unsupported_exts\":"; ( - Yojson.Safe.write_bool + write__x_852c7ec ) - ob x.has_deepsemgrep; + ob x.unsupported_exts; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"has_triage_via_comment\":"; + Buffer.add_string ob "\"lockfile_scan_info\":"; ( - Yojson.Safe.write_bool + write__x_852c7ec ) - ob x.has_triage_via_comment; + ob x.lockfile_scan_info; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"has_dependency_query\":"; + Buffer.add_string ob "\"parse_rate\":"; ( - Yojson.Safe.write_bool + write__x_a95369c ) - ob x.has_dependency_query; + ob x.parse_rate; + (match x.engine_requested with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"engine_requested\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.findings_by_product with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"findings_by_product\":"; + ( + write__x_852c7ec + ) + ob x; + ); + (match x.supply_chain_stats with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"supply_chain_stats\":"; + ( + write_supply_chain_stats + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_has_features ?(len = 1024) x = +let string_of_ci_scan_complete_stats ?(len = 1024) x = let ob = Buffer.create len in - write_has_features ob x; + write_ci_scan_complete_stats ob x; Buffer.contents ob -let read_has_features = ( +let read_ci_scan_complete_stats = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_has_autofix = ref (false) in - let field_has_deepsemgrep = ref (false) in - let field_has_triage_via_comment = ref (false) in - let field_has_dependency_query = ref (false) in + let field_findings = ref (None) in + let field_errors = ref (None) in + let field_total_time = ref (None) in + let field_unsupported_exts = ref (None) in + let field_lockfile_scan_info = ref (None) in + let field_parse_rate = ref (None) in + let field_engine_requested = ref (None) in + let field_findings_by_product = ref (None) in + let field_supply_chain_stats = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -32270,33 +33122,91 @@ let read_has_features = ( 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 - | 11 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'x' then ( - 0 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' then ( + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( 1 ) else ( -1 ) ) - | 20 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'y' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'q' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'e' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'y' then ( - 3 + | 8 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + 0 ) else ( -1 ) ) - | 22 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'v' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 'm' && String.unsafe_get s (pos+18) = 'm' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 'n' && String.unsafe_get s (pos+21) = 't' then ( - 2 + | 10 -> ( + match String.unsafe_get s pos with + | '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) = 'r' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' then ( + 5 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && 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' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 16 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if 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) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'q' && String.unsafe_get s (pos+10) = 'u' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' then ( + 6 + ) + else ( + -1 + ) + ) + | 'u' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'x' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 18 -> ( + 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) = 's' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'o' then ( + 4 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 19 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'y' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( + 7 ) else ( -1 @@ -32311,294 +33221,83 @@ let read_has_features = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_autofix := ( + field_findings := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb - ); - ) + ) + ); | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_deepsemgrep := ( + field_errors := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__cli_error_list ) p lb - ); - ) + ) + ); | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_triage_via_comment := ( + field_total_time := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_number ) p lb - ); - ) + ) + ); | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_dependency_query := ( + field_unsupported_exts := ( + Some ( ( - Atdgen_runtime.Oj_run.read_bool + read__x_852c7ec ) 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 - | 11 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'x' then ( - 0 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' then ( - 1 - ) - else ( - -1 - ) - ) - | 20 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'y' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'q' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'e' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'y' then ( - 3 - ) - else ( - -1 - ) - ) - | 22 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'v' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 'm' && String.unsafe_get s (pos+18) = 'm' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 'n' && String.unsafe_get s (pos+21) = '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 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_autofix := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_deepsemgrep := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_triage_via_comment := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_has_dependency_query := ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - has_autofix = !field_has_autofix; - has_deepsemgrep = !field_has_deepsemgrep; - has_triage_via_comment = !field_has_triage_via_comment; - has_dependency_query = !field_has_dependency_query; - } - : has_features) - ) -) -let has_features_of_string s = - read_has_features (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__int_string_list_list = ( - Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - Yojson.Safe.write_int - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__string_list - ) ob x - ); - Buffer.add_char ob ']'; - ) -) -let string_of__int_string_list_list ?(len = 1024) x = - let ob = Buffer.create len in - write__int_string_list_list ob x; - Buffer.contents ob -let read__int_string_list_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 = - ( - Atdgen_runtime.Oj_run.read_int - ) 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__string_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 _int_string_list_list_of_string s = - read__int_string_list_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_apply_fixes_return : _ -> apply_fixes_return -> _ = ( - fun ob (x : apply_fixes_return) -> - 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 "\"modified_file_count\":"; - ( - Yojson.Safe.write_int - ) - ob x.modified_file_count; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fixed_lines\":"; - ( - write__int_string_list_list - ) - ob x.fixed_lines; - Buffer.add_char ob '}'; -) -let string_of_apply_fixes_return ?(len = 1024) x = - let ob = Buffer.create len in - write_apply_fixes_return ob x; - Buffer.contents ob -let read_apply_fixes_return = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_modified_file_count = ref (None) in - let field_fixed_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); - match len with - | 11 -> ( - 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) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 19 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && 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) = 'f' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'l' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' 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_modified_file_count := ( + ); + | 4 -> + field_lockfile_scan_info := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read__x_852c7ec ) p lb ) ); - | 1 -> - field_fixed_lines := ( + | 5 -> + field_parse_rate := ( Some ( ( - read__int_string_list_list + read__x_a95369c ) p lb ) ); + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_requested := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_findings_by_product := ( + Some ( + ( + read__x_852c7ec + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_supply_chain_stats := ( + Some ( + ( + read_supply_chain_stats + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -32612,17 +33311,91 @@ let read_apply_fixes_return = ( 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 - | 11 -> ( - 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) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + | 6 -> ( + if String.unsafe_get s pos = 'e' && 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 ( 1 ) else ( -1 ) ) + | 8 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | 10 -> ( + match String.unsafe_get s pos with + | '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) = 'r' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' then ( + 5 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && 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' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 16 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + if 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) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'q' && String.unsafe_get s (pos+10) = 'u' && String.unsafe_get s (pos+11) = 'e' && String.unsafe_get s (pos+12) = 's' && String.unsafe_get s (pos+13) = 't' && String.unsafe_get s (pos+14) = 'e' && String.unsafe_get s (pos+15) = 'd' then ( + 6 + ) + else ( + -1 + ) + ) + | 'u' -> ( + if String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = 'x' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 18 -> ( + 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) = 's' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'i' && String.unsafe_get s (pos+15) = 'n' && String.unsafe_get s (pos+16) = 'f' && String.unsafe_get s (pos+17) = 'o' then ( + 4 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = '_' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'a' && String.unsafe_get s (pos+16) = 't' && String.unsafe_get s (pos+17) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) | 19 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && 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) = 'f' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'l' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' then ( - 0 + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'd' && 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) = 's' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'y' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'p' && String.unsafe_get s (pos+13) = 'r' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'd' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 't' then ( + 7 ) else ( -1 @@ -32637,7 +33410,7 @@ let read_apply_fixes_return = ( ( match i with | 0 -> - field_modified_file_count := ( + field_findings := ( Some ( ( Atdgen_runtime.Oj_run.read_int @@ -32645,13 +33418,75 @@ let read_apply_fixes_return = ( ) ); | 1 -> - field_fixed_lines := ( + field_errors := ( Some ( ( - read__int_string_list_list + read__cli_error_list + ) p lb + ) + ); + | 2 -> + field_total_time := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_number + ) p lb + ) + ); + | 3 -> + field_unsupported_exts := ( + Some ( + ( + read__x_852c7ec + ) p lb + ) + ); + | 4 -> + field_lockfile_scan_info := ( + Some ( + ( + read__x_852c7ec + ) p lb + ) + ); + | 5 -> + field_parse_rate := ( + Some ( + ( + read__x_a95369c ) p lb ) ); + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_requested := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_findings_by_product := ( + Some ( + ( + read__x_852c7ec + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_supply_chain_stats := ( + Some ( + ( + read_supply_chain_stats + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -32661,444 +33496,176 @@ let read_apply_fixes_return = ( with Yojson.End_of_object -> ( ( { - modified_file_count = (match !field_modified_file_count with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "modified_file_count"); - fixed_lines = (match !field_fixed_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fixed_lines"); + findings = (match !field_findings with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "findings"); + errors = (match !field_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "errors"); + total_time = (match !field_total_time with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "total_time"); + unsupported_exts = (match !field_unsupported_exts with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "unsupported_exts"); + lockfile_scan_info = (match !field_lockfile_scan_info with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lockfile_scan_info"); + parse_rate = (match !field_parse_rate with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "parse_rate"); + engine_requested = !field_engine_requested; + findings_by_product = !field_findings_by_product; + supply_chain_stats = !field_supply_chain_stats; } - : apply_fixes_return) + : ci_scan_complete_stats) ) ) -let apply_fixes_return_of_string s = - read_apply_fixes_return (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dependency_source_resolution_result_list = ( +let ci_scan_complete_stats_of_string s = + read_ci_scan_complete_stats (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_parser_error_list = ( Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_dependency_source - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_resolution_result - ) ob x - ); - Buffer.add_char ob ']'; + write_dependency_parser_error ) ) -let string_of__dependency_source_resolution_result_list ?(len = 1024) x = +let string_of__dependency_parser_error_list ?(len = 1024) x = let ob = Buffer.create len in - write__dependency_source_resolution_result_list ob x; + write__dependency_parser_error_list ob x; Buffer.contents ob -let read__dependency_source_resolution_result_list = ( +let read__dependency_parser_error_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_dependency_source - ) 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_resolution_result - ) 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 ]); + read_dependency_parser_error ) ) -let _dependency_source_resolution_result_list_of_string s = - read__dependency_source_resolution_result_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_function_return = ( - fun ob x -> - match x with - | `RetError x -> - Buffer.add_string ob "[\"RetError\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `RetApplyFixes x -> - Buffer.add_string ob "[\"RetApplyFixes\","; - ( - write_apply_fixes_return - ) ob x; - Buffer.add_char ob ']' - | `RetContributions x -> - Buffer.add_string ob "[\"RetContributions\","; - ( - write_contributions - ) ob x; - Buffer.add_char ob ']' - | `RetFormatter x -> - Buffer.add_string ob "[\"RetFormatter\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `RetSarifFormat x -> - Buffer.add_string ob "[\"RetSarifFormat\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `RetValidate x -> - Buffer.add_string ob "[\"RetValidate\","; - ( - Yojson.Safe.write_bool - ) ob x; - Buffer.add_char ob ']' - | `RetResolveDependencies x -> - Buffer.add_string ob "[\"RetResolveDependencies\","; - ( - write__dependency_source_resolution_result_list - ) ob x; - Buffer.add_char ob ']' - | `RetUploadSymbolAnalysis x -> - Buffer.add_string ob "[\"RetUploadSymbolAnalysis\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `RetDumpRulePartitions x -> - Buffer.add_string ob "[\"RetDumpRulePartitions\","; - ( - Yojson.Safe.write_bool - ) ob x; - Buffer.add_char ob ']' - | `RetTransitiveReachabilityFilter x -> - Buffer.add_string ob "[\"RetTransitiveReachabilityFilter\","; - ( - write__transitive_finding_list - ) ob x; - Buffer.add_char ob ']' - | `RetGetTargets x -> - Buffer.add_string ob "[\"RetGetTargets\","; - ( - write_target_discovery_result - ) ob x; - Buffer.add_char ob ']' -) -let string_of_function_return ?(len = 1024) x = - let ob = Buffer.create len in - write_function_return ob x; - Buffer.contents ob -let read_function_return = ( - 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 - | "RetError" -> - 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; - `RetError x - | "RetApplyFixes" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_apply_fixes_return - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetApplyFixes x - | "RetContributions" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_contributions - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetContributions x - | "RetFormatter" -> - 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; - `RetFormatter x - | "RetSarifFormat" -> - 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; - `RetSarifFormat x - | "RetValidate" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetValidate x - | "RetResolveDependencies" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__dependency_source_resolution_result_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetResolveDependencies x - | "RetUploadSymbolAnalysis" -> - 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; - `RetUploadSymbolAnalysis x - | "RetDumpRulePartitions" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetDumpRulePartitions x - | "RetTransitiveReachabilityFilter" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__transitive_finding_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetTransitiveReachabilityFilter x - | "RetGetTargets" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_target_discovery_result - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RetGetTargets 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 - | "RetError" -> - 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; - `RetError x - | "RetApplyFixes" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_apply_fixes_return - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetApplyFixes x - | "RetContributions" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_contributions - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetContributions x - | "RetFormatter" -> - 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; - `RetFormatter x - | "RetSarifFormat" -> - 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; - `RetSarifFormat x - | "RetValidate" -> - 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_bool - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetValidate x - | "RetResolveDependencies" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__dependency_source_resolution_result_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetResolveDependencies x - | "RetUploadSymbolAnalysis" -> - 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; - `RetUploadSymbolAnalysis x - | "RetDumpRulePartitions" -> - 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_bool - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetDumpRulePartitions x - | "RetTransitiveReachabilityFilter" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; +let _dependency_parser_error_list_of_string s = + read__dependency_parser_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_parser_error_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__dependency_parser_error_list + ) +) +let string_of__dependency_parser_error_list_option ?(len = 1024) x = + let ob = Buffer.create len in + write__dependency_parser_error_list_option ob x; + Buffer.contents ob +let read__dependency_parser_error_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__transitive_finding_list + read__dependency_parser_error_list ) p lb in Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `RetTransitiveReachabilityFilter x - | "RetGetTargets" -> + 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_target_discovery_result + read__dependency_parser_error_list ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - `RetGetTargets x + (Some x : _ option) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let function_return_of_string s = - read_function_return (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_format_context : _ -> format_context -> _ = ( - fun ob (x : format_context) -> +let _dependency_parser_error_list_option_of_string s = + read__dependency_parser_error_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_ci_scan_complete : _ -> ci_scan_complete -> _ = ( + fun ob (x : ci_scan_complete) -> 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 "\"is_ci_invocation\":"; - ( - Yojson.Safe.write_bool - ) - ob x.is_ci_invocation; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"is_logged_in\":"; + Buffer.add_string ob "\"exit_code\":"; ( - Yojson.Safe.write_bool + Yojson.Safe.write_int ) - ob x.is_logged_in; + ob x.exit_code; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"is_using_registry\":"; + Buffer.add_string ob "\"stats\":"; ( - Yojson.Safe.write_bool + write_ci_scan_complete_stats ) - ob x.is_using_registry; + ob x.stats; + (match x.dependencies with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dependencies\":"; + ( + write_ci_scan_dependencies + ) + ob x; + ); + (match x.dependency_parser_errors with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dependency_parser_errors\":"; + ( + write__dependency_parser_error_list + ) + ob x; + ); + (match x.task_id with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"task_id\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.final_attempt with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"final_attempt\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_format_context ?(len = 1024) x = +let string_of_ci_scan_complete ?(len = 1024) x = let ob = Buffer.create len in - write_format_context ob x; + write_ci_scan_complete ob x; Buffer.contents ob -let read_format_context = ( +let read_ci_scan_complete = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_is_ci_invocation = ref (None) in - let field_is_logged_in = ref (None) in - let field_is_using_registry = ref (None) in + let field_exit_code = ref (None) in + let field_stats = ref (None) in + let field_dependencies = ref (None) in + let field_dependency_parser_errors = ref (None) in + let field_task_id = ref (None) in + let field_final_attempt = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -33108,30 +33675,54 @@ let read_format_context = ( 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 = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'g' && 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) = 'i' && String.unsafe_get s (pos+11) = 'n' then ( + | 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) = 't' && String.unsafe_get s (pos+4) = 's' then ( 1 ) else ( -1 ) ) - | 16 -> ( - 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) = 'c' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' then ( + | 7 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' then ( 0 ) else ( -1 ) ) - | 17 -> ( - 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) = 'u' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'y' then ( + | 12 -> ( + 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( 2 ) else ( -1 ) ) + | 13 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 't' then ( + 5 + ) + else ( + -1 + ) + ) + | 24 -> ( + 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) = 'r' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = '_' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 'o' && String.unsafe_get s (pos+22) = 'r' && String.unsafe_get s (pos+23) = 's' then ( + 3 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -33141,29 +33732,61 @@ let read_format_context = ( ( match i with | 0 -> - field_is_ci_invocation := ( + field_exit_code := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_is_logged_in := ( + field_stats := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_ci_scan_complete_stats ) p lb ) ); | 2 -> - field_is_using_registry := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependencies := ( + Some ( + ( + read_ci_scan_dependencies + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_parser_errors := ( + Some ( + ( + read__dependency_parser_error_list + ) p lb + ) + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_task_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_final_attempt := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -33177,30 +33800,54 @@ let read_format_context = ( 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 = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'g' && 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) = 'i' && String.unsafe_get s (pos+11) = 'n' then ( + | 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) = 't' && String.unsafe_get s (pos+4) = 's' then ( 1 ) else ( -1 ) ) - | 16 -> ( - 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) = 'c' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' then ( + | 7 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'k' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 4 + ) + else ( + -1 + ) + ) + | 9 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 't' && 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) = 'd' && String.unsafe_get s (pos+8) = 'e' then ( 0 ) else ( -1 ) ) - | 17 -> ( - 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) = 'u' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'y' then ( + | 12 -> ( + 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) = 'i' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 's' then ( 2 ) else ( -1 ) ) + | 13 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'p' && String.unsafe_get s (pos+12) = 't' then ( + 5 + ) + else ( + -1 + ) + ) + | 24 -> ( + 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) = 'r' && String.unsafe_get s (pos+14) = 's' && String.unsafe_get s (pos+15) = 'e' && String.unsafe_get s (pos+16) = 'r' && String.unsafe_get s (pos+17) = '_' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 'r' && String.unsafe_get s (pos+20) = 'r' && String.unsafe_get s (pos+21) = 'o' && String.unsafe_get s (pos+22) = 'r' && String.unsafe_get s (pos+23) = 's' then ( + 3 + ) + else ( + -1 + ) + ) | _ -> ( -1 ) @@ -33210,29 +33857,61 @@ let read_format_context = ( ( match i with | 0 -> - field_is_ci_invocation := ( + field_exit_code := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_is_logged_in := ( + field_stats := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_ci_scan_complete_stats ) p lb ) ); | 2 -> - field_is_using_registry := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependencies := ( + Some ( + ( + read_ci_scan_dependencies + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dependency_parser_errors := ( + Some ( + ( + read__dependency_parser_error_list + ) p lb + ) + ); + ) + | 4 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_task_id := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_final_attempt := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -33242,69 +33921,361 @@ let read_format_context = ( with Yojson.End_of_object -> ( ( { - is_ci_invocation = (match !field_is_ci_invocation with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_ci_invocation"); - is_logged_in = (match !field_is_logged_in with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_logged_in"); - is_using_registry = (match !field_is_using_registry with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_using_registry"); + exit_code = (match !field_exit_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "exit_code"); + stats = (match !field_stats with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "stats"); + dependencies = !field_dependencies; + dependency_parser_errors = !field_dependency_parser_errors; + task_id = !field_task_id; + final_attempt = !field_final_attempt; } - : format_context) + : ci_scan_complete) ) ) -let format_context_of_string s = - read_format_context (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_edit : _ -> edit -> _ = ( - fun ob (x : edit) -> +let ci_scan_complete_of_string s = + read_ci_scan_complete (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_partial_scan_result = ( + fun ob x -> + match x with + | `PartialScanOk x -> + Buffer.add_string ob "[\"PartialScanOk\","; + ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_ci_scan_results + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write_ci_scan_complete + ) ob x + ); + Buffer.add_char ob ']'; + ) ob x; + Buffer.add_char ob ']' + | `PartialScanError x -> + Buffer.add_string ob "[\"PartialScanError\","; + ( + write_ci_scan_failure + ) ob x; + Buffer.add_char ob ']' +) +let string_of_partial_scan_result ?(len = 1024) x = + let ob = Buffer.create len in + write_partial_scan_result ob x; + Buffer.contents ob +let read_partial_scan_result = ( + 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 + | "PartialScanOk" -> + 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_ci_scan_results + ) 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_scan_complete + ) 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 ]); + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PartialScanOk x + | "PartialScanError" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_ci_scan_failure + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `PartialScanError 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 + | "PartialScanOk" -> + 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_ci_scan_results + ) 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_scan_complete + ) 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 ]); + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `PartialScanOk x + | "PartialScanError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_ci_scan_failure + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `PartialScanError x + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let partial_scan_result_of_string s = + read_partial_scan_result (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_output_format : _ -> output_format -> _ = ( + fun ob (x : output_format) -> + match x with + | Text -> Buffer.add_string ob "\"Text\"" + | Json -> Buffer.add_string ob "\"Json\"" + | Emacs -> Buffer.add_string ob "\"Emacs\"" + | Vim -> Buffer.add_string ob "\"Vim\"" + | Sarif -> Buffer.add_string ob "\"Sarif\"" + | Gitlab_sast -> Buffer.add_string ob "\"Gitlab_sast\"" + | Gitlab_secrets -> Buffer.add_string ob "\"Gitlab_secrets\"" + | Junit_xml -> Buffer.add_string ob "\"Junit_xml\"" + | Files_with_matches -> Buffer.add_string ob "\"Files_with_matches\"" + | Incremental -> Buffer.add_string ob "\"Incremental\"" +) +let string_of_output_format ?(len = 1024) x = + let ob = Buffer.create len in + write_output_format ob x; + Buffer.contents ob +let read_output_format = ( + 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 + | "Text" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Text : output_format) + | "Json" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Json : output_format) + | "Emacs" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Emacs : output_format) + | "Vim" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Vim : output_format) + | "Sarif" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Sarif : output_format) + | "Gitlab_sast" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Gitlab_sast : output_format) + | "Gitlab_secrets" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Gitlab_secrets : output_format) + | "Junit_xml" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Junit_xml : output_format) + | "Files_with_matches" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Files_with_matches : output_format) + | "Incremental" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Incremental : output_format) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "Text" -> + (Text : output_format) + | "Json" -> + (Json : output_format) + | "Emacs" -> + (Emacs : output_format) + | "Vim" -> + (Vim : output_format) + | "Sarif" -> + (Sarif : output_format) + | "Gitlab_sast" -> + (Gitlab_sast : output_format) + | "Gitlab_secrets" -> + (Gitlab_secrets : output_format) + | "Junit_xml" -> + (Junit_xml : output_format) + | "Files_with_matches" -> + (Files_with_matches : output_format) + | "Incremental" -> + (Incremental : output_format) + | 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 output_format_of_string s = + read_output_format (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_match_based_id = ( + Yojson.Safe.write_string +) +let string_of_match_based_id ?(len = 1024) x = + let ob = Buffer.create len in + write_match_based_id ob x; + Buffer.contents ob +let read_match_based_id = ( + Atdgen_runtime.Oj_run.read_string +) +let match_based_id_of_string s = + read_match_based_id (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_has_features : _ -> has_features -> _ = ( + fun ob (x : has_features) -> 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 "\"has_autofix\":"; ( - write_fpath + Yojson.Safe.write_bool ) - ob x.path; + ob x.has_autofix; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"start_offset\":"; + Buffer.add_string ob "\"has_deepsemgrep\":"; ( - Yojson.Safe.write_int + Yojson.Safe.write_bool ) - ob x.start_offset; + ob x.has_deepsemgrep; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"end_offset\":"; + Buffer.add_string ob "\"has_triage_via_comment\":"; ( - Yojson.Safe.write_int + Yojson.Safe.write_bool ) - ob x.end_offset; + ob x.has_triage_via_comment; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"replacement_text\":"; + Buffer.add_string ob "\"has_dependency_query\":"; ( - Yojson.Safe.write_string + Yojson.Safe.write_bool ) - ob x.replacement_text; + ob x.has_dependency_query; Buffer.add_char ob '}'; ) -let string_of_edit ?(len = 1024) x = +let string_of_has_features ?(len = 1024) x = let ob = Buffer.create len in - write_edit ob x; + write_has_features ob x; Buffer.contents ob -let read_edit = ( +let read_has_features = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_path = ref (None) in - let field_start_offset = ref (None) in - let field_end_offset = ref (None) in - let field_replacement_text = ref (None) in + let field_has_autofix = ref (false) in + let field_has_deepsemgrep = ref (false) in + let field_has_triage_via_comment = ref (false) in + let field_has_dependency_query = ref (false) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -33314,33 +34285,33 @@ let read_edit = ( 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 ( + | 11 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'x' then ( 0 ) else ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' then ( - 2 + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - 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) = 'o' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 't' then ( - 1 + | 20 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'y' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'q' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'e' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'y' then ( + 3 ) else ( -1 ) ) - | 16 -> ( - 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) = 'l' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( - 3 + | 22 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'v' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 'm' && String.unsafe_get s (pos+18) = 'm' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 'n' && String.unsafe_get s (pos+21) = 't' then ( + 2 ) else ( -1 @@ -33355,37 +34326,37 @@ let read_edit = ( ( match i with | 0 -> - field_path := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_autofix := ( ( - read_fpath + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 1 -> - field_start_offset := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_deepsemgrep := ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 2 -> - field_end_offset := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_triage_via_comment := ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 3 -> - field_replacement_text := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_dependency_query := ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -33399,33 +34370,33 @@ let read_edit = ( 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 ( + | 11 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'x' then ( 0 ) else ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' then ( - 2 + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'm' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'r' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'p' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - 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) = 'o' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 't' then ( - 1 + | 20 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'n' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'y' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'q' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'e' && String.unsafe_get s (pos+18) = 'r' && String.unsafe_get s (pos+19) = 'y' then ( + 3 ) else ( -1 ) ) - | 16 -> ( - 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) = 'l' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( - 3 + | 22 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'v' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = '_' && String.unsafe_get s (pos+15) = 'c' && String.unsafe_get s (pos+16) = 'o' && String.unsafe_get s (pos+17) = 'm' && String.unsafe_get s (pos+18) = 'm' && String.unsafe_get s (pos+19) = 'e' && String.unsafe_get s (pos+20) = 'n' && String.unsafe_get s (pos+21) = 't' then ( + 2 ) else ( -1 @@ -33440,37 +34411,37 @@ let read_edit = ( ( match i with | 0 -> - field_path := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_autofix := ( ( - read_fpath + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 1 -> - field_start_offset := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_deepsemgrep := ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 2 -> - field_end_offset := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_triage_via_comment := ( ( - Atdgen_runtime.Oj_run.read_int + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | 3 -> - field_replacement_text := ( - Some ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_has_dependency_query := ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb - ) - ); + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -33480,60 +34451,120 @@ let read_edit = ( with Yojson.End_of_object -> ( ( { - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); - start_offset = (match !field_start_offset with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start_offset"); - end_offset = (match !field_end_offset with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_offset"); - replacement_text = (match !field_replacement_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "replacement_text"); + has_autofix = !field_has_autofix; + has_deepsemgrep = !field_has_deepsemgrep; + has_triage_via_comment = !field_has_triage_via_comment; + has_dependency_query = !field_has_dependency_query; } - : edit) + : has_features) ) ) -let edit_of_string s = - read_edit (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dump_rule_partitions_params : _ -> dump_rule_partitions_params -> _ = ( - fun ob (x : dump_rule_partitions_params) -> +let has_features_of_string s = + read_has_features (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__int_string_list_list = ( + Atdgen_runtime.Oj_run.write_list ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + Yojson.Safe.write_int + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write__string_list + ) ob x + ); + Buffer.add_char ob ']'; + ) +) +let string_of__int_string_list_list ?(len = 1024) x = + let ob = Buffer.create len in + write__int_string_list_list ob x; + Buffer.contents ob +let read__int_string_list_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 = + ( + Atdgen_runtime.Oj_run.read_int + ) 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__string_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 _int_string_list_list_of_string s = + read__int_string_list_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_apply_fixes_return : _ -> apply_fixes_return -> _ = ( + fun ob (x : apply_fixes_return) -> 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 "\"n_partitions\":"; + Buffer.add_string ob "\"modified_file_count\":"; ( Yojson.Safe.write_int ) - ob x.n_partitions; + ob x.modified_file_count; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"output_dir\":"; + Buffer.add_string ob "\"fixed_lines\":"; ( - write_fpath + write__int_string_list_list ) - ob x.output_dir; + ob x.fixed_lines; Buffer.add_char ob '}'; ) -let string_of_dump_rule_partitions_params ?(len = 1024) x = +let string_of_apply_fixes_return ?(len = 1024) x = let ob = Buffer.create len in - write_dump_rule_partitions_params ob x; + write_apply_fixes_return ob x; Buffer.contents ob -let read_dump_rule_partitions_params = ( +let read_apply_fixes_return = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_rules = ref (None) in - let field_n_partitions = ref (None) in - let field_output_dir = ref (None) in + let field_modified_file_count = ref (None) in + let field_fixed_lines = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -33543,25 +34574,17 @@ let read_dump_rule_partitions_params = ( 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 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' then ( - 2 + | 11 -> ( + 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) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = '_' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 's' then ( - 1 + | 19 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && 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) = 'f' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'l' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' then ( + 0 ) else ( -1 @@ -33576,26 +34599,18 @@ let read_dump_rule_partitions_params = ( ( match i with | 0 -> - field_rules := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - | 1 -> - field_n_partitions := ( + field_modified_file_count := ( Some ( ( Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 2 -> - field_output_dir := ( + | 1 -> + field_fixed_lines := ( Some ( ( - read_fpath + read__int_string_list_list ) p lb ) ); @@ -33612,25 +34627,17 @@ let read_dump_rule_partitions_params = ( 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 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' then ( - 2 + | 11 -> ( + 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) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 1 ) else ( -1 ) ) - | 12 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = '_' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 's' then ( - 1 + | 19 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'i' && 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) = 'f' && String.unsafe_get s (pos+10) = 'i' && String.unsafe_get s (pos+11) = 'l' && String.unsafe_get s (pos+12) = 'e' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 'c' && String.unsafe_get s (pos+15) = 'o' && String.unsafe_get s (pos+16) = 'u' && String.unsafe_get s (pos+17) = 'n' && String.unsafe_get s (pos+18) = 't' then ( + 0 ) else ( -1 @@ -33645,26 +34652,18 @@ let read_dump_rule_partitions_params = ( ( match i with | 0 -> - field_rules := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - | 1 -> - field_n_partitions := ( + field_modified_file_count := ( Some ( ( Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 2 -> - field_output_dir := ( + | 1 -> + field_fixed_lines := ( Some ( ( - read_fpath + read__int_string_list_list ) p lb ) ); @@ -33672,261 +34671,449 @@ let read_dump_rule_partitions_params = ( 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"); - n_partitions = (match !field_n_partitions with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "n_partitions"); - output_dir = (match !field_output_dir with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "output_dir"); - } - : dump_rule_partitions_params) - ) -) -let dump_rule_partitions_params_of_string s = - read_dump_rule_partitions_params (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__metavars_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_metavars + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + modified_file_count = (match !field_modified_file_count with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "modified_file_count"); + fixed_lines = (match !field_fixed_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fixed_lines"); + } + : apply_fixes_return) + ) +) +let apply_fixes_return_of_string s = + read_apply_fixes_return (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__dependency_source_resolution_result_list = ( + Atdgen_runtime.Oj_run.write_list ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_dependency_source + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write_resolution_result + ) ob x + ); + Buffer.add_char ob ']'; + ) +) +let string_of__dependency_source_resolution_result_list ?(len = 1024) x = + let ob = Buffer.create len in + write__dependency_source_resolution_result_list ob x; + Buffer.contents ob +let read__dependency_source_resolution_result_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_dependency_source + ) 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_resolution_result + ) 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 string_of__metavars_option ?(len = 1024) x = +let _dependency_source_resolution_result_list_of_string s = + read__dependency_source_resolution_result_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_function_return = ( + fun ob x -> + match x with + | `RetError x -> + Buffer.add_string ob "[\"RetError\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `RetApplyFixes x -> + Buffer.add_string ob "[\"RetApplyFixes\","; + ( + write_apply_fixes_return + ) ob x; + Buffer.add_char ob ']' + | `RetContributions x -> + Buffer.add_string ob "[\"RetContributions\","; + ( + write_contributions + ) ob x; + Buffer.add_char ob ']' + | `RetFormatter x -> + Buffer.add_string ob "[\"RetFormatter\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `RetSarifFormat x -> + Buffer.add_string ob "[\"RetSarifFormat\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `RetValidate x -> + Buffer.add_string ob "[\"RetValidate\","; + ( + Yojson.Safe.write_bool + ) ob x; + Buffer.add_char ob ']' + | `RetResolveDependencies x -> + Buffer.add_string ob "[\"RetResolveDependencies\","; + ( + write__dependency_source_resolution_result_list + ) ob x; + Buffer.add_char ob ']' + | `RetUploadSymbolAnalysis x -> + Buffer.add_string ob "[\"RetUploadSymbolAnalysis\","; + ( + Yojson.Safe.write_string + ) ob x; + Buffer.add_char ob ']' + | `RetDumpRulePartitions x -> + Buffer.add_string ob "[\"RetDumpRulePartitions\","; + ( + Yojson.Safe.write_bool + ) ob x; + Buffer.add_char ob ']' + | `RetTransitiveReachabilityFilter x -> + Buffer.add_string ob "[\"RetTransitiveReachabilityFilter\","; + ( + write__transitive_finding_list + ) ob x; + Buffer.add_char ob ']' + | `RetGetTargets x -> + Buffer.add_string ob "[\"RetGetTargets\","; + ( + write_target_discovery_result + ) ob x; + Buffer.add_char ob ']' +) +let string_of_function_return ?(len = 1024) x = let ob = Buffer.create len in - write__metavars_option ob x; + write_function_return ob x; Buffer.contents ob -let read__metavars_option = ( +let read_function_return = ( 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" -> + | "RetError" -> + 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; - (None : _ option) - | "Some" -> + `RetError x + | "RetApplyFixes" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_metavars + read_apply_fixes_return ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + `RetApplyFixes x + | "RetContributions" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_contributions + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetContributions x + | "RetFormatter" -> + 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; + `RetFormatter x + | "RetSarifFormat" -> + 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; + `RetSarifFormat x + | "RetValidate" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetValidate x + | "RetResolveDependencies" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__dependency_source_resolution_result_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetResolveDependencies x + | "RetUploadSymbolAnalysis" -> + 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; + `RetUploadSymbolAnalysis x + | "RetDumpRulePartitions" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetDumpRulePartitions x + | "RetTransitiveReachabilityFilter" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__transitive_finding_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetTransitiveReachabilityFilter x + | "RetGetTargets" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_target_discovery_result + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `RetGetTargets 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" -> + | "RetError" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_metavars + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + `RetError x + | "RetApplyFixes" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_apply_fixes_return + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetApplyFixes x + | "RetContributions" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_contributions + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetContributions x + | "RetFormatter" -> + 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; + `RetFormatter x + | "RetSarifFormat" -> + 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; + `RetSarifFormat x + | "RetValidate" -> + 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_bool + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetValidate x + | "RetResolveDependencies" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__dependency_source_resolution_result_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetResolveDependencies x + | "RetUploadSymbolAnalysis" -> + 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; + `RetUploadSymbolAnalysis x + | "RetDumpRulePartitions" -> + 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_bool + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetDumpRulePartitions x + | "RetTransitiveReachabilityFilter" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__transitive_finding_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetTransitiveReachabilityFilter x + | "RetGetTargets" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_target_discovery_result + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `RetGetTargets x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _metavars_option_of_string s = - read__metavars_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_match_extra : _ -> cli_match_extra -> _ = ( - fun ob (x : cli_match_extra) -> +let function_return_of_string s = + read_function_return (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_format_context : _ -> format_context -> _ = ( + fun ob (x : format_context) -> Buffer.add_char ob '{'; let is_first = ref true in - (match x.metavars with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metavars\":"; - ( - write_metavars - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; - ( - Yojson.Safe.write_string - ) - ob x.message; - (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.fixed_lines with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fixed_lines\":"; - ( - write__string_list - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metadata\":"; - ( - write_raw_json - ) - ob x.metadata; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"severity\":"; + Buffer.add_string ob "\"is_ci_invocation\":"; ( - write_match_severity + Yojson.Safe.write_bool ) - ob x.severity; + ob x.is_ci_invocation; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"fingerprint\":"; + Buffer.add_string ob "\"is_logged_in\":"; ( - Yojson.Safe.write_string + Yojson.Safe.write_bool ) - ob x.fingerprint; + ob x.is_logged_in; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"lines\":"; + Buffer.add_string ob "\"is_using_registry\":"; ( - Yojson.Safe.write_string - ) - ob x.lines; - (match x.is_ignored with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"is_ignored\":"; - ( - Yojson.Safe.write_bool - ) - ob x; - ); - (match x.sca_info with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"sca_info\":"; - ( - 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.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.engine_kind with None -> () | Some 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; - ); - (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_cli_match_extra ?(len = 1024) x = - let ob = Buffer.create len in - write_cli_match_extra ob x; - Buffer.contents ob -let read_cli_match_extra = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_metavars = ref (None) in - let field_message = ref (None) in - let field_fix = ref (None) in - let field_fixed_lines = ref (None) in - let field_metadata = ref (None) in - let field_severity = ref (None) in - let field_fingerprint = ref (None) in - let field_lines = ref (None) in - let field_is_ignored = ref (None) in - let field_sca_info = ref (None) in - let field_validation_state = ref (None) in - let field_historical_info = ref (None) in - let field_dataflow_trace = ref (None) in - let field_engine_kind = ref (None) in - let field_extra_extra = ref (None) in + Yojson.Safe.write_bool + ) + ob x.is_using_registry; + Buffer.add_char ob '}'; +) +let string_of_format_context ?(len = 1024) x = + let ob = Buffer.create len in + write_format_context ob x; + Buffer.contents ob +let read_format_context = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_is_ci_invocation = ref (None) in + let field_is_logged_in = ref (None) in + let field_is_using_registry = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -33936,167 +35123,25 @@ let read_cli_match_extra = ( 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 ( - 2 - ) - else ( - -1 - ) - ) - | 5 -> ( - 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) = 's' then ( - 7 - ) - 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 ( + | 12 -> ( + 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) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'g' && 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) = 'i' && String.unsafe_get s (pos+11) = 'n' then ( 1 ) 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 ( - 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 - ) - ) - | 's' -> ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if 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 - ) - ) - | _ -> ( - -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 ( - 8 - ) - else ( - -1 - ) - ) - | 11 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - 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 ( - 13 - ) - 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 ( - 14 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' then ( - match String.unsafe_get s (pos+2) with - | 'n' -> ( - if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -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 ( - 12 - ) - 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 ( - 11 + | 16 -> ( + 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) = 'c' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' then ( + 0 ) 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 ( - 10 + | 17 -> ( + 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) = 'u' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'y' then ( + 2 ) else ( -1 @@ -34111,145 +35156,29 @@ let read_cli_match_extra = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - ) - | 1 -> - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fixed_lines := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 4 -> - field_metadata := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - | 5 -> - field_severity := ( + field_is_ci_invocation := ( Some ( ( - read_match_severity + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 6 -> - field_fingerprint := ( + | 1 -> + field_is_logged_in := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 7 -> - field_lines := ( + | 2 -> + field_is_using_registry := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sca_info := ( - Some ( - ( - read_sca_match - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( - Some ( - ( - read_validation_state - ) p lb - ) - ); - ) - | 11 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( - Some ( - ( - read_historical_info - ) p lb - ) - ); - ) - | 12 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( - Some ( - ( - read_match_dataflow_trace - ) p lb - ) - ); - ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_kind := ( - Some ( - ( - read_engine_of_finding - ) p lb - ) - ); - ) - | 14 -> - 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 ) @@ -34263,167 +35192,255 @@ let read_cli_match_extra = ( 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 ( - 2 + | 12 -> ( + 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) = 'l' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'g' && 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) = 'i' && String.unsafe_get s (pos+11) = 'n' then ( + 1 ) else ( -1 ) ) - | 5 -> ( - 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) = 's' then ( - 7 + | 16 -> ( + 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) = 'c' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'c' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'i' && String.unsafe_get s (pos+14) = 'o' && String.unsafe_get s (pos+15) = 'n' then ( + 0 ) 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 ( - 1 + | 17 -> ( + 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) = 'u' && String.unsafe_get s (pos+4) = 's' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'g' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'g' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 's' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'y' then ( + 2 ) 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 ( - 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 - ) - ) - | 's' -> ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if 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 - ) - ) - | _ -> ( - -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_is_ci_invocation := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 1 -> + field_is_logged_in := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | 2 -> + field_is_using_registry := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + done; + assert false; + with Yojson.End_of_object -> ( + ( + { + is_ci_invocation = (match !field_is_ci_invocation with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_ci_invocation"); + is_logged_in = (match !field_is_logged_in with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_logged_in"); + is_using_registry = (match !field_is_using_registry with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "is_using_registry"); + } + : format_context) + ) +) +let format_context_of_string s = + read_format_context (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_edit : _ -> edit -> _ = ( + fun ob (x : edit) -> + 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_offset\":"; + ( + Yojson.Safe.write_int + ) + ob x.start_offset; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"end_offset\":"; + ( + Yojson.Safe.write_int + ) + ob x.end_offset; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"replacement_text\":"; + ( + Yojson.Safe.write_string + ) + ob x.replacement_text; + Buffer.add_char ob '}'; +) +let string_of_edit ?(len = 1024) x = + let ob = Buffer.create len in + write_edit ob x; + Buffer.contents ob +let read_edit = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_path = ref (None) in + let field_start_offset = ref (None) in + let field_end_offset = ref (None) in + let field_replacement_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); + 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 + ) + ) + | 10 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' then ( + 2 + ) + else ( + -1 + ) + ) + | 12 -> ( + 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) = 'o' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 't' then ( + 1 + ) + else ( + -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 ( - 8 + ) + | 16 -> ( + 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) = 'l' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' 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_path := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 1 -> + field_start_offset := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_end_offset := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 3 -> + field_replacement_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); + 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 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - 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 ( - 13 - ) - 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 ( - 14 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' then ( - match String.unsafe_get s (pos+2) with - | 'n' -> ( - if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -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 ( - 12 + | 10 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 't' then ( + 2 ) 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 ( - 11 + | 12 -> ( + 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) = 'o' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'f' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 't' then ( + 1 ) 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 ( - 10 + 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) = 'l' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'e' && String.unsafe_get s (pos+14) = 'x' && String.unsafe_get s (pos+15) = 't' then ( + 3 ) else ( -1 @@ -34438,145 +35455,37 @@ let read_cli_match_extra = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - ) - | 1 -> - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fixed_lines := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 4 -> - field_metadata := ( + field_path := ( Some ( ( - read_raw_json + read_fpath ) p lb ) ); - | 5 -> - field_severity := ( + | 1 -> + field_start_offset := ( Some ( ( - read_match_severity + Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 6 -> - field_fingerprint := ( + | 2 -> + field_end_offset := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_int ) p lb ) ); - | 7 -> - field_lines := ( + | 3 -> + field_replacement_text := ( Some ( ( Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sca_info := ( - Some ( - ( - read_sca_match - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( - Some ( - ( - read_validation_state - ) p lb - ) - ); - ) - | 11 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( - Some ( - ( - read_historical_info - ) p lb - ) - ); - ) - | 12 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( - Some ( - ( - read_match_dataflow_trace - ) p lb - ) - ); - ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_kind := ( - Some ( - ( - read_engine_of_finding - ) p lb - ) - ); - ) - | 14 -> - 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 ) @@ -34586,91 +35495,60 @@ let read_cli_match_extra = ( with Yojson.End_of_object -> ( ( { - metavars = !field_metavars; - message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); - fix = !field_fix; - fixed_lines = !field_fixed_lines; - metadata = (match !field_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metadata"); - severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); - fingerprint = (match !field_fingerprint with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fingerprint"); - lines = (match !field_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lines"); - is_ignored = !field_is_ignored; - sca_info = !field_sca_info; - validation_state = !field_validation_state; - historical_info = !field_historical_info; - dataflow_trace = !field_dataflow_trace; - engine_kind = !field_engine_kind; - extra_extra = !field_extra_extra; + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + start_offset = (match !field_start_offset with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start_offset"); + end_offset = (match !field_end_offset with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_offset"); + replacement_text = (match !field_replacement_text with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "replacement_text"); } - : cli_match_extra) + : edit) ) ) -let cli_match_extra_of_string s = - read_cli_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_match : _ -> cli_match -> _ = ( - fun ob (x : cli_match) -> +let edit_of_string s = + read_edit (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_dump_rule_partitions_params : _ -> dump_rule_partitions_params -> _ = ( + fun ob (x : dump_rule_partitions_params) -> 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\":"; + Buffer.add_string ob "\"rules\":"; ( - write_position + write_raw_json ) - ob x.start; + ob x.rules; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"end\":"; + Buffer.add_string ob "\"n_partitions\":"; ( - write_position + Yojson.Safe.write_int ) - ob x.end_; + ob x.n_partitions; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"extra\":"; + Buffer.add_string ob "\"output_dir\":"; ( - write_cli_match_extra + write_fpath ) - ob x.extra; + ob x.output_dir; Buffer.add_char ob '}'; ) -let string_of_cli_match ?(len = 1024) x = +let string_of_dump_rule_partitions_params ?(len = 1024) x = let ob = Buffer.create len in - write_cli_match ob x; + write_dump_rule_partitions_params ob x; Buffer.contents ob -let read_cli_match = ( +let read_dump_rule_partitions_params = ( 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 + let field_rules = ref (None) in + let field_n_partitions = ref (None) in + let field_output_dir = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -34680,47 +35558,25 @@ let read_cli_match = ( 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 + | 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 ) ) - | 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 + | 10 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' then ( + 2 ) 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 + | 12 -> ( + if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = '_' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 's' then ( + 1 ) else ( -1 @@ -34735,42 +35591,26 @@ let read_cli_match = ( ( match i with | 0 -> - field_check_id := ( + field_rules := ( Some ( ( - read_rule_id + read_raw_json ) p lb ) ); | 1 -> - field_path := ( + field_n_partitions := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_start := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 4 -> - field_extra := ( + field_output_dir := ( Some ( ( - read_cli_match_extra + read_fpath ) p lb ) ); @@ -34787,47 +35627,25 @@ let read_cli_match = ( 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 + | 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 ) ) - | 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 + | 10 -> ( + if String.unsafe_get s pos = 'o' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'u' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'r' then ( + 2 ) 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 + | 12 -> ( + if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = '_' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = 's' then ( + 1 ) else ( -1 @@ -34842,42 +35660,26 @@ let read_cli_match = ( ( match i with | 0 -> - field_check_id := ( + field_rules := ( Some ( ( - read_rule_id + read_raw_json ) p lb ) ); | 1 -> - field_path := ( + field_n_partitions := ( Some ( ( - read_fpath + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 2 -> - field_start := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 4 -> - field_extra := ( + field_output_dir := ( Some ( ( - read_cli_match_extra + read_fpath ) p lb ) ); @@ -34890,17 +35692,15 @@ let read_cli_match = ( 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"); + rules = (match !field_rules with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rules"); + n_partitions = (match !field_n_partitions with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "n_partitions"); + output_dir = (match !field_output_dir with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "output_dir"); } - : cli_match) + : dump_rule_partitions_params) ) ) -let cli_match_of_string s = - read_cli_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let dump_rule_partitions_params_of_string s = + read_dump_rule_partitions_params (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__skipped_rule_list = ( Atdgen_runtime.Oj_run.write_list ( write_skipped_rule @@ -35161,22 +35961,6 @@ let read__engine_kind_option = ( ) let _engine_kind_option_of_string s = read__engine_kind_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__cli_match_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_cli_match - ) -) -let string_of__cli_match_list ?(len = 1024) x = - let ob = Buffer.create len in - write__cli_match_list ob x; - Buffer.contents ob -let read__cli_match_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_cli_match - ) -) -let _cli_match_list_of_string s = - read__cli_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_cli_output : _ -> cli_output -> _ = ( fun ob (x : cli_output) -> Buffer.add_char ob '{'; diff --git a/semgrep_output_v1_j.mli b/semgrep_output_v1_j.mli index fd090fbb..a84656ae 100644 --- a/semgrep_output_v1_j.mli +++ b/semgrep_output_v1_j.mli @@ -347,6 +347,56 @@ type transitive_reachability_filter_params = dependencies: resolved_dependency list } +type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { + metavars: metavars option; + message: string; + fix: string option; + fixed_lines: string list option; + metadata: raw_json; + severity: match_severity; + fingerprint: string; + lines: string; + is_ignored: bool option; + sca_info: sca_match option; + validation_state: validation_state option; + historical_info: historical_info option; + dataflow_trace: match_dataflow_trace option; + engine_kind: engine_of_finding option; + extra_extra: raw_json option +} + +type cli_match = Semgrep_output_v1_t.cli_match = { + check_id: rule_id; + path: fpath; + start: position; + end_ (*atd end *): position; + extra: cli_match_extra +} + +type tr_cache_match_result = Semgrep_output_v1_t.tr_cache_match_result = { + matches: cli_match list +} + +type tr_cache_key = Semgrep_output_v1_t.tr_cache_key = { + rule_id: rule_id; + rule_version: string; + engine_version: int; + package_url: string; + extra: string +} + +type tr_query_cache_response = Semgrep_output_v1_t.tr_query_cache_response = { + cached: (tr_cache_key * tr_cache_match_result) list +} + +type tr_query_cache_request = Semgrep_output_v1_t.tr_query_cache_request = { + entries: tr_cache_key list +} + +type tr_add_cache_request = Semgrep_output_v1_t.tr_add_cache_request = { + new_entries: (tr_cache_key * tr_cache_match_result) list +} + type todo = Semgrep_output_v1_t.todo type matching_diagnosis = Semgrep_output_v1_t.matching_diagnosis = { @@ -895,32 +945,6 @@ type dump_rule_partitions_params = output_dir: fpath } -type cli_match_extra = Semgrep_output_v1_t.cli_match_extra = { - metavars: metavars option; - message: string; - fix: string option; - fixed_lines: string list option; - metadata: raw_json; - severity: match_severity; - fingerprint: string; - lines: string; - is_ignored: bool option; - sca_info: sca_match option; - validation_state: validation_state option; - historical_info: historical_info option; - dataflow_trace: match_dataflow_trace option; - engine_kind: engine_of_finding option; - extra_extra: raw_json option -} - -type cli_match = Semgrep_output_v1_t.cli_match = { - check_id: rule_id; - path: fpath; - start: position; - end_ (*atd end *): position; - extra: cli_match_extra -} - type cli_output = Semgrep_output_v1_t.cli_output = { version: version option; results: cli_match list; @@ -2312,6 +2336,146 @@ val transitive_reachability_filter_params_of_string : string -> transitive_reachability_filter_params (** Deserialize JSON data of type {!type:transitive_reachability_filter_params}. *) +val write_cli_match_extra : + Buffer.t -> cli_match_extra -> unit + (** Output a JSON value of type {!type:cli_match_extra}. *) + +val string_of_cli_match_extra : + ?len:int -> cli_match_extra -> string + (** Serialize a value of type {!type:cli_match_extra} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_cli_match_extra : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> cli_match_extra + (** Input JSON data of type {!type:cli_match_extra}. *) + +val cli_match_extra_of_string : + string -> cli_match_extra + (** Deserialize JSON data of type {!type:cli_match_extra}. *) + +val write_cli_match : + Buffer.t -> cli_match -> unit + (** Output a JSON value of type {!type:cli_match}. *) + +val string_of_cli_match : + ?len:int -> cli_match -> string + (** Serialize a value of type {!type:cli_match} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_cli_match : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> cli_match + (** Input JSON data of type {!type:cli_match}. *) + +val cli_match_of_string : + string -> cli_match + (** Deserialize JSON data of type {!type:cli_match}. *) + +val write_tr_cache_match_result : + Buffer.t -> tr_cache_match_result -> unit + (** Output a JSON value of type {!type:tr_cache_match_result}. *) + +val string_of_tr_cache_match_result : + ?len:int -> tr_cache_match_result -> string + (** Serialize a value of type {!type:tr_cache_match_result} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_tr_cache_match_result : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> tr_cache_match_result + (** Input JSON data of type {!type:tr_cache_match_result}. *) + +val tr_cache_match_result_of_string : + string -> tr_cache_match_result + (** Deserialize JSON data of type {!type:tr_cache_match_result}. *) + +val write_tr_cache_key : + Buffer.t -> tr_cache_key -> unit + (** Output a JSON value of type {!type:tr_cache_key}. *) + +val string_of_tr_cache_key : + ?len:int -> tr_cache_key -> string + (** Serialize a value of type {!type:tr_cache_key} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_tr_cache_key : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> tr_cache_key + (** Input JSON data of type {!type:tr_cache_key}. *) + +val tr_cache_key_of_string : + string -> tr_cache_key + (** Deserialize JSON data of type {!type:tr_cache_key}. *) + +val write_tr_query_cache_response : + Buffer.t -> tr_query_cache_response -> unit + (** Output a JSON value of type {!type:tr_query_cache_response}. *) + +val string_of_tr_query_cache_response : + ?len:int -> tr_query_cache_response -> string + (** Serialize a value of type {!type:tr_query_cache_response} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_tr_query_cache_response : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> tr_query_cache_response + (** Input JSON data of type {!type:tr_query_cache_response}. *) + +val tr_query_cache_response_of_string : + string -> tr_query_cache_response + (** Deserialize JSON data of type {!type:tr_query_cache_response}. *) + +val write_tr_query_cache_request : + Buffer.t -> tr_query_cache_request -> unit + (** Output a JSON value of type {!type:tr_query_cache_request}. *) + +val string_of_tr_query_cache_request : + ?len:int -> tr_query_cache_request -> string + (** Serialize a value of type {!type:tr_query_cache_request} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_tr_query_cache_request : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> tr_query_cache_request + (** Input JSON data of type {!type:tr_query_cache_request}. *) + +val tr_query_cache_request_of_string : + string -> tr_query_cache_request + (** Deserialize JSON data of type {!type:tr_query_cache_request}. *) + +val write_tr_add_cache_request : + Buffer.t -> tr_add_cache_request -> unit + (** Output a JSON value of type {!type:tr_add_cache_request}. *) + +val string_of_tr_add_cache_request : + ?len:int -> tr_add_cache_request -> string + (** Serialize a value of type {!type:tr_add_cache_request} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_tr_add_cache_request : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> tr_add_cache_request + (** Input JSON data of type {!type:tr_add_cache_request}. *) + +val tr_add_cache_request_of_string : + string -> tr_add_cache_request + (** Deserialize JSON data of type {!type:tr_add_cache_request}. *) + val write_todo : Buffer.t -> todo -> unit (** Output a JSON value of type {!type:todo}. *) @@ -3952,46 +4116,6 @@ val dump_rule_partitions_params_of_string : string -> dump_rule_partitions_params (** Deserialize JSON data of type {!type:dump_rule_partitions_params}. *) -val write_cli_match_extra : - Buffer.t -> cli_match_extra -> unit - (** Output a JSON value of type {!type:cli_match_extra}. *) - -val string_of_cli_match_extra : - ?len:int -> cli_match_extra -> string - (** Serialize a value of type {!type:cli_match_extra} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_cli_match_extra : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> cli_match_extra - (** Input JSON data of type {!type:cli_match_extra}. *) - -val cli_match_extra_of_string : - string -> cli_match_extra - (** Deserialize JSON data of type {!type:cli_match_extra}. *) - -val write_cli_match : - Buffer.t -> cli_match -> unit - (** Output a JSON value of type {!type:cli_match}. *) - -val string_of_cli_match : - ?len:int -> cli_match -> string - (** Serialize a value of type {!type:cli_match} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_cli_match : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> cli_match - (** Input JSON data of type {!type:cli_match}. *) - -val cli_match_of_string : - string -> cli_match - (** Deserialize JSON data of type {!type:cli_match}. *) - val write_cli_output : Buffer.t -> cli_output -> unit (** Output a JSON value of type {!type:cli_output}. *)