OS Manuals

/usr/bin/semgrep-core

Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.

From semgrep 1.184.0-r2 (enterprise-packages), captured 2026-11-08 by running semgrep-core --help (exit 0). permalink

Usage: semgrep-core [options] -rules <file> -targets <file>
Options:
  -rules  <file> obtain formula of patterns from YAML/JSON/Jsonnet file
  -targets  <file> obtain list of targets to run patterns on
  -lang  <str> choose language (valid choices:
     apex, bash, c, c#, c++, cairo, circom, clojure, cpp, csharp, dart, docker, dockerfile, elixir, ex, fga, generic, go, golang, gosu, hack, hcl, html, java, javascript, js, json, jsonnet, julia, kotlin, kt, lisp, lua, move_on_aptos, move_on_sui, none, objc, objective-c, objectivec, ocaml, openfga, php, powershell, promql, proto, proto3, protobuf, py, python, python2, python3, r, regex, ruby, rust, scala, scheme, sh, sol, solidity, swift, terraform, tf, ts, typescript, vue, xml, yaml)
  -l  <str> shortcut for -lang
  -j  <int> number of cores to use (default: automatic)
  -json  output JSON format
  -json_nodots  output JSON format but without intermediate dots
  -json_time  report detailed matching times as part of the JSON response. Implies '-json'.
  -fail_fast  stop at first exception (and get a backtrace)
  -filter_irrelevant_patterns  filter patterns not containing any strings in target file
  -no_filter_irrelevant_patterns  do not filter patterns
  -filter_irrelevant_rules  filter rules not containing any strings in target file
  -no_filter_irrelevant_rules  do not filter rules
  -fast  filter rules not containing any strings in target file
  -disable_rule_paths  do not honor the paths: directive of the rule
  -tree_sitter_only  only use tree-sitter-based parsers
  -pfff_only  only use pfff-based parsers
  -timeout  <float> maxinum time to spend running a rule on a single file (in seconds); 0 disables timeouts (default is 0)
  -timeout_threshold  <int> maximum number of rules that can timeout on a file before the file is skipped; 0 disables it (default is 0)
  -max_memory <int>  maximum memory available (in MiB); allows for clean termination when running out of memory. This value should be less than the actual memory available because the limit will be exceeded before it gets detected. Try 5% less or 15000 if you have 16 GB.
  -max_tainted_vars <int> maximum number of vars to store. This is mostly for internal use to make performance testing easier
  -max_taint_set_size <int> maximum size of a taint set. This is mostly for internal use to make performance testing easier
  -max_match_per_file  <int> maximum numbers of match per file
  -debug  output debugging information
  -strict  fail on warnings
  -debug_matching  raise an exception at the first match failure
  -matching_explanations  output intermediate matching explanations
  -log_to_file  <file> log debugging info to file
  -trace  output tracing information
  -trace_endpoint  url endpoint for collecting tracing information
  -macros  <file> list of macros to expand
  -profile  record and output profiling information to stderr
  -simple_profiling  record profiling information for inclusion in JSON results
  -show_trace_profile  show trace
  -debugger  option to set if launched inside ocamldebug
  -keep_tmp_files  keep temporary generated files
  -full_token_info  print also token information in dumper
  -check_rules  <metachecks file> <files or dirs>
  -parsing_stats  <files or dirs> generate parsing statistics (use -json for JSON output)
  -prefilter_of_rules  <file> dump the prefilter regexps of rules in JSON
  -prefilter_of_rules_interfile  <file> dump the prefilter regexps of rules in JSON
  -dump_extensions  print file extension to language mapping
  -dump_pattern  <file>
  -dump_patterns_of_rule  <file>
  -dump_ast  <file>
  -dump_lang_ast  <file>
  -dump_named_ast  <file>
  -dump_il  <file>
  -pp_il  <file> pretty-print IL in familiar-ish syntax
  -dump_rule  <file>
  -dump_tree_sitter_cst  <file> dump the CST obtained from a tree-sitter parser
  -dump_tree_sitter_pattern_cst  <file>
  -dump_pfff_ast  <file> dump the generic AST obtained from a pfff parser
  -diff_pfff_tree_sitter  <file>
  -test_parse_tree_sitter  <dir> test tree-sitter parser on target files
  -translate_rules  <files or dirs>
  -stat_rules  <files or dirs>
  -parse_rules  <dir>
  -test_eval  <JSON file>
  -sarif_sort  <JSON file>
  -rpc  don't use this unless you already know
  -typing_generic  <file>
  -constant_propagation  <file>
  -il_generic  <file>
  -cfg_il  <file>
  -dfg_svalue  <file>
  -dfg_tainting <rules> <target>
  -naming_generic  <file>
  -version   guess what
  -ocaml_version   The version of OCaml that was used to build this binary
  -use_parmap   Rely on a legacy Parmap implementation of `-j`
  -help  Display this list of options
  --help  Display this list of options
Options (70)
OptionDescriptionSource
-rules<file> obtain formula of patterns from YAML/JSON/Jsonnet filehelp
-targets<file> obtain list of targets to run patterns onhelp
-lang<str> choose language (valid choices: apex, bash, c, c#, c++, cairo, circom, clojure, cpp, csharp, dart, docker, dockerfile, elixir, ex, fga, generic, go, golang, gosu, hack, hcl, html, java,…help
-l<str> shortcut for -langhelp
-j<int> number of cores to use (default: automatic)help
-jsonoutput JSON formathelp
-json_nodotsoutput JSON format but without intermediate dotshelp
-json_timereport detailed matching times as part of the JSON response.help
-fail_faststop at first exception (and get a backtrace)help
-filter_irrelevant_patternsfilter patterns not containing any strings in target filehelp
-no_filter_irrelevant_patternsdo not filter patternshelp
-filter_irrelevant_rulesfilter rules not containing any strings in target filehelp
-no_filter_irrelevant_rulesdo not filter ruleshelp
-fastfilter rules not containing any strings in target filehelp
-disable_rule_pathsdo not honor the paths: directive of the rulehelp
-tree_sitter_onlyonly use tree-sitter-based parsershelp
-pfff_onlyonly use pfff-based parsershelp
-timeout<float> maxinum time to spend running a rule on a single file (in seconds);help
-timeout_threshold<int> maximum number of rules that can timeout on a file before the file is skipped;help
-max_memory intmaximum memory available (in MiB);help
-max_match_per_file<int> maximum numbers of match per filehelp
-debugoutput debugging informationhelp
-strictfail on warningshelp
-debug_matchingraise an exception at the first match failurehelp
-matching_explanationsoutput intermediate matching explanationshelp
-log_to_file<file> log debugging info to filehelp
-traceoutput tracing informationhelp
-trace_endpointurl endpoint for collecting tracing informationhelp
-macros<file> list of macros to expandhelp
-profilerecord and output profiling information to stderrhelp
-simple_profilingrecord profiling information for inclusion in JSON resultshelp
-show_trace_profileshow tracehelp
-debuggeroption to set if launched inside ocamldebughelp
-keep_tmp_fileskeep temporary generated fileshelp
-full_token_infoprint also token information in dumperhelp
-check_rules<metachecks file> <files or dirs>help
-parsing_stats<files or dirs> generate parsing statistics (use -json for JSON output)help
-prefilter_of_rules<file> dump the prefilter regexps of rules in JSONhelp
-prefilter_of_rules_interfile<file> dump the prefilter regexps of rules in JSONhelp
-dump_extensionsprint file extension to language mappinghelp
-dump_pattern<file>help
-dump_patterns_of_rule<file>help
-dump_ast<file>help
-dump_lang_ast<file>help
-dump_named_ast<file>help
-dump_il<file>help
-pp_il<file> pretty-print IL in familiar-ish syntaxhelp
-dump_rule<file>help
-dump_tree_sitter_cst<file> dump the CST obtained from a tree-sitter parserhelp
-dump_tree_sitter_pattern_cst<file>help
-dump_pfff_ast<file> dump the generic AST obtained from a pfff parserhelp
-diff_pfff_tree_sitter<file>help
-test_parse_tree_sitter<dir> test tree-sitter parser on target fileshelp
-translate_rules<files or dirs>help
-stat_rules<files or dirs>help
-parse_rules<dir>help
-test_eval<JSON file>help
-sarif_sort<JSON file>help
-rpcdon't use this unless you already knowhelp
-typing_generic<file>help
-constant_propagation<file>help
-il_generic<file>help
-cfg_il<file>help
-dfg_svalue<file>help
-naming_generic<file>help
-versionguess whathelp
-ocaml_versionThe version of OCaml that was used to build this binaryhelp
-use_parmapRely on a legacy Parmap implementation of `-j`help
-helpDisplay this list of optionshelp
--helpDisplay this list of optionshelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.