FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
devloop/devloop/scripts/run_validate.py at v0.3.1 · compforge/devloop · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
compforge
/
devloop
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
devloop
/
devloop
/
scripts
/
run_validate.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (48 loc) · 2 KB
Breadcrumbs
devloop
/
devloop
/
scripts
/
run_validate.py
Copy path
File metadata and controls
56 lines (48 loc) · 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
#!/usr/bin/env python3
"""validate skill 的完整入口:normalize 后并发执行 lint/test checks,聚合 Component 结果。"""
from
__future__
import
annotations
import
sys
from
concurrent
.
futures
import
ThreadPoolExecutor
from
pathlib
import
Path
HERE
=
Path
(
__file__
).
resolve
().
parent
sys
.
path
.
insert
(
0
,
str
(
HERE
.
parent
))
from
domain
import
repo
as
repo_model
# noqa: E402
from
domain
.
context
import
record_active_repo
# noqa: E402
from
domain
.
lifecycle
import
checks
# noqa: E402
from
lib
import
cli
# noqa: E402
def
main
(
argv
:
list
[
str
])
->
int
:
ap
=
cli
.
ArgParser
(
prog
=
"run_validate.py"
,
description
=
"normalize, then run Component validation checks."
,
)
cli
.
add_repo_arg
(
ap
)
ns
=
ap
.
parse_args
(
argv
)
resolved
,
how
=
cli
.
resolve_repo_or_exit
(
ns
,
"run_validate"
)
repo
=
resolved
.
git_root
workset
=
repo_model
.
select_components
(
repo
,
explicit
=
resolved
.
target_path
)
if
how
!=
"cwd"
:
print
(
f"run_validate: repo =
{
repo
}
(
{
how
}
)"
)
names
=
", "
.
join
(
Path
(
component
.
path
).
name
for
component
in
workset
.
components
)
print
(
f"run_validate: components =
{
names
}
[
{
workset
.
reason
}
]"
)
record_active_repo
(
repo
)
ok
=
True
for
component
in
workset
.
components
:
prepared
=
checks
.
normalize
(
repo
,
capture
=
False
,
component
=
component
)
if
not
prepared
.
ok
:
print
(
"✗ "
+
prepared
.
summary
)
ok
=
False
continue
with
ThreadPoolExecutor
(
max_workers
=
2
)
as
executor
:
futures
=
[
executor
.
submit
(
checks
.
lint
,
repo
,
component
=
component
),
executor
.
submit
(
checks
.
test
,
repo
,
component
=
component
),
]
results
=
[
future
.
result
()
for
future
in
futures
]
for
result
in
results
:
print
((
"✓ "
if
result
.
ok
else
"✗ "
)
+
result
.
summary
)
for
guidance
in
result
.
guidance
:
print
(
f" -
{
guidance
}
"
)
ok
=
ok
and
result
.
ok
return
0
if
ok
else
1
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
[
1
:]))
Back
|
FazBrowse Home
|
New Git URL