7 Matching Annotations
  1. Sep 2022
    1. your cognitive load increases with the level of indentation. 1 2 3 4 5 6 7 8 9 10 if r.Method == "GET" { if r.Header.Get("X-API-KEY") == key { // ok return nil }else{ return errors.New("Key is not valid") } } else { return errors.New("Invalid Method") }
    2. Avoid indentation levels, If you find yourself with more than 3, you should create a function.
  2. Oct 2020
    1. When the conditional part of an if-statement is long enough to require that it be written across multiple lines, it's worth noting that the combination of a two character keyword (i.e. if), plus a single space, plus an opening parenthesis creates a natural 4-space indent for the subsequent lines of the multiline conditional. This can produce a visual conflict with the indented suite of code nested inside the if-statement, which would also naturally be indented to 4 spaces.
  3. Jul 2016
    1. The solution - move tabstops to fit the text between them and align them with matching tabstops on adjacent lines