-
-
Notifications
You must be signed in to change notification settings - Fork 285
Add gitleaks linter #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add gitleaks linter #853
Conversation
lua/lint/linters/gitleaks.lua
Outdated
|
|
||
| ---Baseline file (use the baseline name in the example at https://github.com/gitleaks/gitleaks?tab=readme-ov-file#creating-a-baseline) | ||
| ---@type string | ||
| local baseline = vim.fn.findfile("gitleaks-report.json", ".;") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be left out and delegated to user's to configure themselves? Looks gitleaks also works without setting it.
Without it, the linter could be static instead of a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the baseline path is constant (the gitleaks command is too), so we can move it outside the function and make the linter completely static.
Would you prefer to add a variable to set the baseline path (e.g., 'vim.g.nvim_lint_gitleaks_baseline'), or remove it and have the user override the linter command to set it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer to add a variable to set the baseline path (e.g., 'vim.g.nvim_lint_gitleaks_baseline'), or remove it and have the user override the linter command to set it?
Remove it and have the user override the linter command to set it. That's already documented and the pattern used by other linters so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also fixed the broken gilteaks URL. Now it links to the official gitleaks repository
The linter configuration is no longer dynamic (returned by a function). It is now a static table, allowing the user to configure the linter BREAKING CHANGE: The default configuration no longer loads the baseline file, the user needs to configure it manually
No description provided.