From 724cfcc95090db2c58cb146046217f437bcfeaf2 Mon Sep 17 00:00:00 2001 From: "Amarin (Um) Phaosawasdi" Date: Tue, 24 Sep 2024 14:18:47 -0700 Subject: [PATCH] add rpc interface for dump rule partitions (#293) Closes [SMS-498](https://linear.app/semgrep/issue/SMS-498). Context is in the ticket. - [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.17.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades --- semgrep_output_v1.atd | 11 +- semgrep_output_v1.jsonschema | 26 ++++ semgrep_output_v1.proto | 8 +- semgrep_output_v1.py | 78 ++++++++++- semgrep_output_v1.ts | 32 +++++ semgrep_output_v1_j.ml | 255 +++++++++++++++++++++++++++++++++++ semgrep_output_v1_j.mli | 27 ++++ 7 files changed, 432 insertions(+), 5 deletions(-) diff --git a/semgrep_output_v1.atd b/semgrep_output_v1.atd index b5ebcf28..b4b58f09 100644 --- a/semgrep_output_v1.atd +++ b/semgrep_output_v1.atd @@ -1801,7 +1801,7 @@ type sarif_format_return * performace when needed. *) format_time_seconds: float; - } +} (* TODO: merge with src/osemgrep/reporting/Output_format.ml *) type output_format = [ @@ -1820,7 +1820,6 @@ type manifest = { path: fpath; } - type resolution_error = [ | UnsupportedManifest @@ -1842,6 +1841,12 @@ type resolution_result = [ | ResolutionError of resolution_error ] +type dump_rule_partitions_params = { + rules: raw_json; + n_partitions: int; + output_dir: fpath; +} + type function_call = [ | CallContributions @@ -1854,6 +1859,7 @@ type function_call *) | CallValidate of fpath | CallResolveDependencies of manifest list + | CallDumpRulePartitions of dump_rule_partitions_params ] type function_return @@ -1865,4 +1871,5 @@ type function_return | RetFormatter of string | RetValidate of bool | RetResolveDependencies of (manifest * resolution_result) list + | RetDumpRulePartitions of bool ] diff --git a/semgrep_output_v1.jsonschema b/semgrep_output_v1.jsonschema index 56f3eafd..38030c77 100644 --- a/semgrep_output_v1.jsonschema +++ b/semgrep_output_v1.jsonschema @@ -1579,6 +1579,15 @@ } ] }, + "dump_rule_partitions_params": { + "type": "object", + "required": [ "rules", "n_partitions", "output_dir" ], + "properties": { + "rules": { "$ref": "#/definitions/raw_json" }, + "n_partitions": { "type": "integer" }, + "output_dir": { "$ref": "#/definitions/fpath" } + } + }, "function_call": { "oneOf": [ { "const": "CallContributions" }, @@ -1636,6 +1645,15 @@ "items": { "$ref": "#/definitions/manifest" } } ] + }, + { + "type": "array", + "minItems": 2, + "items": false, + "prefixItems": [ + { "const": "CallDumpRulePartitions" }, + { "$ref": "#/definitions/dump_rule_partitions_params" } + ] } ] }, @@ -1709,6 +1727,14 @@ } } ] + }, + { + "type": "array", + "minItems": 2, + "items": false, + "prefixItems": [ + { "const": "RetDumpRulePartitions" }, { "type": "boolean" } + ] } ] } diff --git a/semgrep_output_v1.proto b/semgrep_output_v1.proto index fe941f2a..ece49949 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: cc08fc3aa1ff64080a21d1af8ca00c3353645cc4dd69d6bd82d958ef11b8b44e +// Source file sha256 digest: f8b4fafe802498d2a103d8d1ce6bd83d8091363ac9a4fdc2a7fb0d8b186aa75e syntax = "proto3"; @@ -629,3 +629,9 @@ message ResolutionCmdFailed { string message = 337998899; } +message DumpRulePartitionsParams { + google.protobuf.Any rules = 109321335; + int64 n_partitions = 177783558; + string output_dir = 454772709; +} + diff --git a/semgrep_output_v1.py b/semgrep_output_v1.py index 8a8257bc..96025337 100644 --- a/semgrep_output_v1.py +++ b/semgrep_output_v1.py @@ -6378,11 +6378,29 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass(frozen=True) +class RetDumpRulePartitions: + """Original type: function_return = [ ... | RetDumpRulePartitions of ... | ... ]""" + + value: bool + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'RetDumpRulePartitions' + + def to_json(self) -> Any: + return ['RetDumpRulePartitions', _atd_write_bool(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass(frozen=True) class FunctionReturn: """Original type: function_return = [ ... ]""" - value: Union[RetError, RetApplyFixes, RetSarifFormat, RetContributions, RetFormatter, RetValidate, RetResolveDependencies] + value: Union[RetError, RetApplyFixes, RetSarifFormat, RetContributions, RetFormatter, RetValidate, RetResolveDependencies, RetDumpRulePartitions] @property def kind(self) -> str: @@ -6407,6 +6425,8 @@ def from_json(cls, x: Any) -> 'FunctionReturn': return cls(RetValidate(_atd_read_bool(x[1]))) if cons == 'RetResolveDependencies': return cls(RetResolveDependencies(_atd_read_list((lambda x: (Manifest.from_json(x[0]), ResolutionResult.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x[1]))) + if cons == 'RetDumpRulePartitions': + return cls(RetDumpRulePartitions(_atd_read_bool(x[1]))) _atd_bad_json('FunctionReturn', x) _atd_bad_json('FunctionReturn', x) @@ -6458,6 +6478,40 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass +class DumpRulePartitionsParams: + """Original type: dump_rule_partitions_params = { ... }""" + + rules: RawJson + n_partitions: int + output_dir: Fpath + + @classmethod + def from_json(cls, x: Any) -> 'DumpRulePartitionsParams': + if isinstance(x, dict): + return cls( + rules=RawJson.from_json(x['rules']) if 'rules' in x else _atd_missing_json_field('DumpRulePartitionsParams', 'rules'), + n_partitions=_atd_read_int(x['n_partitions']) if 'n_partitions' in x else _atd_missing_json_field('DumpRulePartitionsParams', 'n_partitions'), + output_dir=Fpath.from_json(x['output_dir']) if 'output_dir' in x else _atd_missing_json_field('DumpRulePartitionsParams', 'output_dir'), + ) + else: + _atd_bad_json('DumpRulePartitionsParams', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['rules'] = (lambda x: x.to_json())(self.rules) + res['n_partitions'] = _atd_write_int(self.n_partitions) + res['output_dir'] = (lambda x: x.to_json())(self.output_dir) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'DumpRulePartitionsParams': + 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 = { ... }""" @@ -6657,11 +6711,29 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass(frozen=True) +class CallDumpRulePartitions: + """Original type: function_call = [ ... | CallDumpRulePartitions of ... | ... ]""" + + value: DumpRulePartitionsParams + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'CallDumpRulePartitions' + + def to_json(self) -> Any: + return ['CallDumpRulePartitions', (lambda x: x.to_json())(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass(frozen=True) class FunctionCall: """Original type: function_call = [ ... ]""" - value: Union[CallContributions, CallApplyFixes, CallSarifFormat, CallFormatter, CallValidate, CallResolveDependencies] + value: Union[CallContributions, CallApplyFixes, CallSarifFormat, CallFormatter, CallValidate, CallResolveDependencies, CallDumpRulePartitions] @property def kind(self) -> str: @@ -6686,6 +6758,8 @@ def from_json(cls, x: Any) -> 'FunctionCall': return cls(CallValidate(Fpath.from_json(x[1]))) if cons == 'CallResolveDependencies': return cls(CallResolveDependencies(_atd_read_list(Manifest.from_json)(x[1]))) + if cons == 'CallDumpRulePartitions': + return cls(CallDumpRulePartitions(DumpRulePartitionsParams.from_json(x[1]))) _atd_bad_json('FunctionCall', x) _atd_bad_json('FunctionCall', x) diff --git a/semgrep_output_v1.ts b/semgrep_output_v1.ts index 8ffd9da1..5f571126 100644 --- a/semgrep_output_v1.ts +++ b/semgrep_output_v1.ts @@ -852,6 +852,12 @@ export type ResolutionResult = | { kind: 'ResolutionOk'; value: FoundDependency[] } | { kind: 'ResolutionError'; value: ResolutionError } +export type DumpRulePartitionsParams = { + rules: RawJson; + n_partitions: number /*int*/; + output_dir: Fpath; +} + export type FunctionCall = | { kind: 'CallContributions' } | { kind: 'CallApplyFixes'; value: ApplyFixesParams } @@ -859,6 +865,7 @@ export type FunctionCall = | { kind: 'CallFormatter'; value: [OutputFormat, CliOutput] } | { kind: 'CallValidate'; value: Fpath } | { kind: 'CallResolveDependencies'; value: Manifest[] } +| { kind: 'CallDumpRulePartitions'; value: DumpRulePartitionsParams } export type FunctionReturn = | { kind: 'RetError'; value: string } @@ -868,6 +875,7 @@ export type FunctionReturn = | { kind: 'RetFormatter'; value: string } | { kind: 'RetValidate'; value: boolean } | { kind: 'RetResolveDependencies'; value: [Manifest, ResolutionResult][] } +| { kind: 'RetDumpRulePartitions'; value: boolean } export function writeRawJson(x: RawJson, context: any = x): any { return ((x: any, context): any => x)(x, context); @@ -3468,6 +3476,22 @@ export function readResolutionResult(x: any, context: any = x): ResolutionResult } } +export function writeDumpRulePartitionsParams(x: DumpRulePartitionsParams, context: any = x): any { + return { + 'rules': _atd_write_required_field('DumpRulePartitionsParams', 'rules', writeRawJson, x.rules, x), + 'n_partitions': _atd_write_required_field('DumpRulePartitionsParams', 'n_partitions', _atd_write_int, x.n_partitions, x), + 'output_dir': _atd_write_required_field('DumpRulePartitionsParams', 'output_dir', writeFpath, x.output_dir, x), + }; +} + +export function readDumpRulePartitionsParams(x: any, context: any = x): DumpRulePartitionsParams { + return { + rules: _atd_read_required_field('DumpRulePartitionsParams', 'rules', readRawJson, x['rules'], x), + n_partitions: _atd_read_required_field('DumpRulePartitionsParams', 'n_partitions', _atd_read_int, x['n_partitions'], x), + output_dir: _atd_read_required_field('DumpRulePartitionsParams', 'output_dir', readFpath, x['output_dir'], x), + }; +} + export function writeFunctionCall(x: FunctionCall, context: any = x): any { switch (x.kind) { case 'CallContributions': @@ -3482,6 +3506,8 @@ export function writeFunctionCall(x: FunctionCall, context: any = x): any { return ['CallValidate', writeFpath(x.value, x)] case 'CallResolveDependencies': return ['CallResolveDependencies', _atd_write_array(writeManifest)(x.value, x)] + case 'CallDumpRulePartitions': + return ['CallDumpRulePartitions', writeDumpRulePartitionsParams(x.value, x)] } } @@ -3508,6 +3534,8 @@ export function readFunctionCall(x: any, context: any = x): FunctionCall { return { kind: 'CallValidate', value: readFpath(x[1], x) } case 'CallResolveDependencies': return { kind: 'CallResolveDependencies', value: _atd_read_array(readManifest)(x[1], x) } + case 'CallDumpRulePartitions': + return { kind: 'CallDumpRulePartitions', value: readDumpRulePartitionsParams(x[1], x) } default: _atd_bad_json('FunctionCall', x, context) throw new Error('impossible') @@ -3531,6 +3559,8 @@ export function writeFunctionReturn(x: FunctionReturn, context: any = x): any { return ['RetValidate', _atd_write_bool(x.value, x)] case 'RetResolveDependencies': return ['RetResolveDependencies', _atd_write_array(((x, context) => [writeManifest(x[0], x), writeResolutionResult(x[1], x)]))(x.value, x)] + case 'RetDumpRulePartitions': + return ['RetDumpRulePartitions', _atd_write_bool(x.value, x)] } } @@ -3551,6 +3581,8 @@ export function readFunctionReturn(x: any, context: any = x): FunctionReturn { return { kind: 'RetValidate', value: _atd_read_bool(x[1], x) } case 'RetResolveDependencies': return { kind: 'RetResolveDependencies', value: _atd_read_array(((x, context): [Manifest, ResolutionResult] => { _atd_check_json_tuple(2, x, context); return [readManifest(x[0], x), readResolutionResult(x[1], x)] }))(x[1], x) } + case 'RetDumpRulePartitions': + return { kind: 'RetDumpRulePartitions', value: _atd_read_bool(x[1], x) } default: _atd_bad_json('FunctionReturn', x, context) throw new Error('impossible') diff --git a/semgrep_output_v1_j.ml b/semgrep_output_v1_j.ml index 89338fa9..8c331a2d 100644 --- a/semgrep_output_v1_j.ml +++ b/semgrep_output_v1_j.ml @@ -599,6 +599,13 @@ type edit = Semgrep_output_v1_t.edit = { replacement_text: string } +type dump_rule_partitions_params = + Semgrep_output_v1_t.dump_rule_partitions_params = { + rules: raw_json; + n_partitions: int; + output_dir: fpath +} + type cli_output = Semgrep_output_v1_t.cli_output = { version: version option; errors: cli_error list; @@ -23159,6 +23166,12 @@ let write_function_return = ( write__manifest_resolution_result_list ) ob x; Buffer.add_char ob ']' + | `RetDumpRulePartitions x -> + Buffer.add_string ob "[\"RetDumpRulePartitions\","; + ( + Yojson.Safe.write_bool + ) ob x; + Buffer.add_char ob ']' ) let string_of_function_return ?(len = 1024) x = let ob = Buffer.create len in @@ -23233,6 +23246,15 @@ let read_function_return = ( Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `RetResolveDependencies 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 | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) @@ -23320,6 +23342,17 @@ let read_function_return = ( Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `RetResolveDependencies 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 | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) @@ -23565,6 +23598,202 @@ let read_edit = ( ) 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 "\"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\":"; + ( + Yojson.Safe.write_int + ) + ob x.n_partitions; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"output_dir\":"; + ( + write_fpath + ) + ob x.output_dir; + Buffer.add_char ob '}'; +) +let string_of_dump_rule_partitions_params ?(len = 1024) x = + let ob = Buffer.create len in + write_dump_rule_partitions_params ob x; + Buffer.contents ob +let read_dump_rule_partitions_params = ( + 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 + 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 + ) + ) + | 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 + ) + ) + | 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 + ) + ) + | _ -> ( + -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 -> + field_n_partitions := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_output_dir := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | _ -> ( + Yojson.Safe.skip_json p lb + ) + ); + while true do + Yojson.Safe.read_space p lb; + Yojson.Safe.read_object_sep p lb; + Yojson.Safe.read_space p lb; + let f = + fun s pos len -> + if pos < 0 || len < 0 || pos + len > String.length s then + invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); + match len with + | 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 + ) + 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 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_rules := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + | 1 -> + field_n_partitions := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_int + ) p lb + ) + ); + | 2 -> + field_output_dir := ( + Some ( + ( + read_fpath + ) 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"); + 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__skipped_rule_list = ( Atdgen_runtime.Oj_run.write_list ( write_skipped_rule @@ -24602,6 +24831,12 @@ let write_function_call = ( write__manifest_list ) ob x; Buffer.add_char ob ']' + | `CallDumpRulePartitions x -> + Buffer.add_string ob "[\"CallDumpRulePartitions\","; + ( + write_dump_rule_partitions_params + ) ob x; + Buffer.add_char ob ']' ) let string_of_function_call ?(len = 1024) x = let ob = Buffer.create len in @@ -24703,6 +24938,15 @@ let read_function_call = ( Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; `CallResolveDependencies x + | "CallDumpRulePartitions" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_dump_rule_partitions_params + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `CallDumpRulePartitions x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) @@ -24811,6 +25055,17 @@ let read_function_call = ( Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; `CallResolveDependencies x + | "CallDumpRulePartitions" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_dump_rule_partitions_params + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + `CallDumpRulePartitions x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) diff --git a/semgrep_output_v1_j.mli b/semgrep_output_v1_j.mli index 8f18a612..fa6276b6 100644 --- a/semgrep_output_v1_j.mli +++ b/semgrep_output_v1_j.mli @@ -599,6 +599,13 @@ type edit = Semgrep_output_v1_t.edit = { replacement_text: string } +type dump_rule_partitions_params = + Semgrep_output_v1_t.dump_rule_partitions_params = { + rules: raw_json; + n_partitions: int; + output_dir: fpath +} + type cli_output = Semgrep_output_v1_t.cli_output = { version: version option; errors: cli_error list; @@ -2796,6 +2803,26 @@ val edit_of_string : string -> edit (** Deserialize JSON data of type {!type:edit}. *) +val write_dump_rule_partitions_params : + Buffer.t -> dump_rule_partitions_params -> unit + (** Output a JSON value of type {!type:dump_rule_partitions_params}. *) + +val string_of_dump_rule_partitions_params : + ?len:int -> dump_rule_partitions_params -> string + (** Serialize a value of type {!type:dump_rule_partitions_params} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_dump_rule_partitions_params : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> dump_rule_partitions_params + (** Input JSON data of type {!type:dump_rule_partitions_params}. *) + +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_output : Buffer.t -> cli_output -> unit (** Output a JSON value of type {!type:cli_output}. *)