diagnostic: prefer guard clauses for readability

Guard clauses instead of if/unless blocks make the checks easier to
understand and reduce nesting, thus improving overall readability.

This includes the following additional minor changes:

- Make indentation of commands consistent inside diagnostic messages.
- Fix minor typos and inconsistent punctuation in diagnostic messages.
- Fix here documents to always start with `<<-EOS.undent` on a new line,
  followed by the message (indented once), followed by `EOS` (at the
  same level like `<<-EOS.undent`).
- Always separate the check logic (and guard clauses) from the following
  message by a single empty line (for consistency and readability).
- Standardize on `message` as the variable name when diagnostic messages
  need to be constructed from multiple parts.
- Where easily possible, adapt check logic to stay within 80-column
  limit, use more expressive variable names, and break down long
  expressions into multiple statements with intermediate results.

Closes #49.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
Martin Afanasjew 2016-04-06 05:08:53 +02:00
parent 6a82bc49c7
commit 1d9977b7c1

File diff suppressed because it is too large Load Diff