From 2d3c31e23986fd474ccf64f078b9be66a4073d20 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 24 Nov 2023 19:50:55 +0100 Subject: [PATCH 1/3] Update pre-commit linters to the latest versions Changes produced by `pre-commit autoupdate`. Signed-off-by: Christian Clauss --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb9b5a1270..538da4555a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: "^(src/memray/reporters/templates/assets|src/vendor|benchmarks|docs/_static/flamegraphs)/" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-json @@ -26,7 +26,7 @@ repos: args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.11.0 hooks: - id: black @@ -37,12 +37,12 @@ repos: exclude_types: [python] - repo: https://github.com/sphinx-contrib/sphinx-lint - rev: v0.6.7 + rev: v0.9.0 hooks: - id: sphinx-lint - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v3.1.0 hooks: - id: prettier args: [--no-editorconfig] @@ -50,7 +50,7 @@ repos: exclude_types: [html] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.2 + rev: v17.0.5 hooks: - id: clang-format args: [--Werror, -i] @@ -58,7 +58,7 @@ repos: types_or: [c++, c, cuda] - repo: https://github.com/rstcheck/rstcheck - rev: v6.1.2 + rev: v6.2.0 hooks: - id: rstcheck files: ^news/ From f4204bcdd3d21360cabbe9ca6d6dd9a7c164b743 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 24 Nov 2023 19:50:55 +0100 Subject: [PATCH 2/3] lint: Update code to latest linter standards Signed-off-by: Christian Clauss --- docs/_static/css/custom.css | 4 +++- src/memray/reporters/assets/common.test.js | 10 +++++----- .../reporters/assets/temporal_flamegraph.js | 16 ++++++++-------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index 70c28a0f9e..6d026a72ed 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -212,7 +212,9 @@ a:hover { border-right: 0.15em solid #31373e; white-space: nowrap; margin: 0 auto; - animation: typing 2.75s steps(40, end), blink-caret 0.75s step-end infinite; + animation: + typing 2.75s steps(40, end), + blink-caret 0.75s step-end infinite; } @keyframes typing { diff --git a/src/memray/reporters/assets/common.test.js b/src/memray/reporters/assets/common.test.js index a404482ad4..0ca61ed15c 100644 --- a/src/memray/reporters/assets/common.test.js +++ b/src/memray/reporters/assets/common.test.js @@ -22,7 +22,7 @@ describe("Flame graph tooltip generation", () => { thread_id: "merged thread", }; expect(makeTooltipString(data, "1KiB", true)).toBe( - "File foo.py, line 10 in foo
1KiB total
3 allocations" + "File foo.py, line 10 in foo
1KiB total
3 allocations", ); }); @@ -33,7 +33,7 @@ describe("Flame graph tooltip generation", () => { thread_id: "0x1", }; expect(makeTooltipString(data, "1KiB", false)).toBe( - "File foo.py, line 10 in foo
1KiB total
3 allocations
Thread ID: 0x1" + "File foo.py, line 10 in foo
1KiB total
3 allocations
Thread ID: 0x1", ); }); test("Generate label with single allocation", () => { @@ -43,7 +43,7 @@ describe("Flame graph tooltip generation", () => { thread_id: "0x1", }; expect(makeTooltipString(data, "1KiB", false)).toBe( - "File foo.py, line 10 in foo
1KiB total
1 allocation
Thread ID: 0x1" + "File foo.py, line 10 in foo
1KiB total
1 allocation
Thread ID: 0x1", ); }); }); @@ -114,8 +114,8 @@ describe("Filter threads", () => { thread_id: "0x0", children: [], }, - 2 - ) + 2, + ), ).toStrictEqual({ thread_id: "0x0", children: [], diff --git a/src/memray/reporters/assets/temporal_flamegraph.js b/src/memray/reporters/assets/temporal_flamegraph.js index bce2880e33..7765a350a7 100644 --- a/src/memray/reporters/assets/temporal_flamegraph.js +++ b/src/memray/reporters/assets/temporal_flamegraph.js @@ -85,7 +85,7 @@ function findHWMAllocations( intervals, node_objects, hwmSnapshot, - parent_index_by_child_index + parent_index_by_child_index, ) { intervals.forEach((interval) => { let [allocBefore, deallocBefore, nodeIndex, count, bytes] = interval; @@ -108,7 +108,7 @@ function findLeakedAllocations( node_objects, rangeStart, rangeEnd, - parent_index_by_child_index + parent_index_by_child_index, ) { intervals.forEach((interval) => { let [allocBefore, deallocBefore, nodeIndex, count, bytes] = interval; @@ -150,7 +150,7 @@ function packedDataToTree(packedData, rangeStart, rangeEnd) { " is " + hwmBytes + " at " + - hwmSnapshot + hwmSnapshot, ); let plotUpdate = { shapes: [] }; @@ -197,14 +197,14 @@ function packedDataToTree(packedData, rangeStart, rangeEnd) { flamegraphIntervals, flamegraphNodeObjects, hwmSnapshot, - parent_index_by_child_index + parent_index_by_child_index, ); if (inverted) { findHWMAllocations( invertedNoImportsIntervals, invertedNoImportsNodeObjects, hwmSnapshot, - inverted_no_imports_parent_index_by_child_index + inverted_no_imports_parent_index_by_child_index, ); } } else { @@ -215,7 +215,7 @@ function packedDataToTree(packedData, rangeStart, rangeEnd) { flamegraphNodeObjects, rangeStart, rangeEnd, - parent_index_by_child_index + parent_index_by_child_index, ); if (inverted) { findLeakedAllocations( @@ -223,7 +223,7 @@ function packedDataToTree(packedData, rangeStart, rangeEnd) { invertedNoImportsNodeObjects, rangeStart, rangeEnd, - inverted_no_imports_parent_index_by_child_index + inverted_no_imports_parent_index_by_child_index, ); } } @@ -400,7 +400,7 @@ function main() { console.log("main"); const unique_threads = packed_data.unique_threads.map( - (tid) => packed_data.strings[tid] + (tid) => packed_data.strings[tid], ); initThreadsDropdown({ unique_threads: unique_threads }, merge_threads); From e9bc3d779050242d707038de4acf923332b541ca Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 24 Nov 2023 14:45:52 -0500 Subject: [PATCH 3/3] ci: Ensure `prettier` runs with the right NodeJS It seems that it wants to pick up a binary called `nodejs`, while `actions/setup-node` is only installing one called `node`. Let's hack around this with a symlink. Signed-off-by: Matt Wozniski --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dfca5e12a..be2f9a8b54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,6 +110,8 @@ jobs: uses: actions/setup-node@v4 with: node-version: 16 + - name: Symlink node as nodejs + run: ln -sf "$(which node)" "$(which node)js" - name: Set up Python uses: actions/setup-python@v4 with: