From 52664a527fd227201992a3b6b27e510e51e7c230 Mon Sep 17 00:00:00 2001 From: Elmehdi Aitbrahim Date: Sun, 16 Aug 2026 19:28:30 -0400 Subject: [PATCH] docs(conduct): adopt the Contributor Covenant, with a stance on religious disagreement A project inviting international contributors around a religious topic needs a stated behavioural baseline before it needs one (#284). Canonical Covenant text (GitHub's copy, not retyped), enforcement contact filled in, and one project-specific addition: disagreement about a ruling is expected and legitimate; disparaging a madhhab, a school, or a contributor's practice is not -- and the route for technical disagreement is a local attestation or the Compliance & classification category, never a person. tests/test_code_of_conduct.py pins the Covenant headings, the filled contact, and the stance. --- CODE_OF_CONDUCT.md | 151 ++++++++++++++++++++++++++++++++++ tests/test_code_of_conduct.py | 102 +++++++++++++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 tests/test_code_of_conduct.py diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..5590cd92 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,151 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +eaitbrahim@gmail.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. + + +## A note on religious disagreement (project-specific addition) + +This project exists at the intersection of code and Shariah compliance, and its contributors +will disagree about rulings — what counts as riba exposure, whether a wrapper is permissible, +how a token should be classified. **That disagreement is expected and legitimate.** It is not +disloyalty, not trolling, and not a conduct problem. + +What is NOT legitimate, and what this code of conduct will enforce exactly as it enforces any +other harassment: + +- **Disparaging a madhhab, a school of thought, a scholar, or a contributor's own practice.** + "The Hanafi position on X is wrong" is an argument; "nobody serious follows that" is an + attack. The first belongs in a discussion, the second belongs in an enforcement report. +- **Presuming another contributor's level of religious observance**, or demanding they meet + yours before their technical contribution counts. + +The technical route for a disagreement about a classification is a **local attestation** — +record your ruling, with your source, in your own deployment (`keel assets attest`; see +`CONTRIBUTING.md`'s governance section) — or a post in the *Compliance & classification* +category on Discussions. It is not an argument in a pull-request thread, and it is never a +remark about the person who holds the other view. diff --git a/tests/test_code_of_conduct.py b/tests/test_code_of_conduct.py new file mode 100644 index 00000000..ae70362c --- /dev/null +++ b/tests/test_code_of_conduct.py @@ -0,0 +1,102 @@ +"""CODE_OF_CONDUCT.md: a behavioural baseline, before an international community arrives. + +A project inviting international contributors around a religious topic needs a stated +baseline before it needs anything else (#284): the moment disagreement about a ruling can +read as disrespect about someone's practice, the project is one heated thread away from +losing a contributor it will not get back. + +Two failure shapes these tests guard: + +- **A homemade conduct policy.** The Contributor Covenant is the sane default precisely + because it is battle-tested language with known edge cases already litigated; a rewrite + starts from zero and reads as whatever its author already believed. The canonical section + headings are pinned so the file stays recognisably the Covenant. +- **An unfilled template.** A `[INSERT CONTACT METHOD]` left in place gives an enforcement + section that reaches nobody -- the same shape as an unfilled licence appendix, trusted + and dead. The contact must be present and unfilled simultaneously impossible. + +And one project-specific addition the Covenant cannot supply: a stance on religious +disagreement itself, which here is expected and legitimate while disparagement is not -- +with the local-attestation route named as where technical disagreement belongs. +""" + +from __future__ import annotations + +from pathlib import Path + +_ROOT = Path(__file__).resolve().parents[1] + +#: Section headings of the canonical Contributor Covenant; their presence is what makes the +#: file the Covenant rather than a bespoke policy with the same filename. +_COVENANT_MARKERS = ( + "# Contributor Covenant Code of Conduct", + "## Our Pledge", + "## Our Standards", + "## Enforcement", + "## Attribution", +) + + +def _coc() -> str: + path = _ROOT / "CODE_OF_CONDUCT.md" + assert path.is_file(), ( + "CODE_OF_CONDUCT.md does not exist at the repo root -- the project invites " + "international contributors around a religious topic with no behavioural baseline (#284)" + ) + return path.read_text() + + +def test_the_file_is_the_contributor_covenant_not_a_homemade_policy(): + """Every canonical section heading present: battle-tested text, not a first draft.""" + text = _coc() + missing = [marker for marker in _COVENANT_MARKERS if marker not in text] + assert not missing, ( + f"CODE_OF_CONDUCT.md is missing the Covenant's own section headings: {missing}. " + "The point of adopting the Covenant is not to write one from scratch" + ) + + +def test_no_placeholder_is_left_unfilled(): + """An unfilled template is a conduct policy that reaches nobody. + + GitHub's canonical text ships with `[INSERT CONTACT METHOD]`; leaving it in is the + classic mistake, and it is invisible -- the section reads as configured while the + enforcement channel is a blank. + """ + assert "[INSERT" not in _coc(), ( + "CODE_OF_CONDUCT.md still carries an unfilled placeholder -- fill in the contact " + "method so the enforcement section reaches a human" + ) + + +def test_an_enforcement_contact_that_reaches_someone_is_named(): + """A concrete, reachable contact; 'the maintainers' is not an address.""" + import re + + assert re.search(r"[\w.+-]+@[\w-]+\.[\w.]+", _coc()), ( + "CODE_OF_CONDUCT.md must name a concrete enforcement contact (an address, not a role)" + ) + + +def test_religious_disagreement_has_a_stance(): + """The project-specific addition: disagreement is legitimate, disparagement is not. + + The Covenant's generic religion clause cannot carry this project's specific risk: + contributors WILL disagree about rulings, and without a stated stance the only + interpretations available are 'disagreement is disloyalty' or 'anything goes'. The + boundary must be explicit -- a ruling may be argued about, a madhhab or a contributor's + practice may not be disparaged -- and the technical route for the disagreement (a local + attestation, not a thread) must be named so the stance routes people somewhere. + """ + text = _coc().lower() + assert "madhhab" in text, ( + "the code of conduct must name the line: disparaging a madhhab or school is not " + "acceptable behaviour" + ) + assert "expected" in text and "legitimate" in text, ( + "disagreement about a religious ruling must be stated as expected and legitimate" + ) + assert "attestation" in text, ( + "the stance must route technical disagreement to the local-attestation route, not " + "leave it as an argument in a thread" + )