Skip to content

Commit bc8a463

Browse files
author
AoifeHughes
committed
init adding of formatting instructions
1 parent 2788f7c commit bc8a463

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

developers/contributing/index.qmd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,28 @@ julia --project=. -e 'import Pkg; Pkg.test(; test_args=ARGS)' -- optim hmc --ski
4949

5050
Or otherwise, set the global `ARGS` variable, and call `include("test/runtests.jl")`.
5151

52+
### Code Formatting
53+
54+
Turing uses [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) to ensure consistent code style across the codebase. **All code must be formatted before submitting a pull request**, and ideally with every commit.
55+
56+
#### Installing JuliaFormatter
57+
58+
We use version 1 of JuliaFormatter. Install it in your **global Julia environment** (not the project environment, as adding it to the Project.toml would make it invalid):
59+
60+
```julia
61+
julia -e 'using Pkg; Pkg.activate(); Pkg.add(name="JuliaFormatter", version="1"); Pkg.pin("JuliaFormatter")'
62+
```
63+
64+
#### Formatting Code
65+
66+
To format all Julia files in the current directory and subdirectories:
67+
68+
```julia
69+
julia -e 'using JuliaFormatter; format(".")'
70+
```
71+
72+
Run this command from the root of the repository before committing your changes. This ensures your code follows the project's formatting standards and maintains consistency across the codebase.
73+
5274
### Style Guide
5375

5476
Turing has a style guide, described below.

0 commit comments

Comments
 (0)