FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/ci_lint.py at main · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
ci_lint.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
79 lines (61 loc) · 2.2 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
ci_lint.py
Copy path
File metadata and controls
79 lines (61 loc) · 2.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
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
"""
GitLab API:
https://docs.gitlab.com/ee/api/lint.html
"""
from
typing
import
Any
from
gitlab
.
base
import
RESTObject
from
gitlab
.
cli
import
register_custom_action
from
gitlab
.
exceptions
import
GitlabCiLintError
from
gitlab
.
mixins
import
CreateMixin
,
GetWithoutIdMixin
from
gitlab
.
types
import
RequiredOptional
__all__
=
[
"CiLint"
,
"CiLintManager"
,
"ProjectCiLint"
,
"ProjectCiLintManager"
]
class
CiLint
(
RESTObject
):
_id_attr
=
None
class
CiLintManager
(
CreateMixin
[
CiLint
]):
_path
=
"/ci/lint"
_obj_cls
=
CiLint
_create_attrs
=
RequiredOptional
(
required
=
(
"content"
,),
optional
=
(
"include_merged_yaml"
,
"include_jobs"
)
)
@
register_custom_action
(
cls_names
=
"CiLintManager"
,
required
=
(
"content"
,),
optional
=
(
"include_merged_yaml"
,
"include_jobs"
),
)
def
validate
(
self
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
None
:
"""Raise an error if the CI Lint results are not valid.
This is a custom python-gitlab method to wrap lint endpoints."""
result
=
self
.
create
(
*
args
,
**
kwargs
)
if
result
.
status
!=
"valid"
:
message
=
",
\n
"
.
join
(
result
.
errors
)
raise
GitlabCiLintError
(
message
)
class
ProjectCiLint
(
RESTObject
):
_id_attr
=
None
class
ProjectCiLintManager
(
GetWithoutIdMixin
[
ProjectCiLint
],
CreateMixin
[
ProjectCiLint
]
):
_path
=
"/projects/{project_id}/ci/lint"
_obj_cls
=
ProjectCiLint
_from_parent_attrs
=
{
"project_id"
:
"id"
}
_optional_get_attrs
=
(
"content_ref"
,
"dry_run"
,
"dry_run_ref"
,
"include_jobs"
,
"ref"
,
)
_create_attrs
=
RequiredOptional
(
required
=
(
"content"
,),
optional
=
(
"dry_run"
,
"include_jobs"
,
"ref"
)
)
@
register_custom_action
(
cls_names
=
"ProjectCiLintManager"
,
required
=
(
"content"
,),
optional
=
(
"dry_run"
,
"include_jobs"
,
"ref"
),
)
def
validate
(
self
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
None
:
"""Raise an error if the Project CI Lint results are not valid.
This is a custom python-gitlab method to wrap lint endpoints."""
result
=
self
.
create
(
*
args
,
**
kwargs
)
if
not
result
.
valid
:
message
=
",
\n
"
.
join
(
result
.
errors
)
raise
GitlabCiLintError
(
message
)
Back
|
FazBrowse Home
|
New Git URL