diff --git a/docs/src/development/linux.md b/docs/src/development/linux.md index b92246e4f9..3a627f6e74 100644 --- a/docs/src/development/linux.md +++ b/docs/src/development/linux.md @@ -128,7 +128,8 @@ Use this when Zed is using a lot of CPU. It is not useful for hangs. On Ubuntu (derivatives) run `sudo apt install linux-tools`. - Perf record: - Run `sudo perf record -p `, wait a few seconds to gather data, then press Ctrl+C. You should now have a `perf.data` file. + Run `sudo perf record -g --call-graph dwarf -p `, wait a few seconds to gather data, then press Ctrl+C. You should now have a `perf.data` file. + The `--call-graph dwarf` part records the callers of every sampled function: without it, the profile shows isolated hot symbols with no way to tell who invoked them, which is rarely enough to act on. - Make the output file user owned: run `sudo chown $USER:$USER perf.data` diff --git a/script/danger/dangerfile.ts b/script/danger/dangerfile.ts index 8718048b8e..919624a861 100644 --- a/script/danger/dangerfile.ts +++ b/script/danger/dangerfile.ts @@ -61,12 +61,39 @@ if (includesIssueUrl) { ); } -const readmeModified = danger.git.modified_files.includes("README.md") || danger.git.created_files.includes("README.md"); +const SELF_REVIEW_MARKER = "Remove this line to confirm you've reviewed this PR before submitting."; + +const readmeModified = + danger.git.modified_files.includes("README.md") || danger.git.created_files.includes("README.md"); if (readmeModified) { schedule(async () => { const readmeDiff = await danger.git.diffForFile("README.md"); - if (readmeDiff && readmeDiff.added.includes("Remove this line to confirm you've reviewed this PR before submitting.")) { - fail("Please self-review your PR before submitting — README.md contains a line that asks to be removed which you should have spotted."); + if (readmeDiff && readmeDiff.added.includes(SELF_REVIEW_MARKER)) { + fail( + "Please self-review your PR before submitting — README.md contains a line that asks to be removed which you should have spotted.", + ); + } + }); +} + +if (danger.git.deleted_files.includes(".rules")) { + fail( + [ + "This PR deletes `.rules`, which contains the mandatory agent self-review rule (the `> [!IMPORTANT]` README marker rule).", + "If the deletion is intentional, move that rule to another rules file in the same PR.", + ].join("\n"), + ); +} else if (danger.git.modified_files.includes(".rules")) { + schedule(async () => { + const rulesDiff = await danger.git.diffForFile(".rules"); + if (rulesDiff && rulesDiff.removed.includes(SELF_REVIEW_MARKER) && !rulesDiff.added.includes(SELF_REVIEW_MARKER)) { + fail( + [ + "This PR removes the mandatory agent self-review rule from `.rules` (the `> [!IMPORTANT]` README marker rule).", + "It has been dropped by accident before and had to be restored in https://github.com/zed-industries/zed/pull/63384.", + "If changing it is intentional, keep an equivalent rule containing the same marker text in `.rules`.", + ].join("\n"), + ); } }); }