Skip to content

Latest commit

 

History

History
37 lines (19 loc) · 1.11 KB

STYLE.md

File metadata and controls

37 lines (19 loc) · 1.11 KB

Style Guide

Comments

  • All non-private methods should have a torch-dokx documentation describing input/output.

  • All classes should have a class docstring at the top of the file.

  • All comments should be on their own line, and be a complete English sentence with capitalization.

The torch-dokx documentation is automatically deployed here.

Design

  • All files should pass luacheck.

  • Use object-oriented programming whenever appropriate.

  • Avoid using global variables.

  • Avoid writing functions with more than 100 lines.

  • Use onmt.utils.Logger to log messages for the user.

  • If a new module relies on command line options, consider defining a static declareOpts(cmd) function. See onmt/translate/Translator.lua for an example.

Formatting

  • All indentation should be 2 spaces.

  • All variables, functions and methods should use camelCase.

  • Commande line options and scripts name should use snake_case.

  • Use spaces around operators to increase readability.

  • Avoid lines with more than 100 columns.