Class: GitlabChecks::Checks::Repository
- Inherits:
-
Object
- Object
- GitlabChecks::Checks::Repository
- Defined in:
- lib/gitlab_checks/checks/repository.rb
Instance Method Summary collapse
- #audit(gitlab_org) ⇒ Object
-
#initialize ⇒ Repository
constructor
A new instance of Repository.
- #output_result ⇒ Object
- #output_statistics ⇒ Object
Constructor Details
#initialize ⇒ Repository
Returns a new instance of Repository.
6 7 8 9 |
# File 'lib/gitlab_checks/checks/repository.rb', line 6 def initialize @all_repos = nil @repos_with_gitlab_security = nil end |
Instance Method Details
#audit(gitlab_org) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab_checks/checks/repository.rb', line 11 def audit(gitlab_org) findings = [] @all_repos = Gitlab.group_projects(gitlab_org.root_group, { per_page: 100, include_subgroups: true }).lazy_paginate @repos_with_gitlab_security = Gitlab.group_projects(gitlab_org.root_group, { per_page: 100, include_subgroups: true, with_security_reports: true }).lazy_paginate findings end |
#output_result ⇒ Object
24 |
# File 'lib/gitlab_checks/checks/repository.rb', line 24 def output_result; end |
#output_statistics ⇒ Object
26 27 28 29 30 31 |
# File 'lib/gitlab_checks/checks/repository.rb', line 26 def output_statistics print "Number of projects: #{@all_repos.count}" print "Number of projects with active Gitlab security dashboards: #{@repos_with_gitlab_security.count}" print "Number of public projects: #{ @all_repos.select { |repo| repo["visibility"].include?("public") }.count}" print "Number of public projects: #{ @all_repos.select { |repo| repo["visibility"].include?("internal") }.count}" end |