Third-Floor-CSIS / cs4337-Big-Data-Group

0 stars 1 forks source link

Sync everyone's Code Styles #19

Open M-Byte480 opened 1 week ago

M-Byte480 commented 1 week ago

To have a standardized and clean code style between each other, I propose the following of an XML I have created over the last year or so. Took inspiration of other companies' coding styles and fine-tuned it to my liking. Lot of inspiration: https://google.github.io/styleguide/javaguide.html

Here is a tutorial for the team on how to add it to your project:

  1. Go to settings -> Editor -> Code Style (or search Code Style)
  2. Click on the root header
  3. Click 3 dots beside Scheme
  4. Import Scheme -> IntelliJ XML

image

Add the file I have shared on Discord.

The file in question:

<code_scheme name="GroupProject" version="1">
    <JavaCodeStyleSettings>
        <!-- General -->
        <option name="RIGHT_MARGIN" value="100" />
        <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
        <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
        <option name="BLANK_LINES_AFTER_PACKAGE" value="1" />
        <option name="BLANK_LINES_AFTER_IMPORTS" value="1" />
        <option name="BLANK_LINES_BEFORE_PACKAGE" value="1" />

        <!-- Tabs and Indentation -->
        <option name="USE_TAB_CHARACTER" value="true" />
        <option name="INDENT_SIZE" value="4" />
        <option name="TAB_SIZE" value="4" />
        <option name="CONTINUATION_INDENT_SIZE" value="8" />
        <option name="LABEL_INDENT_SIZE" value="0" />
        <option name="USE_RELATIVE_INDENTS" value="false" />
        <option name="SPACE_AFTER_COMMA" value="true" />

        <!-- Wrapping and Braces -->
        <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
        <option name="RIGHT_MARGIN" value="100" />
        <option name="WRAP_ON_TYPING" value="true" />
        <option name="KEEP_LINE_BREAKS" value="true" />
        <option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="false" />
        <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
        <option name="BRACE_STYLE" value="END_OF_LINE" />
        <option name="METHOD_BRACE_STYLE" value="END_OF_LINE" />
        <option name="FORCE_BRACES" value="true" />

        <!-- Imports -->
        <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND" />
        <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
        <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
        <option name="NAMES_COUNT_TO_USE_STAR_IMPORT" value="5" />
        <option name="IMPORT_LAYOUT_TABLE" value="5" />
        <option name="PACKAGE_NAME_ABBREVIATION_LENGTH" value="0" />
        <option name="CLASS_COUNT_TO_USE_FQ_CLASS_NAMES" value="999" />
        <option name="NAMES_COUNT_TO_USE_FQ_CLASS_NAMES" value="999" />
        <option name="CLASS_COUNT_TO_USE_FQ_CLASS_NAMES_IN_JAVADOC" value="999" />
        <option name="NAMES_COUNT_TO_USE_FQ_CLASS_NAMES_IN_JAVADOC" value="999" />

    </JavaCodeStyleSettings>
</code_scheme>

KEY TAKEAWAYS:

M-Byte480 commented 1 week ago

Sync code Styles