From 5475c6aad35fac5e984431c94ef8ed37bc06a01c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 14 Jun 2022 10:22:59 +0100 Subject: [PATCH 1/3] Coding style --- README_coding_style.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 README_coding_style.md diff --git a/README_coding_style.md b/README_coding_style.md new file mode 100644 index 000000000..67212cf2a --- /dev/null +++ b/README_coding_style.md @@ -0,0 +1,19 @@ +# Epicyon Coding Style + +Try to keep to the typical PEP8 coding style supported by Python static analysis systems. + +Variables all lower case and using underscores to separate words (snake case). + +Variables sent via webforms (with name="someVariableName") or within config.json are usually CamelCase, in order to clearly distinguish those from ordinary program variables. + +Procedural style. Think "C style in Python". Avoid classes and objects as far as possible. This avoids *obfuscation via abstractions*. With procedural style everything is maximally obvious/concrete and can be followed through step by step without needing a lot of implicit background knowledge. Procedural style also makes more rigorous static analysis possible, to catch bugs before they happen at runtime. + +Declare all called functions individually at the top of each module. This avoids any possible mistakes with colliding function names, and allows static analysis to explicitly check all dependencies. + +Before doing a commit run all the unit tests. There are three layers of testing. The first just checks PEP8 compliance. The second runs a more thorough static analysis and unit tests. The third simulates instances communicating with each other. + +```bash +./static_analysis +python3 epicyon.py --tests +python3 epicyon.py --testsnetwork +``` From 385adb40631d84afb5797ef2666034ac5839676b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 14 Jun 2022 10:23:46 +0100 Subject: [PATCH 2/3] Link to coding style --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d3adf407..97cc32fe9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Epicyon is a modern [ActivityPub](https://www.w3.org/TR/activitypub) compliant s Corporate social media gives you an audience, with reach, celebrity, spectacle, lack of control, professional influencers, anxiety, alienation and competition. It's designed for fast growth regardless of social consequences. Epicyon is designed for community, in which you have voice, agency, discussions and comradery. The community approach is the better way to build a habitable internet for the long term. -[Project Goals](README_goals.md) - [Commandline interface](README_commandline.md) - [Customizations](README_customizations.md) - [Software Architecture](README_architecture.md) - [Code of Conduct](code-of-conduct.md) - [Principles of Unity](principlesofunity.md) - [C2S Desktop Client](README_desktop_client.md) +[Project Goals](README_goals.md) - [Commandline interface](README_commandline.md) - [Customizations](README_customizations.md) - [Software Architecture](README_architecture.md) - [Code of Conduct](code-of-conduct.md) - [Principles of Unity](principlesofunity.md) - [C2S Desktop Client](README_desktop_client.md) - [Coding Style](README_coding_style.md) Matrix room: **#epicyon:matrix.libreserver.org** From 3a0079d03dd2f78da312e25a5243f64293a9cd12 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 14 Jun 2022 10:30:31 +0100 Subject: [PATCH 3/3] Python version --- README_coding_style.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README_coding_style.md b/README_coding_style.md index 67212cf2a..4b4c47742 100644 --- a/README_coding_style.md +++ b/README_coding_style.md @@ -6,10 +6,12 @@ Variables all lower case and using underscores to separate words (snake case). Variables sent via webforms (with name="someVariableName") or within config.json are usually CamelCase, in order to clearly distinguish those from ordinary program variables. -Procedural style. Think "C style in Python". Avoid classes and objects as far as possible. This avoids *obfuscation via abstractions*. With procedural style everything is maximally obvious/concrete and can be followed through step by step without needing a lot of implicit background knowledge. Procedural style also makes more rigorous static analysis possible, to catch bugs before they happen at runtime. +Procedural style. Think "C style in Python". Avoid classes and objects as far as possible. This avoids *obfuscation via abstractions*. With procedural style everything is maximally obvious/concrete and can be followed through step by step without needing a lot of implicit background knowledge. Procedural style also makes more rigorous static analysis possible, to catch bugs before they happen at runtime. Mantra: "In the long run, obviousness beats clever abstractions". Declare all called functions individually at the top of each module. This avoids any possible mistakes with colliding function names, and allows static analysis to explicitly check all dependencies. +Don't use any features of Python which are not supported by the version of Python within the current Debian stable release. Don't assume that all users are running the latest cutting-edge Python release. + Before doing a commit run all the unit tests. There are three layers of testing. The first just checks PEP8 compliance. The second runs a more thorough static analysis and unit tests. The third simulates instances communicating with each other. ```bash