Skip to content

Style Guide

jonathonmcmurray edited this page Jan 29, 2018 · 1 revision

If you intend to contribute to kdbslack, please try to follow these stylistic guidelines:

  • Code for a given "auto" or "command" plugin should be self contained within one .q file where possible, or else should load additional .q files from an appropriately named sub-directory (e.g. auto/feeds.q loads directory auto/feeds/)
  • Within a q file, code should be contained within a similarly named namespace (e.q. util/timer.q defines the .timer namespace) - exceptions for small utility functions which can be placed in the .util namespace, as functions which share the name of the file (e.g. util/lvn.q defines .util.lvn)
  • Namespaces should be declared with \d .namespace and each file should return to root namespace with \d . before end of script
  • Inline comments should be placed at column 85 - lines of code should not be longer than 84 chars
  • Inline comments should begin with a double forward slash (//), except those detailing function arguments which should begin with a single forward slash (/)
  • Single line comments should begin with a single forward slash, and mainly be used for separating sections within a script, for example /-- webhooks --

Other guidelines may be added over time, if anything is missing try to stick with something similar to what is in the existing code

Clone this wiki locally