Skip to content

Commit 16ae5d4

Browse files
committed
need these fixes for custoemr-facing issue
1 parent 6548afa commit 16ae5d4

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

socketsecurity/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ def create_argument_parser() -> argparse.ArgumentParser:
266266
action="store_true",
267267
help="Output in JSON format"
268268
)
269+
output_group.add_argument(
270+
"--enable_json",
271+
dest="enable_json",
272+
action="store_true",
273+
help=argparse.SUPPRESS
274+
)
269275
output_group.add_argument(
270276
"--enable-sarif",
271277
dest="enable_sarif",

socketsecurity/core/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,25 @@ def find_files(path: str) -> List[str]:
149149
for file_name in patterns:
150150
pattern = Core.to_case_insensitive_regex(patterns[file_name]["pattern"])
151151
file_path = f"{path}/**/{pattern}"
152-
log.debug(f"Globbing {file_path}")
152+
# log.debug(f"Globbing {file_path}")
153153
glob_start = time.time()
154154
glob_files = glob(file_path, recursive=True)
155155
for glob_file in glob_files:
156156
if glob_file not in files:
157157
files.add(glob_file)
158158
glob_end = time.time()
159159
glob_total_time = glob_end - glob_start
160-
log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
160+
# log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
161161

162162
log.debug("Finished Find Files")
163163
end_time = time.time()
164164
total_time = end_time - start_time
165165
log.info(f"Found {len(files)} in {total_time:.2f} seconds")
166-
log.debug(f"Files found: {list(files)}")
166+
files_list = list(files)
167+
if len(files_list) > 5:
168+
log.debug(f"{len(files_list)} Files found: {', '.join(files_list[:5])}, ...")
169+
else:
170+
log.debug(f"{len(files_list)} Files found: {', '.join(files_list)}")
167171
return list(files)
168172

169173
@staticmethod
@@ -461,15 +465,15 @@ def create_new_diff(
461465
no_change: bool = False
462466
) -> Diff:
463467
"""Create a new diff using the Socket SDK."""
464-
log.debug(f"starting create_new_diff with no_change: {no_change}")
465468
if no_change:
469+
log.debug(f"starting create_new_diff with no_change: {no_change}")
466470
return Diff(id="no_diff_id")
467471

468472
# Find manifest files
469473
files = self.find_files(path)
470474
files_for_sending = self.load_files_for_sending(files, path)
471475

472-
log.debug(f"files: {files} found at path {path}")
476+
473477
if not files:
474478
return Diff(id="no_diff_id")
475479

socketsecurity/core/scm/github.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ def from_env(cls, pr_number: Optional[str] = None) -> 'GithubConfig':
5454
owner = repository.split('/')[0]
5555
repository = repository.split('/')[1]
5656

57-
is_default = os.getenv('DEFAULT_BRANCH', '').lower() == 'true'
57+
default_branch_env = os.getenv('DEFAULT_BRANCH')
58+
# Consider the variable truthy if it exists and isn't explicitly 'false'
59+
is_default = default_branch_env is not None and default_branch_env.lower() != 'false'
60+
5861
return cls(
5962
sha=os.getenv('GITHUB_SHA', ''),
6063
api_url=os.getenv('GITHUB_API_URL', ''),

socketsecurity/socketcli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def main_code():
146146
integration_type = config.integration_type
147147
integration_org_slug = config.integration_org_slug or org_slug
148148

149+
log.debug(f"config: {config.to_dict()}")
149150
params = FullScanParams(
150151
org_slug=org_slug,
151152
integration_type=integration_type,
@@ -159,6 +160,7 @@ def main_code():
159160
make_default_branch=config.default_branch,
160161
set_as_pending_head=True
161162
)
163+
log.debug(f"Params initially set to: {params}")
162164

163165
# Initialize diff
164166
diff = Diff()

0 commit comments

Comments
 (0)