mullvad / coding-guidelines Goto Github PK
View Code? Open in Web Editor NEWGuides and texts about how we develop, format and work with code at Mullvad
Guides and texts about how we develop, format and work with code at Mullvad
In your coding guidelines:
Lines 58 to 62 in 5c5931d
May I suggest to also declare these as readonly for more strictness?
The above example would become:
readonly SCREAMING_SNAKE_CASE="something"
Your usual:
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
would become:
readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
On a very similar note, for variables scoped to their function with local
:
Lines 94 to 104 in 5c5931d
For those that should be constants, additionally to having them written in uppercase you could also declare them as read-only with local -r
:
function cowsay {
local -r COW_PREFIX="The cow says"
local message="$1"
echo "$COW_PREFIX: $message"
}
If a type does not include the unit of the value, the variable name has to. Otherwise it becomes hard to know what is what.
// The type expresses the unit. Best solution.
let interval: Duration = Duration::from_millis(1001);
// The variable expresses the unit. Good solution for when the type can't or should not express the unit.
let interval_ms: u64 = 1001;
// Neither expresses the unit. Very hard to read, understand and properly use:
let interval: u64 = 1001;
Module named tests
(plural). Don't start test functions with test_
etc. Unit tests vs integration tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.