From 8d7389a2b3d264b2585f459d16f58645dcfedeba Mon Sep 17 00:00:00 2001 From: variableundefined <40092670+variableundefined@users.noreply.github.com> Date: Tue, 24 Sep 2019 20:55:58 -0400 Subject: [PATCH 1/2] Add bitshift and squash merge instructions --- .github/CONTRIBUTING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c1956bc3898..f23092c56c2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -327,6 +327,21 @@ This prevents nesting levels from getting deeper then they need to be. * WRONG: list(a = "b") * RIGHT: list("a" = "b") +#### Bitflags +* We prefer using bitshift operators instead of directly typing out the value. I.E. + ``` + #define MACRO_ONE (1<<0) + #define MACRO_TWO (1<<1) + #define MACRO_THREE (1<<2) + ``` + Is preferable to + ``` + #define MACRO_ONE 0 + #define MACRO_TWO 1 + #define MACRO_THREE 2 + ``` + This make the code more readable and less prone to error + ### Legacy Code SS13 has a lot of legacy code that's never been updated. Here are some examples of common legacy trends which are no longer acceptable: * To display messages to all mobs that can view `src`, you should use @@ -551,3 +566,6 @@ pull requests/issues, and merging/closing pull requests. hours, to allow other coders and the community time to discuss the proposed changes. * If the discussion is active, or the change is controversial, the pull request is to be put on hold until a consensus is reached. +* To keep commit history easy to navigate for future contributors (e.g. Git Blame), squash merge +is to be preferred to normal merge where suitable. Ensure that the squashed commit name is easy +to understand and read. Modify it if needed. From be1edfad12e1815cad1ac6a2548fa95a9ab1f08e Mon Sep 17 00:00:00 2001 From: variableundefined <40092670+variableundefined@users.noreply.github.com> Date: Thu, 26 Sep 2019 12:22:20 -0400 Subject: [PATCH 2/2] And this is exactly why bitshift is a good idea --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f23092c56c2..539d7dd3372 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -336,9 +336,9 @@ This prevents nesting levels from getting deeper then they need to be. ``` Is preferable to ``` - #define MACRO_ONE 0 - #define MACRO_TWO 1 - #define MACRO_THREE 2 + #define MACRO_ONE 1 + #define MACRO_TWO 2 + #define MACRO_THREE 4 ``` This make the code more readable and less prone to error