{"modulePath":"github.com/Method-Security/codeanalyze","version":"v0.0.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package semgrep\n\nPackage semgrep holds all of the data structures and logic related to running semgrep commands on a codebase.\n\n## Functions\n\n```go\nfunc CreateSemgrepConfigValue(template string, rulesDir string) (string, error)\n```\nCreateSemgrepConfigValue creates a semgrep config value based on the provided template and rules directory. If the template is not valid, an error is returned.\n\n## Types\n\n```go\ntype Dev struct {\n\tOrigin    string `json:\"origin\" yaml:\"origin\"`\n\tRID       string `json:\"r_id\" yaml:\"r_id\"`\n\tRuleID    string `json:\"rule_id\" yaml:\"rule_id\"`\n\tRVID      string `json:\"rv_id\" yaml:\"rv_id\"`\n\tURL       string `json:\"url\" yaml:\"url\"`\n\tVersionID string `json:\"version_id\" yaml:\"version_id\"`\n}\n```\nDev holds all of the development information for a semgrep finding.\n\n```go\ntype Error struct {\n\tCode    int    `json:\"code\" yaml:\"code\"`\n\tLevel   string `json:\"level\" yaml:\"level\"`\n\tMessage string `json:\"message\" yaml:\"message\"`\n\tType    string `json:\"type\" yaml:\"type\"`\n}\n```\nError holds the error information for a semgrep finding.\n\n```go\ntype Extra struct {\n\tEngineKind      string             `json:\"engine_kind\" yaml:\"engine_kind\"`\n\tFingerprint     string             `json:\"fingerprint\" yaml:\"fingerprint\"`\n\tIsIgnored       bool               `json:\"is_ignored\" yaml:\"is_ignored\"`\n\tLines           string             `json:\"lines\" yaml:\"lines\"`\n\tMessage         string             `json:\"message\" yaml:\"message\"`\n\tMetadata        Metadata           `json:\"metadata\" yaml:\"metadata\"`\n\tMetavars        map[string]Metavar `json:\"metavars\" yaml:\"metavars\"`\n\tSeverity        string             `json:\"severity\" yaml:\"severity\"`\n\tValidationState string             `json:\"validation_state\" yaml:\"validation_state\"`\n\tSemgrepDev      Dev                `json:\"semgrep.dev\" yaml:\"semgrep.dev\"`\n\tShortlink       string             `json:\"shortlink\" yaml:\"shortlink\"`\n\tSource          string             `json:\"source\" yaml:\"source\"`\n\tSourceRuleURL   string             `json:\"source-rule-url\" yaml:\"source-rule-url\"`\n}\n```\nExtra holds additional information for a semgrep finding.\n\n```go\ntype Metadata struct {\n\tCategory           string   `json:\"category\" yaml:\"category\"`\n\tConfidence         string   `json:\"confidence\" yaml:\"confidence\"`\n\tCWE                []string `json:\"cwe\" yaml:\"cwe\"`\n\tCWE2021Top25       bool     `json:\"cwe2021-top25\" yaml:\"cwe2021-top25\"`\n\tCWE2022Top25       bool     `json:\"cwe2022-top25\" yaml:\"cwe2022-top25\"`\n\tImpact             string   `json:\"impact\" yaml:\"impact\"`\n\tLicense            string   `json:\"license\" yaml:\"license\"`\n\tLikelihood         string   `json:\"likelihood\" yaml:\"likelihood\"`\n\tOWASP              []string `json:\"owasp\" yaml:\"owasp\"`\n\tReferences         []string `json:\"references\" yaml:\"references\"`\n\tSubcategory        []string `json:\"subcategory\" yaml:\"subcategory\"`\n\tTechnology         []string `json:\"technology\" yaml:\"technology\"`\n\tVulnerabilityClass []string `json:\"vulnerability_class\" yaml:\"vulnerability_class\"`\n}\n```\nMetadata holds the metadata for a semgrep finding.\n\n```go\ntype Metavar struct {\n\tAbstractContent string `json:\"abstract_content\" yaml:\"abstract_content\"`\n\tEnd             struct {\n\t\tCol    int `json:\"col\" yaml:\"col\"`\n\t\tLine   int `json:\"line\" yaml:\"line\"`\n\t\tOffset int `json:\"offset\" yaml:\"offset\"`\n\t} `json:\"end\" yaml:\"end\"`\n\tStart struct {\n\t\tCol    int `json:\"col\" yaml:\"col\"`\n\t\tLine   int `json:\"line\" yaml:\"line\"`\n\t\tOffset int `json:\"offset\" yaml:\"offset\"`\n\t} `json:\"start\" yaml:\"start\"`\n}\n```\nMetavar holds the meta variable information for a semgrep finding.\n\n```go\ntype Report struct {\n\tErrors  []Error  `json:\"errors\" yaml:\"errors\"`\n\tResults []Result `json:\"results\" yaml:\"results\"`\n}\n```\nReport holds all of the information for a semgrep run, including all of the non-fatal errors and results.\n\n```go\nfunc ExecuteSemgrep(ctx context.Context, target string, configValue string) (Report, error)\n```\nExecuteSemgrep runs the semgrep command with the provided target and configValue. It returns the report of the semgrep including all of the results and the non-fatal errors.\n\n```go\ntype Result struct {\n\tCheckID string `json:\"check_id\" yaml:\"check_id\"`\n\tPath    string `json:\"path\" yaml:\"path\"`\n\tStart   struct {\n\t\tLine   int `json:\"line\" yaml:\"line\"`\n\t\tCol    int `json:\"col\" yaml:\"col\"`\n\t\tOffset int `json:\"offset\" yaml:\"offset\"`\n\t} `json:\"start\" yaml:\"start\"`\n\tEnd struct {\n\t\tLine   int `json:\"line\" yaml:\"line\"`\n\t\tCol    int `json:\"col\" yaml:\"col\"`\n\t\tOffset int `json:\"offset\" yaml:\"offset\"`\n\t} `json:\"end\" yaml:\"end\"`\n\tExtra Extra `json:\"extra\" yaml:\"extra\"`\n}\n```\nResult holds the output result information for a given semgrep finding.\n\n","path":"github.com/Method-Security/codeanalyze/internal/semgrep","name":"semgrep","synopsis":"Package semgrep holds all of the data structures and logic related to running semgrep commands on a codebase.","isRedistributable":true}
