CODING STYLE OF THE KERNEL


IDE USERS
For CLion users you can import the coding guidelines from here: MercuryCodingStyle.xml

THE GUIDELINES






// space before and after ':' as seen below

class SomeClass : public BaseClass 

{

public: // not indented 

    statements;

protected: // not indented

    statements;

private: // not indented

    statements;

};


// no space between someMethod and ()

void someMethod()

{

    statements;

}

// space between for and ()

for (initialization; condition; update)

{

    statements;

}

// space between while and ()

while (condition)

{

    statements;

}

// space between if and ()

if (condition)

{

    statements;

}

else

{

    statements;

}


switch (condition)

{

  case ABC :

    statements;

    // Fallthrough

  case DEF :

    statements;

    break;

  default :

    statements;

    break;

}


void

MyClass::myMethod()

{

    statements;

}


/*!

 * Doxygen comment.

 */


/*

 * \brief A brief description of the MyClass.

 * \details A detailed documentation of MyClass.

 */

MyClass

{

    statements;

}

MyClass

{

/*!

* \brief A brief description of myFunction.

*/

bool myFunction(int name);

}


/*!

 * \details A detailed documentation of myFunction.

 * \param[in] name Description of the parameter.

 * \return Description of the return value.

 */

bool MyClass::myFunction(int name)

{ ... }

/*!

 * \bug This function does not work for non-spherical particles.

 */

/*!

 * \todo This function has to be extended to account for ...

 */

/*!

 * See \ref BaseWall::setPosition for details.

 */


All Python files in the MercuryDPM repository should use the Python style guide: https://peps.python.org/pep-0008/.