Code Formatting

Prefer tabs over spaces (except for formats that require spaces, e.g. configuration files)

  • There is an .editorconfig file in the project that should get your IDE to display tabs as shorter 2 spaces by default.

# Unix-style newlines with a newline ending every file [*] charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = tab indent_size = 2 [*.yml] indent_style = space indent_size = 2
  • You can then change the display manually in your IDE or text-editor if you have different preferences.

  • This ensure developers can view code with whatever indentation they want without the flip-flopping of whitespace in the files. Reviews and diffs are also more difficult when the whitespace always changes.

     

 

Operated as a Community Resource by the Open Library Foundation