racheldijkstra / WeekMenu-Planner

Portfolio Project
0 stars 0 forks source link

Coding standards #3

Closed racheldijkstra closed 10 months ago

racheldijkstra commented 10 months ago

Indentation

Imports should be grouped in the following order:

  1. Standard library imports.
  2. Related third-party imports.
  3. Local application/library specific imports.

    Whitespace

    Avoid extraneous whitespace in the following situations:

    • Immediately inside parentheses, brackets, or braces.
    • Immediately before a comma, semicolon, or colon.
    • Immediately before the open parenthesis that starts the argument list of a function call.

      Comments

    • Comments should be complete sentences and should be used sparingly.
    • Comments should be used to explain why something is done, not what the code does (the code should be self-explanatory).
    • Use docstrings to document classes and functions.

      Naming Conventions

    • Variables: Use lowercase with underscores (snake_case).
    • Constants: Use all uppercase with underscores (UPPER_CASE).
    • Functions and Methods: Use lowercase with underscores (snake_case).
    • Classes: Use CamelCase (CapitalizedWords).

      Function and Method Arguments

    • Avoid using mutable types (like lists or dictionaries) as default values for function or method arguments.
    • Use *args and **kwargs for variable numbers of arguments.

      Exceptions

    • When catching exceptions, be as specific as possible.
    • Avoid using a bare except: clause.

      Class Definitions

    • Separate methods in a class with one blank line.
    • Use a blank line between the class header and the first method.

      Other Recommendations

    • Use built-in functions and libraries whenever possible.
    • Avoid extraneous whitespace at the end of lines.
    • Follow the principle of least astonishment.