dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.57k stars 1.44k forks source link

feat(gitleaks): add initial support for gitleaks #4589

Open pbnj opened 1 year ago

pbnj commented 1 year ago

Closes #4588

TODO:

pbnj commented 1 year ago

Here are some preliminary results...

Shell

Screenshot 2023-08-15 at 8 11 59 PM

:ALEInfo

Expand ```text Current Filetype: sh Available Linters: ['bashate', 'cspell', 'gitleaks', 'language_server', 'shell', 'shellcheck'] Enabled Linters: ['bashate', 'cspell', 'gitleaks', 'language_server', 'shell', 'shellcheck'] Ignored Linters: [] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'shfmt' - Fix sh files with shfmt. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables: let g:ale_sh_bashate_executable = 'bashate' let g:ale_sh_bashate_options = '' let g:ale_sh_language_server_executable = 'bash-language-server' let g:ale_sh_language_server_use_global = 0 let g:ale_sh_shell_default_shell = 'bash' let g:ale_sh_shellcheck_change_directory = 1 let g:ale_sh_shellcheck_dialect = 'auto' let g:ale_sh_shellcheck_exclusions = '' let g:ale_sh_shellcheck_executable = 'shellcheck' let g:ale_sh_shellcheck_options = '' Global Variables: let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 50 let g:ale_disable_lsp = 0 let g:ale_echo_cursor = 0 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 1 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace']} let b:ale_fixers = ['shfmt'] let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'normal' let g:ale_linter_aliases = {} let g:ale_linters = {} let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_sign_highlight_linenrs = 0 let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_neovim_diagnostics_api = 0 let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 'all' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History: (executable check - failure) bashate (executable check - failure) cspell (finished - exit code 1) ['/opt/homebrew/bin/bash', '-c', '''gitleaks'' detect --no-git --no-color --no-banner --redact --verbose --source=''/Users/peter.benjamin/.vim/plugged/ale/tmp/env'''] <<>> Finding: ACCESS_KEY_ID=REDACTED Secret: REDACTED RuleID: generic-api-key Entropy: 3.546594 File: /Users/peter.benjamin/.vim/plugged/ale/tmp/env Line: 1 Fingerprint: /Users/peter.benjamin/.vim/plugged/ale/tmp/env:generic-api-key:1 <<>> (executable check - failure) bash-language-server (executable check - success) sh (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', 'sh -n ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/116/env'''] <<>> (executable check - success) shellcheck (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''shellcheck'' --version'] <<>> ShellCheck - shell script analysis tool version: 0.9.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net <<>> (finished - exit code 1) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''shellcheck'' -s sh -x -f gcc - < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/117/env'''] <<>> -:1:1: warning: AWS_ACCESS_KEY_ID appears unused. Verify use (or export if used externally). [SC2034] <<>> ```

Terraform

Screenshot 2023-08-15 at 8 16 10 PM

:ALEInfo

Expand ```text Current Filetype: terraform Available Linters: ['checkov', 'gitleaks', 'terraform', 'terraform_ls', 'terraform_lsp', 'tflint', 'tfsec'] Enabled Linters: ['gitleaks', 'terraform', 'terraform_ls', 'tflint'] Ignored Linters: [] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'terraform' - Fix tf and hcl files with terraform fmt. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables: let g:ale_terraform_fmt_executable = 'terraform' let g:ale_terraform_fmt_options = '' let g:ale_terraform_langserver_executable = 'terraform-lsp' let g:ale_terraform_langserver_options = '' let g:ale_terraform_ls_executable = 'terraform-ls' let g:ale_terraform_ls_options = '' let g:ale_terraform_terraform_executable = 'terraform' let g:ale_terraform_tflint_executable = 'tflint' let g:ale_terraform_tflint_options = '' Global Variables: let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 50 let g:ale_disable_lsp = 0 let g:ale_echo_cursor = 0 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 1 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace']} let b:ale_fixers = ['terraform', 'remove_trailing_lines', 'trim_whitespace'] let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'normal' let g:ale_linter_aliases = {} let g:ale_linters = {} let b:ale_linters = ['terraform', 'tflint', 'terraform_ls', 'snyk', 'gitleaks'] let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_sign_highlight_linenrs = 0 let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_neovim_diagnostics_api = 0 let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 'all' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 LSP Error Messages: (Errors for terraform_ls) Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Failed to find project root, language server won't start. Command History: (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/88/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/89/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/90/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/91/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/94/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/95/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' fmt - < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/98/test.tf'''] (finished - exit code 1) ['/opt/homebrew/bin/bash', '-c', '''gitleaks'' detect --no-git --no-color --no-banner --redact --verbose --source=''/Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf'''] <<>> Finding: client_secret = "REDACTED" Secret: REDACTED RuleID: generic-api-key Entropy: 4.651872 File: /Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf Line: 2 Fingerprint: /Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf:generic-api-key:2 <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/99/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/100/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/101/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/102/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/109/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/110/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/111/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/112/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' fmt - < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/113/test.tf'''] (finished - exit code 1) ['/opt/homebrew/bin/bash', '-c', '''gitleaks'' detect --no-git --no-color --no-banner --redact --verbose --source=''/Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf'''] <<>> Finding: client_secret = "REDACTED" Secret: REDACTED RuleID: generic-api-key Entropy: 4.669569 File: /Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf Line: 2 Fingerprint: /Users/peter.benjamin/.vim/plugged/ale/tmp/test.tf:generic-api-key:2 <<>> (finished - exit code 0) ['/opt/homebrew/bin/bash', '-c', '''terraform'' validate -no-color -json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/114/test.tf'''] <<>> { "format_version": "1.0", "valid": true, "error_count": 0, "warning_count": 0, "diagnostics": [] } <<>> (finished - exit code 2) ['/opt/homebrew/bin/bash', '-c', 'cd ''/Users/peter.benjamin/.vim/plugged/ale/tmp'' && ''tflint'' -f json < ''/var/folders/n3/z85vhgns0n98543krh_3n63h0000gq/T/vr8lhWI/115/test.tf'''] <<>> {"issues":[{"rule":{"name":"terraform_required_version","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_version.md"},"message":"terraform \"required_version\" attribute is required","range":{"filename":"","start":{"line":0,"column":0},"end":{"line":0,"column":0}},"callers":[]},{"rule":{"name":"terraform_required_providers","severity":"warning","link":"https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_required_providers.md"},"message":"Missing version constraint for provider \"null\" in `required_providers`","range":{"filename":"test.tf","start":{"line":1,"column":1},"end":{"line":1,"column":32}},"callers":[]}],"errors":[]} <<>> ```
stale[bot] commented 1 year ago

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests. If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

stale[bot] commented 8 months ago

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests. If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.