Class: StillActive::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/still_active/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/still_active/config.rb', line 30

def initialize
  @fail_if_critical = false
  @fail_if_outdated = nil
  @fail_if_vulnerable = nil
  @fail_if_warning = false
  @gemfile_path = nil
  @gems = []
  @ignored_gems = []
  @github_oauth_token = nil
  @gitlab_token = nil

  @parallelism = 10

  @output_format = :auto
  @sarif_path = nil
  @baseline_path = nil
  @cyclonedx_path = nil
  @cyclonedx_version = "1.6"

  @critical_warning_emoji = "🚩"
  @futurist_emoji = "🔮"
  @success_emoji = ""
  @unsure_emoji = ""
  @warning_emoji = "⚠️"

  @no_warning_range_end = 1
  @warning_range_end = 3
end

Instance Attribute Details

#baseline_pathObject

Returns the value of attribute baseline_path.



10
11
12
# File 'lib/still_active/config.rb', line 10

def baseline_path
  @baseline_path
end

#critical_warning_emojiObject

Returns the value of attribute critical_warning_emoji.



10
11
12
# File 'lib/still_active/config.rb', line 10

def critical_warning_emoji
  @critical_warning_emoji
end

#cyclonedx_pathObject

Returns the value of attribute cyclonedx_path.



10
11
12
# File 'lib/still_active/config.rb', line 10

def cyclonedx_path
  @cyclonedx_path
end

#cyclonedx_versionObject

Returns the value of attribute cyclonedx_version.



10
11
12
# File 'lib/still_active/config.rb', line 10

def cyclonedx_version
  @cyclonedx_version
end

#fail_if_criticalObject

Returns the value of attribute fail_if_critical.



10
11
12
# File 'lib/still_active/config.rb', line 10

def fail_if_critical
  @fail_if_critical
end

#fail_if_outdatedObject

Returns the value of attribute fail_if_outdated.



10
11
12
# File 'lib/still_active/config.rb', line 10

def fail_if_outdated
  @fail_if_outdated
end

#fail_if_vulnerableObject

Returns the value of attribute fail_if_vulnerable.



10
11
12
# File 'lib/still_active/config.rb', line 10

def fail_if_vulnerable
  @fail_if_vulnerable
end

#fail_if_warningObject

Returns the value of attribute fail_if_warning.



10
11
12
# File 'lib/still_active/config.rb', line 10

def fail_if_warning
  @fail_if_warning
end

#futurist_emojiObject

Returns the value of attribute futurist_emoji.



10
11
12
# File 'lib/still_active/config.rb', line 10

def futurist_emoji
  @futurist_emoji
end

#gemfile_pathObject

Lazy so that running with –gems=… (no Gemfile needed) doesn’t crash when invoked from a directory without a Gemfile in the tree.



74
75
76
77
78
79
80
# File 'lib/still_active/config.rb', line 74

def gemfile_path
  @gemfile_path ||= begin
    Bundler.default_gemfile.to_s
  rescue Bundler::GemfileNotFound
    File.join(Dir.pwd, "Gemfile")
  end
end

#gemsObject

Returns the value of attribute gems.



10
11
12
# File 'lib/still_active/config.rb', line 10

def gems
  @gems
end

#github_oauth_tokenObject



64
65
66
# File 'lib/still_active/config.rb', line 64

def github_oauth_token
  @github_oauth_token ||= presence(ENV["GITHUB_TOKEN"]) || presence(ENV["GH_TOKEN"]) || gh_cli_token
end

#gitlab_tokenObject



68
69
70
# File 'lib/still_active/config.rb', line 68

def gitlab_token
  @gitlab_token ||= presence(ENV["GITLAB_TOKEN"]) || glab_cli_token
end

#ignored_gemsObject

Returns the value of attribute ignored_gems.



10
11
12
# File 'lib/still_active/config.rb', line 10

def ignored_gems
  @ignored_gems
end

#no_warning_range_endObject

Returns the value of attribute no_warning_range_end.



10
11
12
# File 'lib/still_active/config.rb', line 10

def no_warning_range_end
  @no_warning_range_end
end

#output_formatObject

Returns the value of attribute output_format.



10
11
12
# File 'lib/still_active/config.rb', line 10

def output_format
  @output_format
end

#parallelismObject

Returns the value of attribute parallelism.



10
11
12
# File 'lib/still_active/config.rb', line 10

def parallelism
  @parallelism
end

#sarif_pathObject

Returns the value of attribute sarif_path.



10
11
12
# File 'lib/still_active/config.rb', line 10

def sarif_path
  @sarif_path
end

#success_emojiObject

Returns the value of attribute success_emoji.



10
11
12
# File 'lib/still_active/config.rb', line 10

def success_emoji
  @success_emoji
end

#unsure_emojiObject

Returns the value of attribute unsure_emoji.



10
11
12
# File 'lib/still_active/config.rb', line 10

def unsure_emoji
  @unsure_emoji
end

#warning_emojiObject

Returns the value of attribute warning_emoji.



10
11
12
# File 'lib/still_active/config.rb', line 10

def warning_emoji
  @warning_emoji
end

#warning_range_endObject

Returns the value of attribute warning_range_end.



10
11
12
# File 'lib/still_active/config.rb', line 10

def warning_range_end
  @warning_range_end
end

Instance Method Details

#github_clientObject



59
60
61
62
# File 'lib/still_active/config.rb', line 59

def github_client
  @github_client ||=
    Octokit::Client.new(access_token: github_oauth_token)
end