-
Notifications
You must be signed in to change notification settings - Fork 34
LineLengths=110 #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattBrzezinski
wants to merge
2
commits into
master
Choose a base branch
from
MB/line-lengths
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
LineLengths=110 #104
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ Attempt to follow both the [Julia Contribution Guidelines](https://github.com/Ju | |
When convention guidelines conflict this guide takes precedence (known conflicts will be noted in this guide). | ||
|
||
- Use 4 spaces per indentation level, no tabs. | ||
- Try to adhere to a 92 character line length limit. | ||
- Try to adhere to a 110 character line length limit. | ||
- Use upper camel-case convention for [modules](https://docs.julialang.org/en/v1/manual/modules/) and [types](https://docs.julialang.org/en/v1/manual/types/). | ||
- Use lower case with underscores for method names (note: contrary to this, it is a common stylistic choice in the [Julia base code](https://github.com/JuliaLang/julia/tree/master/base) to use lower case without underscores). | ||
- Import modules with `using`, with one module per line and at the top of the file when possible. | ||
|
@@ -36,7 +36,11 @@ When convention guidelines conflict this guide takes precedence (known conflicts | |
- Avoid padding brackets with spaces. ex. `Int64(value)` preferred over `Int64( value )`. | ||
|
||
## Contents | ||
- [Code Formatting](#code-formatting) | ||
- [Blue: a Style Guide for Julia](#blue-a-style-guide-for-julia) | ||
- [A Word on Consistency](#a-word-on-consistency) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VSCode just autosaves this back to be indented? 🤷 |
||
- [Synopsis](#synopsis) | ||
- [Contents](#contents) | ||
- [Code Formatting](#code-formatting) | ||
- [Module Imports](#module-imports) | ||
- [Function Exports](#function-exports) | ||
- [Global Variables](#global-variables) | ||
|
@@ -53,16 +57,16 @@ When convention guidelines conflict this guide takes precedence (known conflicts | |
- [Package version specifications](#package-version-specifications) | ||
- [Comments](#comments) | ||
- [Documentation](#documentation) | ||
- [Test Formatting](#test-formatting) | ||
- [Test Formatting](#test-formatting) | ||
- [Testsets](#testsets) | ||
- [Comparisons](#comparisons) | ||
- [Performance and Optimization](#performance-and-optimization) | ||
- [Editor Configuration](#editor-configuration) | ||
- [Performance and Optimization](#performance-and-optimization) | ||
- [Editor Configuration](#editor-configuration) | ||
- [Sublime Text Settings](#sublime-text-settings) | ||
- [Vim Settings](#vim-settings) | ||
- [Atom Settings](#atom-settings) | ||
- [VS-Code Settings](#vs-code-settings) | ||
- [Code Style Badge](#code-style-badge) | ||
- [Code Style Badge](#code-style-badge) | ||
|
||
## Code Formatting | ||
|
||
|
@@ -282,7 +286,7 @@ function maybe_do_thing() | |
end | ||
``` | ||
|
||
Functions definitions with parameter lines which exceed 92 characters should separate each parameter by a newline and indent by one-level: | ||
Functions definitions with parameter lines which exceed 110 characters should separate each parameter by a newline and indent by one-level: | ||
|
||
```julia | ||
# Yes: | ||
|
@@ -328,7 +332,7 @@ function foobar( | |
end | ||
``` | ||
|
||
If all of the arguments fit inside the 92 character limit then you can place them on 1 line. | ||
If all of the arguments fit inside the 110 character limit then you can place them on 1 line. | ||
Similarly, you can follow the same rule if you break up positional and keyword arguments | ||
across two lines. | ||
|
||
|
@@ -357,9 +361,9 @@ function foobar( | |
# code | ||
end | ||
|
||
# No: Because the separate line is more than 92 characters. | ||
# No: Because the separate line is more than 110 characters. | ||
function foobar( | ||
df::DataFrame, id::Symbol, variable::Symbol, value::AbstractString; prefix::AbstractString="" | ||
df::DataFrame, id::Symbol, variable::Symbol, value::AbstractString; prefix::AbstractString="", postfix::AbstractString="" | ||
) | ||
# code | ||
end | ||
|
@@ -372,7 +376,7 @@ function foobar( | |
# code | ||
end | ||
|
||
# No: The kwargs are more than 92 characters. | ||
# No: The kwargs are more than 110 characters. | ||
function foobar( | ||
df::DataFrame, id::Symbol, variable::Symbol, value::AbstractString; | ||
prefix="I'm a long default setting that probably shouldn't exist", msg="I'm another long default settings that probably shouldn't exist", | ||
|
@@ -404,7 +408,7 @@ xy = foo(x, y=3) | |
```julia | ||
# Yes: | ||
spam(ham[1], [eggs]) | ||
|
||
# No: | ||
spam( ham[ 1 ], [ eggs ] ) | ||
``` | ||
|
@@ -414,7 +418,7 @@ xy = foo(x, y=3) | |
```julia | ||
# Yes: | ||
if x == 4 @show(x, y); x, y = y, x end | ||
|
||
# No: | ||
if x == 4 @show(x , y) ; x , y = y , x end | ||
``` | ||
|
@@ -983,14 +987,14 @@ Try to document a function and not individual methods where possible as typicall | |
If you are adding a method to a function which already has a docstring only add a docstring if the behaviour of your function deviates from the existing docstring. | ||
|
||
Docstrings are written in [Markdown](https://en.wikipedia.org/wiki/Markdown) and should be concise. | ||
Docstring lines should be wrapped at 92 characters. | ||
Docstring lines should be wrapped at 110 characters. | ||
|
||
```julia | ||
""" | ||
bar(x[, y]) | ||
|
||
Compute the Bar index between `x` and `y`. If `y` is missing, compute the Bar index between | ||
all pairs of columns of `x`. | ||
Compute the Bar index between `x` and `y`. If `y` is missing, compute the Bar index between all pairs of | ||
columns of `x`. | ||
""" | ||
function bar(x, y) ... | ||
``` | ||
|
@@ -1099,16 +1103,16 @@ function Manager end | |
|
||
``` | ||
|
||
If the documentation for bullet-point exceeds 92 characters the line should be wrapped and slightly indented. | ||
If the documentation for bullet-point exceeds 110 characters the line should be wrapped and slightly indented. | ||
Avoid aligning the text to the `:`. | ||
|
||
```julia | ||
""" | ||
... | ||
|
||
# Keywords | ||
- `definition::AbstractString`: Name of the job definition to use. Defaults to the | ||
definition used within the current instance. | ||
- `definition::AbstractString`: Name of the job definition to use. Defaults to the definition used within the | ||
current instance. | ||
""" | ||
``` | ||
|
||
|
@@ -1174,7 +1178,7 @@ Then navigate to: `Preferences > Settings - More > Syntax Specific - User` | |
"tab_size": 4, | ||
"trim_trailing_white_space_on_save": true, | ||
"ensure_newline_at_eof_on_save": true, | ||
"rulers": [92] | ||
"rulers": [110] | ||
} | ||
``` | ||
|
||
|
@@ -1197,7 +1201,7 @@ Then create or edit `.vim/after/ftplugin/julia.vim`, adding the Julia-specifc co | |
``` | ||
" ~/.vim/after/ftplugin/julia.vim | ||
setlocal expandtab " Replace tabs with spaces. | ||
setlocal textwidth=92 " Limit lines according to Julia's CONTRIBUTING guidelines. | ||
setlocal textwidth=110 " Limit lines according to Julia's CONTRIBUTING guidelines. | ||
setlocal colorcolumn=+1 " Highlight first column beyond the line limit. | ||
``` | ||
|
||
|
@@ -1207,12 +1211,12 @@ which adds Julia-aware syntax highlighting and a few cool other features. | |
|
||
### Atom Settings | ||
|
||
Atom defaults preferred line length to 80 characters. We want that at 92 for julia. | ||
Atom defaults preferred line length to 80 characters. We want that at 110 for julia. | ||
To change it: | ||
|
||
1. Go to `Atom -> Preferences -> Packages`. | ||
2. Search for the "language-julia" package and open the settings for it. | ||
3. Find preferred line length (under "Julia Grammar") and change it to 92. | ||
3. Find preferred line length (under "Julia Grammar") and change it to 110. | ||
|
||
|
||
### VS-Code Settings | ||
|
@@ -1229,7 +1233,7 @@ To modify these settings open your VS Code Settings with <kbd>CMD</kbd>+<kbd>,</ | |
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.rulers": [92], | ||
"editor.rulers": [110], | ||
}, | ||
} | ||
``` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a blurb or comment about why it's 110 characters? It would make it easier to update in the future
(or just a blurb in the MR)