Module: Dependabot

Extended by:
T::Sig
Defined in:
lib/dependabot.rb,
lib/dependabot/utils.rb,
lib/dependabot/config.rb,
lib/dependabot/errors.rb,
lib/dependabot/logger.rb,
lib/dependabot/source.rb,
lib/dependabot/git_ref.rb,
lib/dependabot/version.rb,
lib/dependabot/workspace.rb,
lib/dependabot/credential.rb,
lib/dependabot/dependency.rb,
lib/dependabot/config/file.rb,
lib/dependabot/experiments.rb,
lib/dependabot/requirement.rb,
lib/dependabot/file_parsers.rb,
lib/dependabot/clients/azure.rb,
lib/dependabot/file_fetchers.rb,
lib/dependabot/file_updaters.rb,
lib/dependabot/workspace/git.rb,
lib/dependabot/shared_helpers.rb,
lib/dependabot/workspace/base.rb,
lib/dependabot/dependency_file.rb,
lib/dependabot/registry_client.rb,
lib/dependabot/update_checkers.rb,
lib/dependabot/dependency_group.rb,
lib/dependabot/metadata_finders.rb,
lib/dependabot/clients/bitbucket.rb,
lib/dependabot/file_parsers/base.rb,
lib/dependabot/security_advisory.rb,
lib/dependabot/clients/codecommit.rb,
lib/dependabot/file_fetchers/base.rb,
lib/dependabot/file_updaters/base.rb,
lib/dependabot/git_commit_checker.rb,
lib/dependabot/config/file_fetcher.rb,
lib/dependabot/simple_instrumentor.rb,
lib/dependabot/config/update_config.rb,
lib/dependabot/git_metadata_fetcher.rb,
lib/dependabot/pull_request_creator.rb,
lib/dependabot/pull_request_updater.rb,
lib/dependabot/update_checkers/base.rb,
lib/dependabot/metadata_finders/base.rb,
lib/dependabot/config/ignore_condition.rb,
lib/dependabot/workspace/change_attempt.rb,
lib/dependabot/requirements_updater/base.rb,
lib/dependabot/pull_request_creator/azure.rb,
lib/dependabot/pull_request_updater/azure.rb,
lib/dependabot/clients/github_with_retries.rb,
lib/dependabot/clients/gitlab_with_retries.rb,
lib/dependabot/pull_request_creator/github.rb,
lib/dependabot/pull_request_creator/gitlab.rb,
lib/dependabot/pull_request_updater/github.rb,
lib/dependabot/pull_request_updater/gitlab.rb,
lib/dependabot/file_updaters/vendor_updater.rb,
lib/dependabot/pull_request_creator/labeler.rb,
lib/dependabot/pull_request_creator/message.rb,
lib/dependabot/requirements_update_strategy.rb,
lib/dependabot/clients/bitbucket_with_retries.rb,
lib/dependabot/file_updaters/artifact_updater.rb,
lib/dependabot/pull_request_creator/bitbucket.rb,
lib/dependabot/pull_request_creator/codecommit.rb,
lib/dependabot/update_checkers/version_filters.rb,
lib/dependabot/file_parsers/base/dependency_set.rb,
lib/dependabot/pull_request_creator/branch_namer.rb,
lib/dependabot/pull_request_creator/commit_signer.rb,
lib/dependabot/metadata_finders/base/commits_finder.rb,
lib/dependabot/metadata_finders/base/release_finder.rb,
lib/dependabot/pull_request_creator/message_builder.rb,
lib/dependabot/pull_request_creator/pr_name_prefixer.rb,
lib/dependabot/metadata_finders/base/changelog_finder.rb,
lib/dependabot/metadata_finders/base/changelog_pruner.rb,
lib/dependabot/pull_request_creator/branch_namer/base.rb,
lib/dependabot/pull_request_creator/branch_namer/solo_strategy.rb,
lib/dependabot/pull_request_creator/message_builder/issue_linker.rb,
lib/dependabot/pull_request_creator/message_builder/metadata_presenter.rb,
lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb,
lib/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Modules: Clients, Config, ErrorAttributes, Experiments, FileFetchers, FileParsers, FileUpdaters, MetadataFinders, RequirementsUpdater, SharedHelpers, SimpleInstrumentor, UpdateCheckers, Utils, Workspace Classes: AllVersionsIgnored, BranchNotFound, Credential, DependabotError, Dependency, DependencyFile, DependencyFileNotEvaluatable, DependencyFileNotFound, DependencyFileNotParseable, DependencyFileNotResolvable, DependencyGroup, DirectoryNotFound, GitCommitChecker, GitDependenciesNotReachable, GitDependencyReferenceNotFound, GitMetadataFetcher, GitRef, GoModulePathMismatch, InconsistentRegistryResponse, MisconfiguredTooling, MissingEnvironmentVariable, NotImplemented, OutOfDisk, OutOfMemory, PathDependenciesNotReachable, PrivateSourceAuthenticationFailure, PrivateSourceCertificateFailure, PrivateSourceTimedOut, PullRequestCreator, PullRequestUpdater, RefType, RegistryClient, RepoNotFound, Requirement, RequirementsUpdateStrategy, SecurityAdvisory, Source, ToolVersionNotSupported, UnexpectedExternalCode, Version

Constant Summary collapse

VERSION =
"0.261.0"

Class Method Summary collapse

Class Method Details

.fetcher_error_details(error) ⇒ Object



24
25
26
27
28
29
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/dependabot/errors.rb', line 24

def self.fetcher_error_details(error)
  case error
  when Dependabot::ToolVersionNotSupported
    {
      "error-type": "tool_version_not_supported",
      "error-detail": {
        "tool-name": error.tool_name,
        "detected-version": error.detected_version,
        "supported-versions": error.supported_versions
      }
    }
  when Dependabot::BranchNotFound
    {
      "error-type": "branch_not_found",
      "error-detail": { "branch-name": error.branch_name }
    }
  when Dependabot::DirectoryNotFound
    {
      "error-type": "directory_not_found",
      "error-detail": { "directory-name": error.directory_name }
    }
  when Dependabot::RepoNotFound
    # This happens if the repo gets removed after a job gets kicked off.
    # This also happens when a configured personal access token is not authz'd to fetch files from the job repo.
    {
      "error-type": "job_repo_not_found",
      "error-detail": { message: error.message }
    }
  when Dependabot::DependencyFileNotParseable
    {
      "error-type": "dependency_file_not_parseable",
      "error-detail": {
        message: error.message,
        "file-path": error.file_path
      }
    }
  when Dependabot::DependencyFileNotFound
    {
      "error-type": "dependency_file_not_found",
      "error-detail": {
        message: error.message,
        "file-path": error.file_path
      }
    }
  when Dependabot::OutOfDisk
    {
      "error-type": "out_of_disk",
      "error-detail": {}
    }
  when Dependabot::PathDependenciesNotReachable
    {
      "error-type": "path_dependencies_not_reachable",
      "error-detail": { dependencies: error.dependencies }
    }
  when Octokit::Unauthorized
    { "error-type": "octokit_unauthorized" }
  when Octokit::ServerError
    # If we get a 500 from GitHub there's very little we can do about it,
    # and responsibility for fixing it is on them, not us. As a result we
    # quietly log these as errors
    { "error-type": "server_error" }
  when *Octokit::RATE_LIMITED_ERRORS
    # If we get a rate-limited error we let dependabot-api handle the
    # retry by re-enqueing the update job after the reset
    {
      "error-type": "octokit_rate_limited",
      "error-detail": {
        "rate-limit-reset": T.cast(error, Octokit::Error).response_headers["X-RateLimit-Reset"]
      }
    }
  end
end

.loggerObject



11
12
13
# File 'lib/dependabot/logger.rb', line 11

def self.logger
  @logger ||= T.let(::Logger.new(nil), T.nilable(::Logger))
end

.logger=(logger) ⇒ Object



16
17
18
# File 'lib/dependabot/logger.rb', line 16

def self.logger=(logger)
  @logger = logger
end

.parser_error_details(error) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/dependabot/errors.rb', line 98

def self.parser_error_details(error)
  case error
  when Dependabot::DependencyFileNotEvaluatable
    {
      "error-type": "dependency_file_not_evaluatable",
      "error-detail": { message: error.message }
    }
  when Dependabot::DependencyFileNotResolvable
    {
      "error-type": "dependency_file_not_resolvable",
      "error-detail": { message: error.message }
    }
  when Dependabot::BranchNotFound
    {
      "error-type": "branch_not_found",
      "error-detail": { "branch-name": error.branch_name }
    }
  when Dependabot::DependencyFileNotParseable
    {
      "error-type": "dependency_file_not_parseable",
      "error-detail": {
        message: error.message,
        "file-path": error.file_path
      }
    }
  when Dependabot::DependencyFileNotFound
    {
      "error-type": "dependency_file_not_found",
      "error-detail": {
        message: error.message,
        "file-path": error.file_path
      }
    }
  when Dependabot::PathDependenciesNotReachable
    {
      "error-type": "path_dependencies_not_reachable",
      "error-detail": { dependencies: error.dependencies }
    }
  when Dependabot::PrivateSourceAuthenticationFailure
    {
      "error-type": "private_source_authentication_failure",
      "error-detail": { source: error.source }
    }
  when Dependabot::GitDependenciesNotReachable
    {
      "error-type": "git_dependencies_not_reachable",
      "error-detail": { "dependency-urls": error.dependency_urls }
    }
  when Dependabot::NotImplemented
    {
      "error-type": "not_implemented",
      "error-detail": {
        message: error.message
      }
    }
  when Octokit::ServerError
    # If we get a 500 from GitHub there's very little we can do about it,
    # and responsibility for fixing it is on them, not us. As a result we
    # quietly log these as errors
    { "error-type": "server_error" }
  end
end

.updater_error_details(error) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/dependabot/errors.rb', line 162

def self.updater_error_details(error)
  case error
  when Dependabot::DependencyFileNotResolvable
    {
      "error-type": "dependency_file_not_resolvable",
      "error-detail": { message: error.message }
    }
  when Dependabot::DependencyFileNotEvaluatable
    {
      "error-type": "dependency_file_not_evaluatable",
      "error-detail": { message: error.message }
    }
  when Dependabot::GitDependenciesNotReachable
    {
      "error-type": "git_dependencies_not_reachable",
      "error-detail": { "dependency-urls": error.dependency_urls }
    }
  when Dependabot::MisconfiguredTooling
    {
      "error-type": "misconfigured_tooling",
      "error-detail": { "tool-name": error.tool_name, message: error.tool_message }
    }
  when Dependabot::GitDependencyReferenceNotFound
    {
      "error-type": "git_dependency_reference_not_found",
      "error-detail": { dependency: error.dependency }
    }
  when Dependabot::PrivateSourceAuthenticationFailure
    {
      "error-type": "private_source_authentication_failure",
      "error-detail": { source: error.source }
    }
  when Dependabot::PrivateSourceTimedOut
    {
      "error-type": "private_source_timed_out",
      "error-detail": { source: error.source }
    }
  when Dependabot::PrivateSourceCertificateFailure
    {
      "error-type": "private_source_certificate_failure",
      "error-detail": { source: error.source }
    }
  when Dependabot::MissingEnvironmentVariable
    {
      "error-type": "missing_environment_variable",
      "error-detail": {
        "environment-variable": error.environment_variable
      }
    }
  when Dependabot::GoModulePathMismatch
    {
      "error-type": "go_module_path_mismatch",
      "error-detail": {
        "declared-path": error.declared_path,
        "discovered-path": error.discovered_path,
        "go-mod": error.go_mod
      }
    }
  when Dependabot::NotImplemented
    {
      "error-type": "not_implemented",
      "error-detail": {
        message: error.message
      }
    }
  when *Octokit::RATE_LIMITED_ERRORS
    # If we get a rate-limited error we let dependabot-api handle the
    # retry by re-enqueing the update job after the reset
    {
      "error-type": "octokit_rate_limited",
      "error-detail": {
        "rate-limit-reset": T.cast(error, Octokit::Error).response_headers["X-RateLimit-Reset"]
      }
    }
  end
end