Skip to content

Graphalytics Code Style

AJ edited this page May 28, 2018 · 4 revisions

Unless stated otherwise in the README of a project, all Graphalytics projects hosted by https://github.com/tudelft-atlarge use the code style described in this document.

The following guidelines should be followed when contributing to Graphalytics projects:

  • Use tabs for indentation and spaces for alignment. Use one tab for each level of indentation, and two tabs for line continuations.
  • Limit the length of lines to roughly 100-120. This limit is not enforced, but is recommended for code readability.
  • Always use braces with if, while, etc. in languages like Java.

IntelliJ IDEA Configuration

Save the following XML document as <IntelliJ directory>/config/codestyles/Graphalytics.xml and restart Intellij to add the Graphalytics codestyle profile.

<code_scheme name="Graphalytics">
  <option name="OTHER_INDENT_OPTIONS">
    <value>
      <option name="INDENT_SIZE" value="4" />
      <option name="CONTINUATION_INDENT_SIZE" value="8" />
      <option name="TAB_SIZE" value="4" />
      <option name="USE_TAB_CHARACTER" value="true" />
      <option name="SMART_TABS" value="false" />
      <option name="LABEL_INDENT_SIZE" value="0" />
      <option name="LABEL_INDENT_ABSOLUTE" value="false" />
      <option name="USE_RELATIVE_INDENTS" value="false" />
    </value>
  </option>
  <option name="JD_P_AT_EMPTY_LINES" value="false" />
  <XML>
    <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
  </XML>
  <codeStyleSettings language="JAVA">
    <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
    <option name="ALIGN_MULTILINE_RESOURCES" value="false" />
    <option name="ALIGN_MULTILINE_FOR" value="false" />
    <option name="IF_BRACE_FORCE" value="3" />
    <option name="DOWHILE_BRACE_FORCE" value="3" />
    <option name="WHILE_BRACE_FORCE" value="3" />
    <option name="FOR_BRACE_FORCE" value="3" />
    <indentOptions>
      <option name="USE_TAB_CHARACTER" value="true" />
    </indentOptions>
  </codeStyleSettings>
  <codeStyleSettings language="Scala">
    <indentOptions>
      <option name="INDENT_SIZE" value="4" />
      <option name="CONTINUATION_INDENT_SIZE" value="8" />
      <option name="TAB_SIZE" value="4" />
      <option name="USE_TAB_CHARACTER" value="true" />
    </indentOptions>
  </codeStyleSettings>
  <codeStyleSettings language="XML">
    <indentOptions>
      <option name="USE_TAB_CHARACTER" value="true" />
    </indentOptions>
  </codeStyleSettings>
</code_scheme>