Class: Neetob::CLI::MonthlyAudit::Security::Code::Fasterer

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/monthly_audit/security/code/fasterer.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

#initializeFasterer

Returns a new instance of Fasterer.



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

def initialize
  super()
end

Instance Method Details

#runObject



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

def run
  ui.success("### 1.1.6. Checking whether running `bundle exec fasterer` give any suggestions")
  repo_data = [["Repository", "Optimizations needed", "Comments", "Audit Passed"]]
  ui.info "\n"
  NeetoCompliance::NeetoRepos.products.keys.each do |repo|
    ui.info("Checking Fasterer run results for #{repo}", print_to_audit_log: false)
    fasterer_exec_result = Neetob::CLI::Github::FastererAudit.new([repo]).run
    optimizations_needed = "No"
    audit_passed = "No"
    comments = nil
    if fasterer_exec_result.include?("0 offenses detected")
      audit_passed = "Yes"
      comments = "Vulnerabilities not detected"
    else
      optimizations_needed = "Yes"
      comments = strip_ansi_codes(fasterer_exec_result).gsub("\n", "<br>")

      issue_url = GithubIssueCreation.new.create_issue(
        repo:, title: "Fasterer suggestions to improve performance",
        description: comments)
      audit_passed += " #{issue_url}"

      comments = "Vulnerabilities detected"
    end
    repo_data << [repo, optimizations_needed, comments, audit_passed]
  end
  ui.print_table(repo_data)
end