Skip to content

Commit

Permalink
Activate CI servers reporters only if we find a related default env v…
Browse files Browse the repository at this point in the history
…ariable (#3321)

* Activate CI servers reporters only if we find a related default env variable

Fixes #3317

* [MegaLinter] Apply linters fixes

---------

Co-authored-by: nvuillam <nicolas.vuillamy@cloudity.com>
Co-authored-by: nvuillam <nvuillam@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 25, 2024
1 parent c042b5c commit e7c2ed9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- New linters

- Fixes
- Activate CI servers reporters only if we find a related default env variable

- Doc

Expand Down
4 changes: 3 additions & 1 deletion megalinter/reporters/AzureCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class AzureCommentReporter(Reporter):
scope = "mega-linter"

def manage_activation(self):
if (
if not config.exists(self.master.request_id, "SYSTEM_COLLECTIONURI"):
self.is_active = False
elif (
config.get(self.master.request_id, "AZURE_COMMENT_REPORTER", "true")
!= "true"
):
Expand Down
4 changes: 3 additions & 1 deletion megalinter/reporters/BitbucketCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class BitbucketCommentReporter(Reporter):
BITBUCKET_API = "https://api.bitbucket.org/2.0"

def manage_activation(self):
if (
if not config.exists(self.master.request_id, "BITBUCKET_REPO_FULL_NAME"):
self.is_active = False
elif (
config.get(self.master.request_id, "BITBUCKET_COMMENT_REPORTER", "true")
== "true"
):
Expand Down
4 changes: 3 additions & 1 deletion megalinter/reporters/GithubCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class GithubCommentReporter(Reporter):
issues_root = ML_REPO_URL + "/issues"

def manage_activation(self):
if (
if not config.exists(self.master.request_id, "GITHUB_REPOSITORY"):
self.is_active = False
elif (
config.get(self.master.request_id, "GITHUB_COMMENT_REPORTER", "true")
!= "true"
):
Expand Down
2 changes: 2 additions & 0 deletions megalinter/reporters/GitlabCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class GitlabCommentReporter(Reporter):
gitlab_server_url = "https://gitlab.com"

def manage_activation(self):
if not config.exists(self.master.request_id, "CI_JOB_TOKEN"):
self.is_active = False
if (
config.get(self.master.request_id, "GITLAB_COMMENT_REPORTER", "true")
!= "true"
Expand Down

0 comments on commit e7c2ed9

Please sign in to comment.