Skip to content

Commit

Permalink
Add formatting of newlines in blocks and trailing commas to README
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Aug 23, 2024
1 parent 3931a4f commit 30d7c84
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,13 @@ This is a list of things that Runic currently is doing:
- [Toggle formatting](#toggle-formatting)
- [Line width limit](#line-width-limit)
- [Newlines in blocks](#newlines-in-blocks)
- [Indentation](#indentation)
- [Spaces around operators, assignment, etc](#spaces-around-operators-assignment-etc)
- [Spaces around keywords](#spaces-around-keywords)
- [Multiline listlike expressions](#multiline-listlike-expressions)
- [Spacing in listlike expressions](#spacing-in-listlike-expressions)
- [Trailing semicolons](#trailing-semicolons)
- [Literal floating point numbers](#literal-floating-point-numbers)
- [Literal hex and oct numbers](#literal-hex-and-oct-numbers)
- [Parentheses around operator calls in colon](#parentheses-around-operator-calls-in-colon)
Expand Down Expand Up @@ -293,6 +295,28 @@ file.
No. Use your <kbd>Enter</kbd> key or refactor your code.
### Newlines in blocks
The body of blocklike expressions (e.g. `if`, `for`, `while`, `function`, `struct`, etc.)
always start and end with a newline. Examples:
```diff
-if c x end
+if c
+ x
+end
-function f(x) x^2 end
+function f(x)
+ x^2
+end
```
An exception is made for empty blocks so that e.g.
```julia
struct A end
```
is allowed.
### Indentation
Consistently four spaces for each indentation level.
Expand Down Expand Up @@ -523,6 +547,24 @@ Leading/trailing spaces are removed. Examples:
help with alignment issues. Discussed in issue
[#12](https://github.com/fredrikekre/Runic.jl/issues/12).
### Trailing semicolons
Trailing semicolons are removed in the body of blocklike expressions. Examples
```diff
function f(x)
- y = x^2;
- z = y^2; # z = x^4
- return z;
+ y = x^2
+ z = y^2 # z = x^4
+ return z
end
```
Trailing semicolons at top level and module level are kept since they are sometimes used
there for output supression (e.g. Documenter examples or scripts that are
copy-pasted/included in the REPL).
### Literal floating point numbers
Floating point literals are normalized so that they:
Expand Down

0 comments on commit 30d7c84

Please sign in to comment.