From 1389262c3fde956792539e24be24e5e83fb20889 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 16 Aug 2022 11:37:48 +0200 Subject: [PATCH] Let danger check for frozen classes --- docs/danger.md | 1 + tools/danger/dangerfile.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/danger.md b/docs/danger.md index 19728f00e9..acf14018e6 100644 --- a/docs/danger.md +++ b/docs/danger.md @@ -23,6 +23,7 @@ Here are the checks that Danger does so far: - PR description is not empty - Big PR got a warning to recommend to split - PR contains a file for towncrier and extension is checked +- PR does not modify frozen classes - PR contains a Sign-Off, with exception for Element employee contributors - PR with change on layout should include screenshot in the description - PR which adds png file warn about the usage of vector drawables diff --git a/tools/danger/dangerfile.js b/tools/danger/dangerfile.js index 4efd236419..c7db52fa19 100644 --- a/tools/danger/dangerfile.js +++ b/tools/danger/dangerfile.js @@ -52,6 +52,19 @@ if (requiresChangelog) { } } +// check that frozen classes have not been modified +const frozenClasses = [ + "OlmInboundGroupSessionWrapper.kt", + "OlmInboundGroupSessionWrapper2.kt", +] + +frozenClasses.forEach(frozen => { + if (editedFiles.some(file => file.endsWith(frozen))) { + fail("Frozen class `" + frozen + "` has been modified. Please do not modify frozen class.") + } + } +) + // Check for a sign-off const signOff = "Signed-off-by:"