Git

Pre-commit checklist

This is an attempt to create a checklist to use before making a commit.

Before saving commit to Git the program code must require a list of rules:

  • Code can be compiled.
  • Perform algorithm with needed results.
  • Code is refactored with meld tool.
  • Constants starts with a capital letter, ends with the value type (i.e. MSec) and use constexpr where possible.
  • Function name explains what it does.
  • Check singleton for deadlock.
  • Take out similar code to separate function.
  • Delete commented code.
  • Organize code sections in *.h files by this order: public, public slots, signals, private (functions), private slots, private (m_members).
  • Ask questions if you didn’t understand something.
  • Add valid config files to project folder.
  • Unite code by ideas and logic.
  • Delete testing code.
  • Write lambdas in extended mode (not in one line).
  • Write if/else with one code instruction without  {}.
  • Use understandable names for commits and without repeats.
  • Variable initialization with nullptr in new style: QString *str{nullptr}.
  • Make code compact without blank lines.
  • One QTimer – one task.
  • If variable has setter function, use it to set value.
  • Don’t forget to assign issues, move to WIP column, set related branches.

Please, add other rules that you use in comments to this post. I’ll add them to the article, if they are good. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *