Skip to content

Latest commit

 

History

History
39 lines (39 loc) · 2.22 KB

TODO.md

File metadata and controls

39 lines (39 loc) · 2.22 KB
  • Function length (recommended 4-40 lines of code for C, except for multiway branches.)
  • Module length (recommended 4-400 lines for C, 10-40 functions per file)
  • Ratio of comments (30-75% of code length, excluding blank lines. Exception is C header file.)
  • https://en.wikipedia.org/wiki/Flesch–Kincaid\_readability\_tests
  • Number of arguments
  • Number of local definitions
  • Complexity measures:
    • McCabe "Cyclomatic number" - number of linearly independent paths through code, tends to be PL independent

      [x] ~number of conditional branches (ifs, cases) that may be taken,

      [-] also iteration constructs (like foldr, not map!?)

      [ ] also exception catches

      [-] also || and && shortcut evaluations?

      -> should be <15 for a function -> should be <100 for a file [ ] Composite metrics (like Code Climate)
    • Halstead Metrics

      volume: number of operators+operands * log2 of number of unique operators+operands?

    • Maintainability Index
  1. Number of links between functions and modules (n-planarity of the graph)
  2. Editing distance between different exposed names
  3. Warn about tuples with more than 5 arguments?
  4. Warn about constructors with more than 4 arguments that are not records.
  5. Facilities:
  • Iterable instances for haskell-src-exts (so that there is convenient interface to quickly check all source instances within given structure, for example).
  • Lens instances.
  1. Count errors, and show how many files couldn't be parsed.
  2. Treat classes similar to records - limit number of symbols.
  3. Try to guess extra params, or read them from file:
  • cpphs [ ] cpphs options to be snatched from Cabal (cabal exec?) [ ] configure cpphs options (GHC)
  • LANGUAGE pragmas
  1. Catch "invalid byte sequence" errors, and report as incorrect files.
  2. Sort by metrics to show hotspots at the bottom (top) of the printout
  3. Dead code detection - project-wide
  4. Suggest newtypes from function names
  5. Add missing params from my projects (like StandaloneDeriving)
  6. Check for Unicode ligatures and multipoint characters (see https://tworingsoft.com/blog/2018/12/10/fun-with-unicode-in-swift.html)