Skip to content

Commit e365295

Browse files
authored
Merge pull request #1484 from CliMA/js/formatter
use JuliaFormatter; remove .dev
2 parents b726033 + 406f8ad commit e365295

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1974
-734
lines changed

.JuliaFormatter.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
margin = 92
2+
indent = 4
3+
always_for_in = true
4+
whitespace_typedefs = true
5+
whitespace_ops_in_indices = true
6+
remove_extra_newlines = false

.dev/Project.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.dev/clima_formatter_options.jl

Lines changed: 0 additions & 8 deletions
This file was deleted.

.dev/climaformat.jl

Lines changed: 0 additions & 85 deletions
This file was deleted.

.dev/hooks/pre-commit

Lines changed: 0 additions & 41 deletions
This file was deleted.

.dev/up_deps.jl

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/JuliaFormatter.yml

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,14 @@ on:
44
push:
55
tags: '*'
66
pull_request:
7-
8-
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
10-
cancel-in-progress: true
7+
merge_group:
118

129
jobs:
1310
format:
1411
runs-on: ubuntu-latest
15-
timeout-minutes: 30
1612
steps:
17-
- uses: actions/checkout@v5
18-
19-
- uses: dorny/[email protected]
20-
id: filter
21-
with:
22-
filters: |
23-
julia_file_change:
24-
- added|modified: '**.jl'
25-
26-
- uses: julia-actions/setup-julia@latest
27-
if: steps.filter.outputs.julia_file_change == 'true'
28-
with:
29-
version: '1.11'
30-
31-
- name: Apply JuliaFormatter
32-
if: steps.filter.outputs.julia_file_change == 'true'
33-
run: |
34-
julia --project=.dev .dev/climaformat.jl .
35-
36-
- name: Check formatting diff
37-
if: steps.filter.outputs.julia_file_change == 'true'
38-
run: |
39-
git diff --color=always --exit-code
13+
- uses: julia-actions/julia-format@v4
14+
with:
15+
version: '1' # Set `version` to '1.0.62' if you run into issues
16+
# To use the same JuliaFormatter version locally, run: `julia -e 'using Pkg; Pkg.add(PackageSpec("JuliaFormatter", v"1.0.62"))'`
17+
suggestion-label: 'format-suggest' # leave this unset or empty to show suggestions for all PRs

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9+
#### Use JuliaFormatter; remove .dev folder PR[#1484](https://github.com/CliMA/ClimaCoupler.jl/pull/1484)
10+
Use JuliaFormatter to format the repo, rather than the previous `.dev/juliaformat.jl`.
11+
The `.dev/` folder is removed, and a documentation page about contributing to
12+
ClimaCoupler.jl is added.
13+
914
#### Correctly set land domain with `share_surface_space = true` PR[#1464](https://github.com/CliMA/ClimaCoupler.jl/pull/1464)
1015
Previously, we passed but did not use arguments related to the vertical resolution
1116
in `make_land_domain`. Now we correctly use the provided `dz_tuple` and `n_elements_vert`.

docs/make.jl

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ map(
5353

5454
# pages layout
5555
experiment_pages = [
56-
"Sea Breeze" => map(s -> "generated/sea_breeze/$(s)", readdir(joinpath(@__DIR__, "src/generated/sea_breeze"))),
57-
"AMIP" => map(s -> "generated/amip/$(s)", readdir(joinpath(@__DIR__, "src/generated/amip"))),
56+
"Sea Breeze" => map(
57+
s -> "generated/sea_breeze/$(s)",
58+
readdir(joinpath(@__DIR__, "src/generated/sea_breeze")),
59+
),
60+
"AMIP" => map(
61+
s -> "generated/amip/$(s)",
62+
readdir(joinpath(@__DIR__, "src/generated/amip")),
63+
),
5864
]
5965
interface_pages = [
6066
"checkpointer.md",
@@ -75,9 +81,20 @@ pages = Any[
7581
"Coupler Interface" => interface_pages,
7682
"Performance" => performance_pages,
7783
"Model Output" => output_pages,
84+
"Contributing" => "contributing.md",
7885
]
7986

8087

81-
makedocs(sitename = "ClimaCoupler.jl", format = Documenter.HTML(), modules = [ClimaCoupler], pages = pages)
88+
makedocs(
89+
sitename = "ClimaCoupler.jl",
90+
format = Documenter.HTML(),
91+
modules = [ClimaCoupler],
92+
pages = pages,
93+
)
8294

83-
deploydocs(repo = "<github.com/CliMA/ClimaCoupler.jl.git>", push_preview = true, devbranch = "main", forcepush = true)
95+
deploydocs(
96+
repo = "<github.com/CliMA/ClimaCoupler.jl.git>",
97+
push_preview = true,
98+
devbranch = "main",
99+
forcepush = true,
100+
)

docs/src/contributing.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing
2+
3+
Thank you for contributing to `ClimaCoupler`! We encourage Pull Requests (PRs).
4+
Please do not hesitate to ask questions, or to open issues if something seems amiss
5+
or you'd like a new feature.
6+
7+
## Some useful tips
8+
- When developing code it's best to work on a branch off of the most recent main.
9+
This can be done by running the following commands, where "initials" corresponds to the first and last initial of the person starting the branch.
10+
```
11+
git checkout main
12+
git pull
13+
git checkout -b initials/branch_name
14+
```
15+
16+
- Make sure you add tests for your code in `test/`, appropriate documentation in `docs/`,
17+
and descriptive inline comments throughout the code.
18+
All exported functions and structs must have docstrings.
19+
- When your PR is ready for review, clean up your commit history by squashing to 1 commit per PR
20+
and make sure your code is current with the main branch by rebasing.
21+
22+
## Continuous integration
23+
24+
After rebasing your branch, you can ask for review. Fill out the template and
25+
provide a clear summary of what your PR does. When a PR is created or
26+
updated, a set of automated tests are run on the PR in our continuous
27+
integration (CI) system.
28+
29+
ClimaCoupler.jl's continuous integration contains both unit tests and integration
30+
tests (coupled simulations).
31+
32+
### Formatting check
33+
34+
The `JuliaFormatter` test checks if the PR is correctly formatted according to
35+
the project's style guidelines. The previous `.dev/climaformat.jl` script has
36+
been discontinued in favor of using the JuliaFormatter package directly.
37+
38+
To format your code, first add JuliaFormatter to your base environment:
39+
40+
```sh
41+
julia -e 'using Pkg; Pkg.add(PackageSpec("JuliaFormatter", v"1.0.62"))'
42+
```
43+
44+
Then, in a Julia REPL, run:
45+
46+
```julia
47+
using JuliaFormatter; format(".")
48+
```
49+
50+
51+
### Documentation
52+
53+
The `Documentation` test rebuilds the documentation for the PR and checks if the docs
54+
are consistent and generate valid output.
55+
56+
To add internal references, for example to another documentation page or API, see the relevant
57+
`Documenter.jl` `@ref` [documentation page](@extref Documenter Named-@refs), example syntax:
58+
`[see contributor guide](@ref "Contributing")` for a page or
59+
`[CoupledSimulation object and constructors](@ref ClimaCoupler.Interfacer.CoupledSimulation)` for an API.
60+
61+
To add external references, for example to another package documentation page or API, see
62+
the documentation of [DocumenterInterLinks](https://juliadocs.org/DocumenterInterLinks.jl/stable/).
63+
Example syntax: `[how to us @ref](@extref Documenter Named-@refs)`.
64+
65+
To add a reference from the literature, see the documentation of
66+
[DocumenterCitations.jl](https://juliadocs.org/DocumenterCitations.jl/stable/), in short, add your reference
67+
to `docs/src/refs.bib` and then refer to it with this syntax `[authors1999](@citet)`.

0 commit comments

Comments
 (0)