Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Merge #536
Browse files Browse the repository at this point in the history
536: apply JuliaFormatter.jl r=simonbyrne a=simonbyrne

This applies [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) to the whole repository.

Any thoughts/comments?

- [ ] Testing?

Co-authored-by: Simon Byrne <simonbyrne@gmail.com>
  • Loading branch information
bors[bot] and simonbyrne authored Mar 25, 2020
2 parents f978f6f + b8cee51 commit 9ec269b
Show file tree
Hide file tree
Showing 159 changed files with 20,797 additions and 15,738 deletions.
18 changes: 0 additions & 18 deletions .dev/format.jl

This file was deleted.

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A clear and concise description of the code with usage.
I have

- [ ] Written and run all necessary tests with CLIMA by including `tests/runtests.jl`
- [ ] Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and run `julia .dev/format.jl`
- [ ] Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and run `julia .dev/climaformat.jl .`

<!--- Please leave the following section --->

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/JuliaFormatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
version: 1.3
- name: Apply JuliaFormatter
run: |
julia --project=.dev .dev/format.jl origin/master
julia --project=.dev .dev/climaformat.jl .
- name: Check formatting diff
run: |
git diff --color=always --exit-code
9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ This will help us keep the commit history clean on the master branch of CLIMA.

For the most part, we follow the [YASGuide](https://github.com/jrevels/YASGuide) for Julia formatting, with small exceptions covered in the [Coding Conventions](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) section of the documentation.

In addition to this, once you are happy with your PR, please apply [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) to all changed files in the repository.

To apply our formatter settings to all changed files, run:
```
julia .dev/format.jl
```

Formatting changes should be done as a separate commit, ideally the last commit of the pull request (you may want to leave it until all other changes have been approved).

### Formatting utility

A convenience utility is located at `.dev/climaformat.jl` that will format the julia files in the given path. For example, from the top-level CLIMA directory
Expand Down
3 changes: 2 additions & 1 deletion docs/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import Literate

EXAMPLE_BL_DIR = joinpath(@__DIR__, "..", "examples", "DGmethods_old")
GENERATED_BL_DIR = joinpath(@__DIR__, "src", "examples", "DGmethods_old", "generated")
GENERATED_BL_DIR =
joinpath(@__DIR__, "src", "examples", "DGmethods_old", "generated")
for example in readdir(EXAMPLE_BL_DIR)
endswith(example, ".jl") || continue
input = abspath(joinpath(EXAMPLE_BL_DIR, example))
Expand Down
108 changes: 52 additions & 56 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,74 @@ using CLIMA, Documenter
# TODO: Add generated examples back
# include("generate.jl")

GENERATED_BL_EXAMPLES =
[joinpath("examples", "DGmethods_old", "generated", f) for f in
(
"ex_001_periodic_advection.md",
"ex_002_solid_body_rotation.md",
)]
GENERATED_BL_EXAMPLES = filter!(x->isfile(x), GENERATED_BL_EXAMPLES)
GENERATED_BL_EXAMPLES = [
joinpath("examples", "DGmethods_old", "generated", f)
for
f in ("ex_001_periodic_advection.md", "ex_002_solid_body_rotation.md")
]
GENERATED_BL_EXAMPLES = filter!(x -> isfile(x), GENERATED_BL_EXAMPLES)

pages = Any[
"Home" => "index.md",
"Common" => Any[
"MoistThermodynamics" => "Common/MoistThermodynamics.md",
],
"Utilites" => Any[
"RootSolvers" => "Utilities/RootSolvers.md",
],
"Atmos" => Any[
"Atmos/SurfaceFluxes.md",
"Atmos/TurbulenceConvection.md",
"Atmos/EDMFEquations.md",
"Microphysics" => "Atmos/Microphysics.md",
],
"ODESolvers" => "ODESolvers.md",
"LinearSolvers" => "LinearSolvers.md",
"Mesh" => "Mesh.md",
"Arrays" => "Arrays.md",
"DGmethods_old" => "DGmethods_old.md",
"InputOutput.md",
"Developer docs" => Any[
"CodingConventions.md",
"AcceptableUnicode.md",
"VariableList.md",
],
"Home" => "index.md",
"Common" => Any["MoistThermodynamics" => "Common/MoistThermodynamics.md",],
"Utilites" => Any["RootSolvers" => "Utilities/RootSolvers.md",],
"Atmos" => Any[
"Atmos/SurfaceFluxes.md",
"Atmos/TurbulenceConvection.md",
"Atmos/EDMFEquations.md",
"Microphysics" => "Atmos/Microphysics.md",
],
"ODESolvers" => "ODESolvers.md",
"LinearSolvers" => "LinearSolvers.md",
"Mesh" => "Mesh.md",
"Arrays" => "Arrays.md",
"DGmethods_old" => "DGmethods_old.md",
"InputOutput.md",
"Developer docs" => Any[
"CodingConventions.md",
"AcceptableUnicode.md",
"VariableList.md",
],
]

if !isempty(GENERATED_BL_EXAMPLES)
push!(pages,"Balance Law Examples" => ["BalanceLawOverview.md", GENERATED_BL_EXAMPLES...])
push!(
pages,
"Balance Law Examples" =>
["BalanceLawOverview.md", GENERATED_BL_EXAMPLES...],
)
end


makedocs(
sitename = "CLIMA",
doctest = false,
strict = false,
linkcheck = false,
checkdocs = :exports,
# checkdocs = :all,
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true",
sitename = "CLIMA",
doctest = false,
strict = false,
linkcheck = false,
checkdocs = :exports,
# checkdocs = :all,
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true",
mathengine = MathJax(Dict(
:TeX => Dict(
:equationNumbers => Dict(:autoNumber => "AMS"),
:Macros => Dict()
)
))
# prettyurls = !("local" in ARGS),
# canonical = "https://climate-machine.github.io/CLIMA/stable/",
),
clean = true,
modules = [Documenter, CLIMA],
pages = pages,
:Macros => Dict(),
),
)),
# prettyurls = !("local" in ARGS),
# canonical = "https://climate-machine.github.io/CLIMA/stable/",
),
clean = true,
modules = [Documenter, CLIMA],
pages = pages,
)

# make sure there are no *.vtu files left around from the build
p = joinpath(@__DIR__, "build", "examples", "DGmethods_old", "generated")
if ispath(p)
cd(p) do
foreach(file -> endswith(file, ".vtu") && rm(file), readdir())
end
cd(p) do
foreach(file -> endswith(file, ".vtu") && rm(file), readdir())
end
end

deploydocs(
repo = "github.com/climate-machine/CLIMA.git",
target = "build",
)
deploydocs(repo = "github.com/climate-machine/CLIMA.git", target = "build")
Loading

0 comments on commit 9ec269b

Please sign in to comment.