Skip to content

Latest commit

 

History

History
87 lines (68 loc) · 5 KB

CODE_STANDARDS.md

File metadata and controls

87 lines (68 loc) · 5 KB

Code Standards

Back to Team Agreement

General Tips

  • Follows appropriate style guide for the language
    • When possible match the style of the file you are working in
    • When possible utilize the language specific linting scripts to automatically detect style issues (which should also be part of the smithy build process)
  • Write self documenting code
    • Create descriptive variable and function names
    • Add comments when what you are doing isn’t completely obvious
    • Functions should do one thing
  • TODOs or FUTURE comments in code should be cleaned up before code is merged or accompanied by a JIRA ticket for follow up work
  • Commented out code should not be merged
  • Include docstrings on all exported symbols.
  • Keep the console and logs clean - (i.e. remove unneeded print/debug statements and ensure no RTEs occur on client or server side)
  • Avoid the use of Magic Strings
  • APIs should include documentation

Languages

  • Dart
    • Refer to Effective Dart
    • Memory management best practices should be followed
    • Test ids have consistent names and added as we add functional tests
  • Go
    • Read the Workiva Go Best Practices
    • Refer to Effective Go and Go Proverbs):
      • A little copying is better than a little dependency.
      • Code to interfaces! Having to stand up networked resources for unit tests is not fun.
      • Unit testing is hard, write as functionally as possible to ease injectability.
    • Turn on gofmt in your IDE.
  • Bash
    • Use GNUMake to do your work in a cross platform fashion.

Commits

  • Write good commit messages.
  • Include the what and most importantly the why
  • Include the ticket number
    • Optional - setup a git commit-msg hook that does this for you - example
  • Optional - verify your commits (added security) - article

Tracing

  • Consider adding tracing spans to a function in the following scenarios:
    • RPCs (e.g. thrift and frugal)
    • Sending data to persistence or other services (e.g. S3, RDS, SQS)
    • Potentially expensive operations (lots of complexity) - use your judgement

IDE

Many developers use VSCode for daily development with the following extensions:

A suggested settings file is located at .vscode/init_settings.json and can be enabled by renaming the file to settings.json.

Other editors are acceptable as well including:

  • IntelliJ
  • vim
  • atom

If you have plugins / tips for these or other editors feel free to add content above

Additional Reading

If you have any other books/articles please add them to this list! (i.e. create a PR to this file)