FSFE-defined coding standards?

Jacob Hrbek kreyren at rixotstudio.cz
Mon Feb 8 10:56:43 UTC 2021


Should FSFE provide some kind of platform for community to discuss and propose coding standards?

Rationale

The (F)LOSS ecosystem is currently mostly focusing on quantity over quality which results in bloat of software that is not reliable in a mission critical environment (and thus making it inferior to proprietary software) or software that requires “reinventing the wheel” because of authors bad decision (lack of abstracting → Malpractice).

This proposal is expected to contribute to the solution.

Practical Example

Example enforcing IEEE Std 1003.1-2017 to check if variable ‘number’ storing integer 5 is passing reqular expression [0-9] in shell vs bourne again shell.

Bad code:

#!/bin/bash

number=

"5"

if

[[

"

$number

"

=~ [0-9] ]];

then

whatever;

fi

- Works only on systems with dynamic linking
- Bash is not part of standard portable OS → Not portable

Good code:

#!/bin/sh

# shellcheck shell=sh # Written to comply with IEEE Std 1003.1-2017
[<http://get.posixcertified.ieee.org/>](http://get.posixcertified.ieee.org/)
number=

"5"

case

"

$number

"

in

[0-9]) whatever;

esac

---

Discussion at: https://community.fsfe.org/t/fsfe-defined-coding-standards/597

--
- Krey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fsfe.org/pipermail/discussion/attachments/20210208/f423839d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x31AE4020956E0A9A.asc
Type: application/pgp-keys
Size: 3187 bytes
Desc: not available
URL: <http://lists.fsfe.org/pipermail/discussion/attachments/20210208/f423839d/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 855 bytes
Desc: not available
URL: <http://lists.fsfe.org/pipermail/discussion/attachments/20210208/f423839d/attachment.sig>


More information about the Discussion mailing list