Skip to content

Commit db37027

Browse files
authored
Merge pull request #86 from SciML/format
format with SciML Style
2 parents 95252f2 + 30d455e commit db37027

Some content is hidden

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

45 files changed

+1992
-1996
lines changed

.JuliaFormatter.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style = "sciml"

.github/workflows/FormatCheck.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: format-check
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'release-'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
julia-version: [1]
17+
julia-arch: [x86]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: julia-actions/setup-julia@latest
21+
with:
22+
version: ${{ matrix.julia-version }}
23+
24+
- uses: actions/checkout@v1
25+
- name: Install JuliaFormatter and format
26+
# This will use the latest version by default but you can set the version like so:
27+
#
28+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
29+
run: |
30+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
31+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
32+
- name: Format check
33+
run: |
34+
julia -e '
35+
out = Cmd(`git diff --name-only`) |> read |> String
36+
if out == ""
37+
exit(0)
38+
else
39+
@error "Some files have not been formatted !!!"
40+
write(stdout, out)
41+
exit(1)
42+
end'

docs/make.jl

+14-20
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,25 @@ using ModelingToolkitStandardLibrary.Thermal
99

1010
include("pages.jl")
1111

12-
makedocs(
13-
sitename="ModelingToolkitStandardLibrary.jl",
14-
authors="Julia Computing",
15-
clean=true,
16-
doctest=false,
17-
strict=[
18-
:doctest,
19-
:example_block,
20-
],
21-
modules=[ModelingToolkitStandardLibrary,
12+
makedocs(sitename = "ModelingToolkitStandardLibrary.jl",
13+
authors = "Julia Computing",
14+
clean = true,
15+
doctest = false,
16+
strict = [
17+
:doctest,
18+
:example_block,
19+
],
20+
modules = [ModelingToolkitStandardLibrary,
2221
ModelingToolkitStandardLibrary.Blocks,
2322
ModelingToolkitStandardLibrary.Mechanical,
2423
ModelingToolkitStandardLibrary.Mechanical.Rotational,
2524
ModelingToolkitStandardLibrary.Magnetic,
2625
ModelingToolkitStandardLibrary.Magnetic.FluxTubes,
2726
ModelingToolkitStandardLibrary.Electrical,
2827
ModelingToolkitStandardLibrary.Thermal],
28+
format = Documenter.HTML(assets = ["assets/favicon.ico"],
29+
canonical = "https://mtkstdlib.sciml.ai/stable/"),
30+
pages = pages)
2931

30-
format=Documenter.HTML(assets=["assets/favicon.ico"],
31-
canonical="https://mtkstdlib.sciml.ai/stable/"),
32-
33-
pages=pages
34-
)
35-
36-
deploydocs(
37-
repo="github.com/SciML/ModelingToolkitStandardLibrary.jl";
38-
push_preview=true
39-
)
32+
deploydocs(repo = "github.com/SciML/ModelingToolkitStandardLibrary.jl";
33+
push_preview = true)

docs/pages.jl

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
pages = [
2-
"ModelingToolkitStandardLibrary.jl: A Standard Library for ModelingToolkit" => "index.md",
3-
4-
"Tutorials" => [
5-
"RC Circuit" => "tutorials/rc_circuit.md",
6-
"Custom Components" => "tutorials/custom_component.md",
7-
"Thermal Conduction Model" => "tutorials/thermal_model.md",
8-
],
9-
10-
"API" => [
11-
"Basic Blocks" => "API/blocks.md",
12-
"Electrical Components" => "API/electrical.md",
13-
"Magnetic Components" => "API/magnetic.md",
14-
"Mechanical Components" => "API/mechanical.md",
15-
"Thermal Components" => "API/thermal.md"
16-
],
17-
]
2+
"ModelingToolkitStandardLibrary.jl: A Standard Library for ModelingToolkit" => "index.md",
3+
"Tutorials" => [
4+
"RC Circuit" => "tutorials/rc_circuit.md",
5+
"Custom Components" => "tutorials/custom_component.md",
6+
"Thermal Conduction Model" => "tutorials/thermal_model.md",
7+
],
8+
"API" => [
9+
"Basic Blocks" => "API/blocks.md",
10+
"Electrical Components" => "API/electrical.md",
11+
"Magnetic Components" => "API/magnetic.md",
12+
"Mechanical Components" => "API/mechanical.md",
13+
"Thermal Components" => "API/thermal.md",
14+
],
15+
]

src/Blocks/Blocks.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export Integrator, Derivative, FirstOrder, SecondOrder, StateSpace
2626
export PI, LimPI, PID, LimPID
2727
include("continuous.jl")
2828

29-
end
29+
end

0 commit comments

Comments
 (0)