Skip to content

Commit 8b8f075

Browse files
committed
move ci-adapters methods into the base class instead of a template one
1 parent cd6966d commit 8b8f075

2 files changed

Lines changed: 71 additions & 78 deletions

File tree

codecov_cli/helpers/ci_adapters/base.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,74 @@ def get_fallback_value(
2525
raise ValueError("The provided fallback_field is not valid")
2626

2727
return self.fallback_to_method[fallback_field]()
28+
29+
def detect(self) -> bool:
30+
"""
31+
Detects if this CI provider is being used
32+
Returns bool
33+
"""
34+
raise NotImplementedError("`detect()` must be implemented.")
35+
36+
def _get_branch(self):
37+
"""
38+
Determine the branch of the repository based on envs
39+
Returns: string
40+
"""
41+
raise NotImplementedError("`_get_branch()` must be implemented.")
42+
43+
def _get_commit_sha(self):
44+
"""
45+
Determine the commit SHA that is being uploaded, based on envs
46+
Returns: string
47+
"""
48+
raise NotImplementedError("`_get_commit_sha()` must be implemented.")
49+
50+
def _get_slug(self):
51+
"""
52+
Determine the slug (org/repo) based on envs
53+
Returns: string
54+
"""
55+
raise NotImplementedError("`_get_slug()` must be implemented.")
56+
57+
def _get_service(self):
58+
"""
59+
The CI service name that gets sent to the Codecov uploader as part of the query string
60+
It gets displayed in the Codecov UI
61+
Returns: string
62+
"""
63+
raise NotImplementedError("`_get_service()` must be implemented.")
64+
65+
def _get_build_url(self):
66+
"""
67+
Determine the build URL for use in the Codecov UI
68+
Returns: string
69+
"""
70+
raise NotImplementedError("`_get_build_url()` must be implemented.")
71+
72+
def _get_build_code(self):
73+
"""
74+
Determine the build number, based on envs
75+
Returns: string
76+
"""
77+
raise NotImplementedError("`_get_build_code()` must be implemented.")
78+
79+
def _get_job_code(self):
80+
"""
81+
Determine the job number, based on envs
82+
Returns: string
83+
"""
84+
raise NotImplementedError("`_get_job_code()` must be implemented.")
85+
86+
def _get_pull_request_number(self):
87+
"""
88+
Determine the PR number, based on envs
89+
Returns: string
90+
"""
91+
raise NotImplementedError("`_get_pull_request_number()` must be implemented.")
92+
93+
def get_service_name(self):
94+
"""
95+
The CI Service name that gets displayed when running the uploader
96+
Returns: string
97+
"""
98+
raise NotImplementedError("`get_service_name()` must be implemented.")

codecov_cli/helpers/ci_adapters/template.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)