Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 56c949a

Browse files
fix: add tons of log statements
1 parent 18f9d42 commit 56c949a

File tree

4 files changed

+112
-2
lines changed

4 files changed

+112
-2
lines changed

.github/workflows/build_assets.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
name: Build Compiled Assets
33

44
on:
5+
workflow_dispatch:
6+
inputs:
7+
release:
8+
type: boolean
9+
default: false
10+
description: "Attach artifacts to a release"
511
workflow_call:
612
inputs:
713
release:

codecov_cli/helpers/folder_searcher.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,42 @@ def search_files(
5757
search_for_directories (bool)
5858
5959
"""
60+
logger.debug(
61+
"search_files",
62+
extra=dict(
63+
extra_log_attributes=dict(
64+
local_args=locals(),
65+
),
66+
),
67+
)
6068
this_is_included = functools.partial(
6169
_is_included, filename_include_regex, multipart_include_regex
6270
)
6371
this_is_excluded = functools.partial(
6472
_is_excluded, filename_exclude_regex, multipart_exclude_regex
6573
)
6674
for dirpath, dirnames, filenames in os.walk(folder_to_search):
75+
logger.debug(
76+
"search_files.os_walk",
77+
extra=dict(
78+
extra_log_attributes=dict(
79+
folder_to_search=folder_to_search,
80+
dirpath=dirpath,
81+
dirnames=dirnames,
82+
filenames=filenames,
83+
),
84+
),
85+
)
6786
dirs_to_remove = set(d for d in dirnames if d in folders_to_ignore)
87+
logger.debug(
88+
"search_files.dirs_to_remove",
89+
extra=dict(
90+
extra_log_attributes=dict(
91+
dirs_to_remove=dirs_to_remove,
92+
folders_to_ignore=folders_to_ignore,
93+
),
94+
),
95+
)
6896

6997
if multipart_exclude_regex is not None:
7098
dirs_to_remove.union(
@@ -80,6 +108,16 @@ def search_files(
80108
# This is the documented way of doing this on python docs
81109
dirnames.remove(directory)
82110

111+
logger.debug(
112+
"search_files.post_dir_removal",
113+
extra=dict(
114+
extra_log_attributes=dict(
115+
dirnames=dirnames,
116+
search_for_directories=search_for_directories,
117+
),
118+
),
119+
)
120+
83121
if search_for_directories:
84122
for directory in dirnames:
85123
dir_path = pathlib.Path(dirpath) / directory
@@ -88,6 +126,18 @@ def search_files(
88126
else:
89127
for single_filename in filenames:
90128
file_path = pathlib.Path(dirpath) / single_filename
129+
logger.debug(
130+
"search_files.search_for_filenames",
131+
extra=dict(
132+
extra_log_attributes=dict(
133+
single_filename=single_filename,
134+
file_path=file_path,
135+
is_excluded=this_is_excluded(file_path),
136+
is_included=this_is_included(file_path),
137+
yield_it=(not this_is_excluded(file_path) and this_is_included(file_path)),
138+
),
139+
),
140+
)
91141
if not this_is_excluded(file_path) and this_is_included(file_path):
92142
yield file_path
93143

codecov_cli/helpers/versioning_systems.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,50 @@ def get_fallback_value(self, fallback_field: FallbackFieldEnum):
191191
def list_relevant_files(
192192
self, directory: t.Optional[Path] = None, recurse_submodules: bool = False
193193
) -> t.List[str]:
194+
logger.debug(
195+
"NoVersioningSystem.list_relevant_files.start",
196+
extra=dict(
197+
extra_log_attributes=dict(
198+
directory=directory,
199+
recurse_submodules=recurse_submodules,
200+
),
201+
),
202+
)
194203
dir_to_use = directory or self.get_network_root()
204+
logger.debug(
205+
"NoVersioningSystem.list_relevant_files.dir_to_use",
206+
extra=dict(
207+
extra_log_attributes=dict(
208+
dir_to_use=dir_to_use,
209+
),
210+
)
211+
)
195212
if dir_to_use is None:
196213
raise ValueError("Can't determine root folder")
197214

198215
files = search_files(
199216
dir_to_use, folders_to_ignore=[], filename_include_regex=re.compile("")
200217
)
201-
return [f.relative_to(dir_to_use).as_posix() for f in files]
218+
logger.debug(
219+
"NoVersioningSystem.list_relevant_files.files",
220+
extra=dict(
221+
extra_log_attributes=dict(
222+
dir_to_use=dir_to_use,
223+
files=files,
224+
),
225+
),
226+
)
227+
228+
return_files = []
229+
for f in files:
230+
return_files.append(f.relative_to(dir_to_use).as_posix())
231+
logger.debug(
232+
"NoVersioningSystem.list_relevant_files.return_files",
233+
extra=dict(
234+
extra_log_attributes=dict(
235+
dir_to_use=dir_to_use,
236+
return_files=return_files,
237+
),
238+
),
239+
)
240+
return return_files

codecov_cli/services/upload/network_finder.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import logging
12
import pathlib
23
import typing
34

45
from codecov_cli.helpers.versioning_systems import VersioningSystemInterface
56

7+
logger = logging.getLogger("codecovcli")
8+
69

710
class NetworkFinder(object):
811
def __init__(
@@ -24,13 +27,25 @@ def find_files(self, ignore_filters=False) -> typing.List[str]:
2427
self.network_root_folder, self.recurse_submodules
2528
)
2629

30+
logger.debug(
31+
"NetworkFinder.find_files",
32+
extra=dict(
33+
extra_log_attributes=dict(
34+
files=files,
35+
ignore_filters=ignore_filters,
36+
network_root_folder=self.network_root_folder,
37+
recurse_submodules=self.recurse_submodules,
38+
),
39+
),
40+
)
41+
2742
if files and not ignore_filters:
2843
if self.network_filter:
2944
files = [file for file in files if file.startswith(self.network_filter)]
3045
if self.network_prefix:
3146
files = [self.network_prefix + file for file in files]
3247

33-
return files
48+
return files or []
3449

3550

3651
def select_network_finder(

0 commit comments

Comments
 (0)