Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .tekton/on-cm-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ spec:

resources:
requests:
cpu: "1000m" # CPU request (1 core)
cpu: "3000m" # CPU request (3 cores)
memory: "12Gi" # Memory request (8 gigabytes)
limits:
cpu: "2000m" # CPU limit (2 cores)
cpu: "3000m" # CPU limit (3 cores)
memory: "32Gi" # Memory limit (16 gigabytes)

volumeMounts:
Expand Down Expand Up @@ -188,6 +188,10 @@ spec:
value: "$(params.TRIGGER_COMMENT)"
- name: GOMODCACHE
value: "/exploit-iq-data/go/pkg/mod"
- name: GOCACHE
value: "/exploit-iq-data/go/cache"
- name: MAVEN_OPTS
value: "-Dmaven.repo.local=/exploit-iq-data/maven"
- name: UV_CACHE_DIR
value: "/tmp/uv-cache"
- name: SERPAPI_BASE_URL
Expand Down
7 changes: 6 additions & 1 deletion .tekton/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ spec:
export MAVEN_HOME="$HOME/maven-sdk/apache-maven-${MAVEN_VERSION}"
export M2_HOME="$MAVEN_HOME"
export PATH="$MAVEN_HOME/bin:$PATH"

export MAVEN_OPTS="-Dmaven.repo.local=/exploit-iq-data/maven"

echo "Maven version:"
mvn -v

Expand Down Expand Up @@ -369,6 +370,10 @@ spec:
# Pass the raw comment text into the container
- name: GOMODCACHE
value: "/exploit-iq-data/go/pkg/mod"
- name: GOCACHE
value: "/exploit-iq-data/go/cache"
- name: MAVEN_OPTS
value: "-Dmaven.repo.local=/exploit-iq-data/maven"
- name: UV_CACHE_DIR
value: "/tmp/uv-cache"
- name: UV_PYTHON_INSTALL_DIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,122 @@ def is_constructor_header(hstart: int, name_start: int) -> bool:
# No declaration found, and snippet didn't begin with a lambda
return ""

@staticmethod
def _count_call_args(s: str, open_idx: int, close_idx: int) -> int:
"""Count top-level arguments in s[open_idx+1 : close_idx].

Respects nested parens, brackets, angle brackets, string/char literals.
Returns 0 for empty parens, otherwise comma_count + 1.
"""
inner = s[open_idx + 1:close_idx]
if not inner.strip():
return 0
commas_with_angles = 0
commas_without_angles = 0
depth_p = depth_b = depth_a = 0
in_str = in_chr = False
prev_esc = False
for ch in inner:
if in_str:
if prev_esc:
prev_esc = False
continue
if ch == '\\':
prev_esc = True
continue
if ch == '"':
in_str = False
continue
if in_chr:
if prev_esc:
prev_esc = False
continue
if ch == '\\':
prev_esc = True
continue
if ch == "'":
in_chr = False
continue
if ch == '"':
in_str = True
continue
if ch == "'":
in_chr = True
continue
if ch == '(':
depth_p += 1
elif ch == ')':
depth_p -= 1
elif ch == '[':
depth_b += 1
elif ch == ']':
depth_b -= 1
elif ch == '<':
depth_a += 1
elif ch == '>' and depth_a > 0:
depth_a -= 1
elif ch == ',' and depth_p == 0 and depth_b == 0:
commas_without_angles += 1
if depth_a == 0:
commas_with_angles += 1
if depth_a == 0:
return commas_with_angles + 1
return commas_without_angles + 1

@staticmethod
def _count_call_args_no_angles(s: str, open_idx: int, close_idx: int) -> int:
"""Count top-level arguments ignoring angle brackets entirely.

Treats all ``<`` / ``>`` as operators (comparisons, shifts) so that
commas between e.g. ``x < 10, y > 5`` are correctly counted.
Only parentheses and square brackets affect nesting depth.
"""
inner = s[open_idx + 1:close_idx]
if not inner.strip():
return 0
commas = 0
depth_p = depth_b = 0
in_str = in_chr = False
prev_esc = False
for ch in inner:
if in_str:
if prev_esc:
prev_esc = False
continue
if ch == '\\':
prev_esc = True
continue
if ch == '"':
in_str = False
continue
if in_chr:
if prev_esc:
prev_esc = False
continue
if ch == '\\':
prev_esc = True
continue
if ch == "'":
in_chr = False
continue
if ch == '"':
in_str = True
continue
if ch == "'":
in_chr = True
continue
if ch == '(':
depth_p += 1
elif ch == ')':
depth_p -= 1
elif ch == '[':
depth_b += 1
elif ch == ']':
depth_b -= 1
elif ch == ',' and depth_p == 0 and depth_b == 0:
commas += 1
return commas + 1

def search_for_called_function(
self,
caller_function: Document,
Expand Down Expand Up @@ -1054,6 +1170,23 @@ def _method_ref_lhs_start(s: str, dc_idx: int, max_back: int = 512) -> int:
re.MULTILINE,
)

# ---------------------------
# Callee parameter count (for argument-count pre-filter on regular method calls)
# ---------------------------
_callee_sig = extract_method_name_with_params(callee_function.page_content)
if _callee_sig and _callee_sig != "lambda":
_paren_open = _callee_sig.index('(')
_paren_close = _callee_sig.rindex(')')
_params_str = _callee_sig[_paren_open + 1:_paren_close]
_callee_has_varargs = '...' in _params_str
if not _params_str.strip():
_callee_param_count = 0
else:
_callee_param_count = self._count_call_args(_callee_sig, _paren_open, _paren_close)
else:
_callee_param_count = -1
_callee_has_varargs = False

callee_function_source = callee_function.metadata['source']

# CHANGED: get_class_name_from_class_function now returns FQCN (possibly inner).
Expand Down Expand Up @@ -1175,17 +1308,23 @@ def _process_call(start_idx: int, open_paren_pos: int) -> bool:
):
logger.debug(
"__check_identifier_resolved_to_callee_function_package resolved successfully - "
f"callee_function_name={callee_function_name}, identifier_function={ident_snippet}, "
f"target_class_names={target_class_names}, \ncaller_function_source={caller_function.metadata['source']}"
f", \ncaller_function={caller_function.page_content}"
"callee_function_name=%s, identifier_function=%s, "
"target_class_names=%s, \ncaller_function_source=%s"
", \ncaller_function=%s",
callee_function_name, ident_snippet,
target_class_names, caller_function.metadata['source'],
caller_function.page_content,
)
return True

logger.debug(
"__check_identifier_resolved_to_callee_function_package resolved unsuccessfully - "
f"callee_function_name={callee_function_name}, identifier_function={ident_snippet}, "
f"target_class_names={target_class_names}, \ncaller_function_source={caller_function.metadata['source']}"
f", \ncaller_function={caller_function.page_content}"
"callee_function_name=%s, identifier_function=%s, "
"target_class_names=%s, \ncaller_function_source=%s"
", \ncaller_function=%s",
callee_function_name, ident_snippet,
target_class_names, caller_function.metadata['source'],
caller_function.page_content,
)
return False

Expand Down Expand Up @@ -1244,6 +1383,15 @@ def _process_method_ref(dc_idx: int, ref_len: int, make_ctor: bool) -> bool:
if nxt == '{' or nxt == 'throws':
continue

if _callee_param_count >= 0 and not _callee_has_varargs:
call_arg_count = self._count_call_args(caller_function_body, open_paren_pos, close_paren_pos)
if call_arg_count != _callee_param_count:
call_arg_count_no_angles = self._count_call_args_no_angles(
caller_function_body, open_paren_pos, close_paren_pos
)
if call_arg_count_no_angles != _callee_param_count:
continue

if _process_call(m.start(), open_paren_pos):
return True

Expand Down
Loading