This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
cs:coding_conventions:start [2016/11/25 13:31] James Irwin [Coding Conventions] |
cs:coding_conventions:start [2017/04/08 12:44] Brandon Kallaher [All Languages] |
||
---|---|---|---|
Line 5: | Line 5: | ||
To check if you code passes standard checks, compile using: | To check if you code passes standard checks, compile using: | ||
rsmake roslint | rsmake roslint | ||
- | which will invoke the compiler with the code linter turned on. | + | This will invoke the compiler with the code linter turned on. The C++ linter will run first and will fail with an error if the linter fails and the Python linter will not be run. If the C++ code passes the linter then the Python linter will be run. |
===== All Languages ===== | ===== All Languages ===== | ||
===Indentation=== | ===Indentation=== | ||
Line 16: | Line 15: | ||
===Trailing Spaces=== | ===Trailing Spaces=== | ||
- | Trailing whitespace at the end of a line is not allowed. | + | Trailing whitespace at the end of a line is not allowed. \\ |
**Rational:** most text editors will actually automatically chop the trailing whitespace when you open a file. If people aren't paying attention, this can result in them commiting a file where they made no functional changes other than to cut the whitespace, resulting in a confusing source control history. In addition, it's just a cleanliness thing. | **Rational:** most text editors will actually automatically chop the trailing whitespace when you open a file. If people aren't paying attention, this can result in them commiting a file where they made no functional changes other than to cut the whitespace, resulting in a confusing source control history. In addition, it's just a cleanliness thing. | ||
+ | |||
+ | ===Extra Newlines=== | ||
+ | More than one blank line in a row is not allowed. \\ | ||
+ | **Rational**: If you need to break up your code into logical chunks it is better to use a single newline and a comment describing the next code block. | ||
===== C++ ===== | ===== C++ ===== | ||
running | running |