Class: Neetob::CLI::MonthlyAudit::Security::Code::ActiveRecordDoctor

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/monthly_audit/security/code/active_record_doctor.rb

Constant Summary

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initializeActiveRecordDoctor

Returns a new instance of ActiveRecordDoctor.



11
12
13
# File 'lib/neetob/cli/monthly_audit/security/code/active_record_doctor.rb', line 11

def initialize
  super()
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/neetob/cli/monthly_audit/security/code/active_record_doctor.rb', line 15

def run
  ui.success("### 1.1.4. Checking whether running `rake active_record_doctor` throws any vulnerabilities")
  repo_data = [["Repository", "Issues Found", "Comments", "Audit Passed"]]
  ui.info "\n"
  NeetoCompliance::NeetoRepos.products.keys.each do |repo|
    ui.info("Checking ActiveRecordDoctor run results for #{repo}", print_to_audit_log: false)
    active_record_doctor_run_result = Neetob::CLI::Github::ActiveRecordDoctor.new([repo]).run
    audit_passed = "No"
    if active_record_doctor_run_result.blank?
      audit_passed = "Yes"
      comments = nil
    else
      issues_found = "Yes"
      comments = "#{active_record_doctor_run_result.lines.first.strip} ..."

      issue_url = GithubIssueCreation.new.create_issue(
        repo:, title: "Fix issues reported by active_record_doctor",
        description: comments)
      audit_passed += " #{issue_url}"
    end

    repo_data << [repo, issues_found, comments, audit_passed]
  end
  ui.print_table(repo_data)
end