Class: StillActive::Config
- Inherits:
-
Object
- Object
- StillActive::Config
- Defined in:
- lib/still_active/config.rb
Instance Attribute Summary collapse
-
#alternatives ⇒ Object
Returns the value of attribute alternatives.
- #artifactory_host ⇒ Object
- #artifactory_token ⇒ Object
-
#baseline_path ⇒ Object
Returns the value of attribute baseline_path.
-
#critical_warning_emoji ⇒ Object
Returns the value of attribute critical_warning_emoji.
-
#cyclonedx_path ⇒ Object
Returns the value of attribute cyclonedx_path.
-
#cyclonedx_version ⇒ Object
Returns the value of attribute cyclonedx_version.
-
#direct_only ⇒ Object
Returns the value of attribute direct_only.
-
#fail_if_critical ⇒ Object
Returns the value of attribute fail_if_critical.
-
#fail_if_outdated ⇒ Object
Returns the value of attribute fail_if_outdated.
-
#fail_if_vulnerable ⇒ Object
Returns the value of attribute fail_if_vulnerable.
-
#fail_if_warning ⇒ Object
Returns the value of attribute fail_if_warning.
-
#forgejo_token ⇒ Object
Codeberg/Forgejo has no ubiquitous CLI to borrow a token from (unlike gh/glab), so it’s env-var only.
-
#futurist_emoji ⇒ Object
Returns the value of attribute futurist_emoji.
-
#gemfile_path ⇒ Object
Lazy so that running with –gems=…
-
#gems ⇒ Object
Returns the value of attribute gems.
- #github_oauth_token ⇒ Object
- #gitlab_token ⇒ Object
-
#ignored_gems ⇒ Object
Returns the value of attribute ignored_gems.
-
#no_warning_range_end ⇒ Object
Returns the value of attribute no_warning_range_end.
-
#output_format ⇒ Object
Returns the value of attribute output_format.
-
#parallelism ⇒ Object
Returns the value of attribute parallelism.
-
#sarif_path ⇒ Object
Returns the value of attribute sarif_path.
-
#success_emoji ⇒ Object
Returns the value of attribute success_emoji.
-
#suppressions ⇒ Object
Returns the value of attribute suppressions.
-
#unreleased_commits ⇒ Object
Returns the value of attribute unreleased_commits.
-
#unsure_emoji ⇒ Object
Returns the value of attribute unsure_emoji.
-
#warning_emoji ⇒ Object
Returns the value of attribute warning_emoji.
-
#warning_range_end ⇒ Object
Returns the value of attribute warning_range_end.
Instance Method Summary collapse
- #github_client ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/still_active/config.rb', line 35 def initialize @alternatives = false @unreleased_commits = false @direct_only = false @fail_if_critical = false @fail_if_outdated = nil @fail_if_vulnerable = nil @fail_if_warning = false @gemfile_path = nil @gems = [] @ignored_gems = [] @suppressions = Suppressions.from(nil) @github_oauth_token = nil @gitlab_token = nil @forgejo_token = nil @artifactory_token = nil @artifactory_host = 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 = "⚠️" # Release-age thresholds (years) calibrated against real RubyGems cadence, # not the npm-derived 12-month convention: healthy mature gems routinely go # 12-18 months between releases, so the ok ceiling is 18 months. > 3 years # is critical. See #32. @no_warning_range_end = 1.5 @warning_range_end = 3 end |
Instance Attribute Details
#alternatives ⇒ Object
Returns the value of attribute alternatives.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def alternatives @alternatives end |
#artifactory_host ⇒ Object
100 101 102 |
# File 'lib/still_active/config.rb', line 100 def artifactory_host @artifactory_host ||= presence(ENV["STILL_ACTIVE_ARTIFACTORY_HOST"]) end |
#artifactory_token ⇒ Object
96 97 98 |
# File 'lib/still_active/config.rb', line 96 def artifactory_token @artifactory_token ||= presence(ENV["STILL_ACTIVE_ARTIFACTORY_TOKEN"]) end |
#baseline_path ⇒ Object
Returns the value of attribute baseline_path.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def baseline_path @baseline_path end |
#critical_warning_emoji ⇒ Object
Returns the value of attribute critical_warning_emoji.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def critical_warning_emoji @critical_warning_emoji end |
#cyclonedx_path ⇒ Object
Returns the value of attribute cyclonedx_path.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def cyclonedx_path @cyclonedx_path end |
#cyclonedx_version ⇒ Object
Returns the value of attribute cyclonedx_version.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def cyclonedx_version @cyclonedx_version end |
#direct_only ⇒ Object
Returns the value of attribute direct_only.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def direct_only @direct_only end |
#fail_if_critical ⇒ Object
Returns the value of attribute fail_if_critical.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def fail_if_critical @fail_if_critical end |
#fail_if_outdated ⇒ Object
Returns the value of attribute fail_if_outdated.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def fail_if_outdated @fail_if_outdated end |
#fail_if_vulnerable ⇒ Object
Returns the value of attribute fail_if_vulnerable.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def fail_if_vulnerable @fail_if_vulnerable end |
#fail_if_warning ⇒ Object
Returns the value of attribute fail_if_warning.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def fail_if_warning @fail_if_warning end |
#forgejo_token ⇒ Object
Codeberg/Forgejo has no ubiquitous CLI to borrow a token from (unlike gh/glab), so it’s env-var only. Anonymous works for public repos; a token only raises the rate limit. CODEBERG_TOKEN is accepted as a convenience alias for the codeberg.org default host.
92 93 94 |
# File 'lib/still_active/config.rb', line 92 def forgejo_token @forgejo_token ||= presence(ENV["STILL_ACTIVE_FORGEJO_TOKEN"]) || presence(ENV["CODEBERG_TOKEN"]) end |
#futurist_emoji ⇒ Object
Returns the value of attribute futurist_emoji.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def futurist_emoji @futurist_emoji end |
#gemfile_path ⇒ Object
Lazy so that running with –gems=… (no Gemfile needed) doesn’t crash when invoked from a directory without a Gemfile in the tree.
106 107 108 109 110 111 112 |
# File 'lib/still_active/config.rb', line 106 def gemfile_path @gemfile_path ||= begin Bundler.default_gemfile.to_s rescue Bundler::GemfileNotFound File.join(Dir.pwd, "Gemfile") end end |
#gems ⇒ Object
Returns the value of attribute gems.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def gems @gems end |
#github_oauth_token ⇒ Object
80 81 82 |
# File 'lib/still_active/config.rb', line 80 def github_oauth_token @github_oauth_token ||= presence(ENV["GITHUB_TOKEN"]) || presence(ENV["GH_TOKEN"]) || gh_cli_token end |
#gitlab_token ⇒ Object
84 85 86 |
# File 'lib/still_active/config.rb', line 84 def gitlab_token @gitlab_token ||= presence(ENV["GITLAB_TOKEN"]) || glab_cli_token end |
#ignored_gems ⇒ Object
Returns the value of attribute ignored_gems.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def ignored_gems @ignored_gems end |
#no_warning_range_end ⇒ Object
Returns the value of attribute no_warning_range_end.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def no_warning_range_end @no_warning_range_end end |
#output_format ⇒ Object
Returns the value of attribute output_format.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def output_format @output_format end |
#parallelism ⇒ Object
Returns the value of attribute parallelism.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def parallelism @parallelism end |
#sarif_path ⇒ Object
Returns the value of attribute sarif_path.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def sarif_path @sarif_path end |
#success_emoji ⇒ Object
Returns the value of attribute success_emoji.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def success_emoji @success_emoji end |
#suppressions ⇒ Object
Returns the value of attribute suppressions.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def suppressions @suppressions end |
#unreleased_commits ⇒ Object
Returns the value of attribute unreleased_commits.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def unreleased_commits @unreleased_commits end |
#unsure_emoji ⇒ Object
Returns the value of attribute unsure_emoji.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def unsure_emoji @unsure_emoji end |
#warning_emoji ⇒ Object
Returns the value of attribute warning_emoji.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def warning_emoji @warning_emoji end |
#warning_range_end ⇒ Object
Returns the value of attribute warning_range_end.
11 12 13 |
# File 'lib/still_active/config.rb', line 11 def warning_range_end @warning_range_end end |
Instance Method Details
#github_client ⇒ Object
75 76 77 78 |
# File 'lib/still_active/config.rb', line 75 def github_client @github_client ||= Octokit::Client.new(access_token: github_oauth_token) end |