Skip to content

Instantly share code, notes, and snippets.

@binaryoverload
Last active June 5, 2017 22:20
Show Gist options
  • Save binaryoverload/1b6d40c6b9c15837bac92b5f71e16ea7 to your computer and use it in GitHub Desktop.
Save binaryoverload/1b6d40c6b9c15837bac92b5f71e16ea7 to your computer and use it in GitHub Desktop.

FlareBot Contribution Guide

Arsen and Walshy are very picky about the code quality for FlareBot so it is very important you adhere to this guide.

Big Dos and Don'ts

  • Don't PR single line corrections
  • Always test your code the best you can
  • Don't change code just to reorganise or to restructure without making sure it has a worthwhile purpose
  • Do use separate branches for features requiring more than 10 commits This will be enforced on a per-case basis

We very highly recommend that you use IntelliJ for contributions as we will not accept any files or gitignores concerning Eclipse. We do not provide any help for people using Eclipse!

Formatting

We mostly use IntelliJ's default formatter with a few changes:

  • The minimum gap between the class header and body is 1 line
  • There are to be no breaks larger than 3 lines in your contribution
  • A line break must occur after a newline escape character in strings. IntelliJ should handle this if you keep your cursor within the quotation marks after the escape character and press Enter

Code Practices

A lot of the changes requested in PRs is related to memory usage and efficiency. There are a few things that are enforced in FlareBot's codebase.

  • Single use variables are not allowed. They must be inline
  • Switch statements are not used for consistency
  • Code efficiency is vital when dealing with arrays and data. Always make sure to use getOrDefault or computeIfAbsent where necessary
  • Checking argument lengths in commands that have sub commands must happen inside the code block of the sum command for fluidity and maximum understanding
  • Creating new objects should be avoided where available
  • Variables have to be used 3 times or more. If they are not then they need to be inlined This doesn't apply to variables which are final or effectively final (Single item array for interfacing with lambas for example)
  • Big sets of commits such as data restructures must be put in their own branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment