mirror of
https://github.com/Studio3T/robomongo.git
synced 2025-12-04 16:25:19 -05:00
Page:
Robomongo Code Quality
Pages
Build Robomongo (0.8.x 0.9.0 RC9)
Feature Spec
Home
How Welcome Tab works
How to export to CSV
How to use SSH port forwarding with Robo 3T
New Release Check List
Notes: Upgrade to MongoDB 4.0
Package Robomongo
Qt Build System
Restore connection strings from versions below 0.9.0 RC2
Robo 3T Schematics: Build, Class and UI Diagrams
Robomongo Code Quality
Robomongo Code Review
Robomongo Coding Style
Robomongo Config File Guide
Robomongo Config File
Robomongo Cplusplus 11, 14 Transition Guide
Robomongo ECMAScript 2015 (aka ES6) Support
Static Code Analysis
Tests
Translator's guide
Unit Tests
Upgrade Guide From MongoDB 3.2 to 3.4 and 3.4 to 4.0
Upgrade Guide to MongoDB 4.2 from 4.0
macOS Upgrade Guide
No results
17
Robomongo Code Quality
Gökhan Şimşek edited this page 2020-12-18 18:16:06 +03:00
Table of Contents
C/C++
1. Code Checks/Actions Before Commit
Note: The following guidelines are extracted from various sources (see "References" for all list) mainly from "C++ Core Guidelines by Bjarne Stroustrup, Herb Sutter, July 28, 2016" based on Robomongo project's needs and code structure.
General
- Keep things private as much as possible. (member variables, functions etc..)
- Use "const" a lot. Try to refactor "non-const" to "const" where possible (variables, functions, anything possible..)
- Always try to initialize a variable with default value. (built-in type variables (i.e. int, int*) may/will have garbage values when un-initialized which might result with insidious bugs)
- Make sure member variables are all initialized (uninitialized variables may have undefined values)
Resource Management
- Use C++11 smart pointers (unique, shared, weak) instead of explicit(naked) new and delete.
- Avoid using explicit (naked, non-RAII) new and delete. (strong memory leak candidate)
- If "new & delete" must be used, wrap in ctor and dtor for automatic clean up (RAII).
- Keep using raw pointers (T*) for non-owning purposes.
- Do not use smart pointers(owning ptrs) for the purpose of raw(non-owning) pointers (T*).
Concurrency
- Share the copy of object across threads. Avoid passing pointer or reference to an object (local variable, class member.. any thread object) across different threads.
...
References
C++ Core Guidelines by Bjarne Stroustrup, Herb Sutter, July 28, 2016
Scott Meyer's guideline-based books on C++ (http://www.aristeia.com/)
- Effective Modern C++, Scott Meyers, 2014
- Effective C++, Third Edition, 2005
- Effective STL, 2001
- More Effective C++, 1996
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices Nov 4, 2004
by Herb Sutter and Andrei Alexandrescu
...
2. Static Code Analysis
Also see: https://github.com/Studio3T/robomongo/wiki/Static-Code-Analysis/
Spell Checker
- We use spell checking for all text (user/programmer visible texts and comments).
- Following tool does a pretty good job to ensure this: Visual Studio Spell Checker