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
2 changes: 1 addition & 1 deletion _appmap/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class HttpServerRequestEvent(MessageEvent):

__slots__ = ["http_server_request"]

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments
def __init__(
self,
request_method,
Expand Down
4 changes: 3 additions & 1 deletion _appmap/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class FilterableFn(
):
__slots__ = ()

def __new__(cls, scope, fn_name, fn, static_fn, auxtype=None): # pylint: disable=too-many-arguments
def __new__(
cls, scope, fn_name, fn, static_fn, auxtype=None
): # pylint: disable=too-many-arguments,too-many-positional-arguments
fqname = "%s.%s" % (scope.fqname, fn_name)
self = super(FilterableFn, cls).__new__(cls, scope.scope, fqname, fn, static_fn, auxtype)
return self
Expand Down
2 changes: 1 addition & 1 deletion _appmap/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def save_at_exit():
now = datetime.now(timezone.utc)
iso_time = now.isoformat(timespec="seconds").replace("+00:00", "Z")
process_id = os.getpid()
appmap_name = f"{iso_time}_{process_id}"
appmap_name = f"{iso_time}-{process_id}".replace(":","-")
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line makes two changes that should be documented separately:

  1. Replaces colons in the timestamp with hyphens (to fix Windows compatibility)
  2. Changes the separator between timestamp and process_id from underscore to hyphen

The PR description only mentions the first change. While both changes work correctly, the separator change appears to be unintentional or at least undocumented.

Additionally, the suggested fix in issue #377 was to remove colons entirely using .replace(':', ''), but this implementation replaces them with hyphens instead. Both approaches are valid for Windows compatibility, but this deviation from the suggested fix should be acknowledged.

Consider either:

  • Reverting the separator to underscore: f"{iso_time.replace(':', '-')}_{process_id}"
  • Or documenting why the hyphen separator is preferred over underscore

Copilot uses AI. Check for mistakes.
recorder_type = "process"
metadata = {
"name": appmap_name,
Expand Down
2 changes: 1 addition & 1 deletion _appmap/test/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def test_missing_packages(self, tmpdir):
self.check_default_config(Path(tmpdir).name)

class TestSearchConfig:
# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments

def test_config_in_parent_folder(self, data_dir, tmpdir, monkeypatch):
copytree(data_dir / "config-up", str(tmpdir), dirs_exist_ok=True)
Expand Down
2 changes: 1 addition & 1 deletion _appmap/test/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_template(events):
class ClientAdaptor(django.test.Client):
"""Adaptor for the client request parameters used in .web_framework tests."""

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments
def generic(
self,
method,
Expand Down
24 changes: 24 additions & 0 deletions _appmap/test/test_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,27 @@ def test_process_recording(data_dir, shell, tmp_path):
actual = json.loads(appmap_files[0].read_text())
assert len(actual["events"]) > 0
assert len(actual["classMap"]) > 0


def test_process_recording_filename_is_sanitized(data_dir, shell, tmp_path):
fixture = data_dir / "package1"
tmp = tmp_path / "process"
copytree(fixture, str(tmp / "package1"), dirs_exist_ok=True)
copy(data_dir / "appmap.yml", str(tmp))
copytree(data_dir / "flask" / "init", str(tmp / "init"), dirs_exist_ok=True)

ret = shell.run(
"python",
"-m",
"package1.package2",
env={"PYTHONPATH": "init", "APPMAP_RECORD_PROCESS": "true"},
cwd=tmp,
)
assert ret.returncode == 0

appmap_dir = tmp / "tmp" / "appmap" / "process"
appmap_files = list(appmap_dir.glob("*.appmap.json"))
assert len(appmap_files) == 1, "this only fails when run from VS Code?"

filename = appmap_files[0].name
assert ":" not in filename
6 changes: 3 additions & 3 deletions _appmap/web_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def name_hash(namepart):
return sha256(os.fsencode(namepart)).hexdigest()


# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments
def create_appmap_file(
output_dir,
request_method,
Expand Down Expand Up @@ -142,7 +142,7 @@ def before_request_main(self, rec, req: Any) -> Tuple[float, int]:
"""Specify the main operations to be performed by a request is processed."""
raise NotImplementedError

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments
def after_request_main(
self, request_path, status, headers, start, call_event_id
) -> Optional[HttpServerResponseEvent]:
Expand Down Expand Up @@ -193,7 +193,7 @@ def before_request_hook(self, request) -> Tuple[Optional[Recorder], float, int]:

return rec, start, call_event_id

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments,too-many-positional-arguments
def after_request_hook(
self,
request_path,
Expand Down
4 changes: 3 additions & 1 deletion appmap/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def __init__(self):
self.recorder = Recorder.get_current()

# This signature is correct, the implementation confuses pylint:
def __call__(self, execute, sql, params, many, context): # pylint: disable=too-many-arguments
def __call__(
self, execute, sql, params, many, context
): # pylint: disable=too-many-arguments,too-many-positional-arguments
start = time.monotonic()
try:
return execute(sql, params, many, context)
Expand Down
2 changes: 1 addition & 1 deletion appmap/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pytest_django.django_compat import is_django_unittest
except ImportError:

def is_django_unittest(item):
def is_django_unittest(_item):
return False


Expand Down
4 changes: 2 additions & 2 deletions appmap/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@event.listens_for(Engine, "before_cursor_execute")
# pylint: disable=too-many-arguments,unused-argument
# pylint: disable=too-many-arguments,unused-argument,too-many-positional-arguments
def capture_sql_call(conn, cursor, statement, parameters, context, executemany):
"""Capture SQL query call into appmap."""
if is_instrumentation_disabled():
Expand Down Expand Up @@ -45,7 +45,7 @@ def capture_sql_call(conn, cursor, statement, parameters, context, executemany):


@event.listens_for(Engine, "after_cursor_execute")
# pylint: disable=too-many-arguments,unused-argument
# pylint: disable=too-many-arguments,unused-argument,too-many-positional-arguments
def capture_sql(conn, cursor, statement, parameters, context, executemany):
"""Capture SQL query return into appmap."""
if is_instrumentation_disabled():
Expand Down
Loading