Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions developers/contributing/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ julia --project=. -e 'import Pkg; Pkg.test(; test_args=ARGS)' -- optim hmc --ski

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

### Code Formatting

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.

#### Installing JuliaFormatter

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):

```julia
julia -e 'using Pkg; Pkg.activate(); Pkg.add(name="JuliaFormatter", version="1"); Pkg.pin("JuliaFormatter")'
```

#### Formatting Code

To format all Julia files in the current directory and subdirectories:

```julia
julia -e 'using JuliaFormatter; format(".")'
```

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.

### Style Guide

Turing has a style guide, described below.
Expand Down