Don't call get_pr_data if GitLeaks linter is not active #4469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you have
REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true
but the linter is not enabled it will fail:https://github.com/oxsecurity/megalinter/blob/2402a653f4d13b4a4be7b0ab2df3b5b9fa325d7e/megalinter/linters/GitleaksLinter.py
This happens because if the linter is not active, the
workspace
variable is not assigned:megalinter/megalinter/Linter.py
Line 274 in 2402a65
I therefore propose that you do nothing if it is deactivated.