{"id":24844428,"url":"https://github.com/johnsaigle/semgrep-diagnostics.nvim","last_synced_at":"2025-04-12T13:12:06.533Z","repository":{"id":272802633,"uuid":"917803304","full_name":"johnsaigle/semgrep-diagnostics.nvim","owner":"johnsaigle","description":"A Neovim plugin that integrates semgrep with the built-in diagnostic system.","archived":false,"fork":false,"pushed_at":"2025-04-10T17:47:26.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T13:12:02.027Z","etag":null,"topics":["neovim","neovim-plugin","semgrep","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnsaigle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-16T17:14:19.000Z","updated_at":"2025-04-10T17:47:30.000Z","dependencies_parsed_at":"2025-01-16T18:44:14.493Z","dependency_job_id":"505261f3-75b7-437d-b3af-420fd57faf21","html_url":"https://github.com/johnsaigle/semgrep-diagnostics.nvim","commit_stats":null,"previous_names":["johnsaigle/semgrep-diagnostics.nvim"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsaigle%2Fsemgrep-diagnostics.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsaigle%2Fsemgrep-diagnostics.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsaigle%2Fsemgrep-diagnostics.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsaigle%2Fsemgrep-diagnostics.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnsaigle","download_url":"https://codeload.github.com/johnsaigle/semgrep-diagnostics.nvim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571878,"owners_count":21126522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","neovim-plugin","semgrep","static-analysis"],"created_at":"2025-01-31T09:18:45.506Z","updated_at":"2025-04-12T13:12:06.518Z","avatar_url":"https://github.com/johnsaigle.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semgrep-diagnostics.nvim\n\nA Neovim plugin that integrates [semgrep](https://semgrep.dev/) with the built-in diagnostic system.\n\n## Prerequisites\n\n- Neovim 0.8 or higher\n- [none-ls.nvim](https://github.com/nvimtools/none-ls.nvim)\n- [semgrep](https://semgrep.dev/docs/getting-started/) installed and available in PATH\n\n## Installation\n\nUsing [lazy.nvim](https://github.com/folke/lazy.nvim):\n```lua\n{\n  'johnsaigle/semgrep.nvim',\n  dependencies = { 'nvimtools/none-ls.nvim' },\n  opts = {\n    -- your configuration\n  }\n}\n```\n\n## Configuration\n\nHere's an example configuration with all available options and their defaults:\n```lua\nrequire('semgrep').setup({\n  -- Enable/disable the plugin\n  enabled = true,\n  \n  -- Semgrep configuration to use\n  -- Can be:\n  -- - \"auto\" (default, use .semgrep.yml in project root)\n  -- - \"p/ci\" (use semgrep's CI rules)\n  -- - \"p/security-audit\" (use security audit rules)\n  -- - or any other valid semgrep rule set\n  -- - or a table of multiple configurations:\n  --   {\"p/python\", \"~/path/to/custom/rules.yaml\"}\n  semgrep_config = \"auto\",\n  \n  -- Map semgrep severities to nvim diagnostic severities\n  severity_map = {\n    ERROR = vim.diagnostic.severity.ERROR,\n    WARNING = vim.diagnostic.severity.WARN,\n    INFO = vim.diagnostic.severity.INFO,\n    HINT = vim.diagnostic.severity.HINT,\n  },\n  \n  -- Default severity if not specified in the semgrep rule\n  default_severity = vim.diagnostic.severity.WARN,\n  \n  -- Additional arguments to pass to semgrep\n  extra_args = {},\n  \n  -- Filetypes to run semgrep on (empty means all filetypes)\n  filetypes = {},\n})\n```\n\n## Usage\n\nOnce configured, the plugin will automatically run semgrep on your files and display the results as diagnostics in Neovim. The diagnostics will update whenever you:\n- Open a file\n- Save a file\n- Load a new buffer\n\n### Viewing Diagnostics\n\nYou can use any of Neovim's built-in diagnostic features to navigate and view the semgrep results:\n- `:lua vim.diagnostic.open_float()` - Show diagnostic in a floating window\n- `:lua vim.diagnostic.goto_next()` - Go to next diagnostic\n- `:lua vim.diagnostic.goto_prev()` - Go to previous diagnostic\n- `:lua vim.diagnostic.setqflist()` - Put diagnostics in quickfix list\n\n### Enhanced Diagnostic Information\n\nThe plugin provides detailed information about semgrep rules in diagnostics:\n- Rule ID is appended to each diagnostic message\n  - Rule ID\n  - Rule source\n  - Category\n  - Technology\n  - Confidence level\n  - References (if available)\n\n### Plugin Commands\n\nThe plugin provides several utility functions that you can map to keys:\n\n```lua\n-- Toggle the plugin on/off\nvim.keymap.set('n', '\u003cleader\u003est', require('semgrep').toggle, { desc = 'Toggle Semgrep' })\n\n-- Display current configuration\nvim.keymap.set('n', '\u003cleader\u003esc', require('semgrep').print_config, { desc = 'Show Semgrep config' })\n\n-- View rule details (alternative to K)\nvim.keymap.set('n', '\u003cleader\u003esd', require('semgrep').show_rule_details, { desc = 'Show Semgrep rule details' })\n```\n\n## Examples\n\n### Using with specific rule sets\n```lua\n-- Use security audit rules\nrequire('semgrep').setup({\n  semgrep_config = \"p/security-audit\"\n})\n\n-- Use multiple rule sets\nrequire('semgrep').setup({\n  semgrep_config = {\n    \"p/security-audit\",\n    \"p/python\",\n    \"~/path/to/custom/rules.yaml\"\n  },\n  extra_args = {\"--max-target-bytes\", \"1000000\"}\n})\n\n-- Only run on specific filetypes\nrequire('semgrep').setup({\n  filetypes = {\"python\", \"javascript\", \"typescript\"}\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsaigle%2Fsemgrep-diagnostics.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsaigle%2Fsemgrep-diagnostics.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsaigle%2Fsemgrep-diagnostics.nvim/lists"}