Skip to content

Commit

Permalink
whitespace around = in kwargs (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
  • Loading branch information
ranocha and sloede authored Jan 30, 2024
1 parent 01e8c76 commit 1dc5a93
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
3 changes: 0 additions & 3 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ yas_style_nesting = true
# Align struct fields for better readability of large struct definitions
align_struct_field = true

# No whitespaces in kwargs because this is more common in Julia
whitespace_in_kwargs = false

# Allow Dict definitions to be aligned like arrays. See https://github.com/domluna/JuliaFormatter.jl/pull/676
variable_call_indent = ["Dict"]
26 changes: 13 additions & 13 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ end
using TrixiBase

# Define module-wide setups such that the respective modules are available in doctests
DocMeta.setdocmeta!(TrixiBase, :DocTestSetup, :(using TrixiBase); recursive=true)
DocMeta.setdocmeta!(TrixiBase, :DocTestSetup, :(using TrixiBase); recursive = true)

# Copy files to not need to synchronize them manually
function copy_file(filename, replaces...; new_filename=lowercase(filename))
function copy_file(filename, replaces...; new_filename = lowercase(filename))
content = read(joinpath(trixibase_root_dir, filename), String)
content = replace(content, replaces...)

Expand All @@ -29,7 +29,7 @@ function copy_file(filename, replaces...; new_filename=lowercase(filename))
write(joinpath(@__DIR__, "src", new_filename), content)
end

copy_file("README.md", new_filename="index.md")
copy_file("README.md", new_filename = "index.md")
copy_file("AUTHORS.md",
"in the [LICENSE.md](LICENSE.md) file" => "under [License](@ref)")
# Add section `# License` and add `>` in each line to add a quote
Expand All @@ -38,22 +38,22 @@ copy_file("LICENSE.md",
"\n" => "\n> ", r"^" => "# License\n\n> ")

# Make documentation
makedocs(sitename="TrixiBase.jl",
makedocs(sitename = "TrixiBase.jl",
# Provide additional formatting options
format=Documenter.HTML(
# Disable pretty URLs during manual testing
prettyurls=get(ENV, "CI", nothing) == "true",
# Set canonical URL to GitHub pages URL
canonical="https://trixi-framework.github.io/TrixiBase.jl/stable"),
format = Documenter.HTML(
# Disable pretty URLs during manual testing
prettyurls = get(ENV, "CI", nothing) == "true",
# Set canonical URL to GitHub pages URL
canonical = "https://trixi-framework.github.io/TrixiBase.jl/stable"),
# Explicitly specify documentation structure
pages=[
pages = [
"Home" => "index.md",
"API reference" => "reference.md",
"Authors" => "authors.md",
"License" => "license.md",
])

deploydocs(;
repo="github.com/trixi-framework/TrixiBase.jl",
devbranch="main",
push_preview=true)
repo = "github.com/trixi-framework/TrixiBase.jl",
devbranch = "main",
push_preview = true)
27 changes: 14 additions & 13 deletions test/trixi_include.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
@test @isdefined x
@test x == 4

@test_nowarn trixi_include(@__MODULE__, filename, x=7)
@test_nowarn trixi_include(@__MODULE__, filename, x = 7)
@test x == 7

# Verify default version (that includes in `Main`)
@test_nowarn trixi_include(filename, x=11)
@test_nowarn trixi_include(filename, x = 11)
@test Main.x == 11

@test_throws "assignment `y` not found in expression" trixi_include(@__MODULE__,
filename,
y=3)
y = 3)
finally
rm(filename, force=true)
rm(filename, force = true)
end
end

Expand All @@ -52,9 +52,9 @@

@test_throws "no method matching solve(; maxiters" trixi_include(@__MODULE__,
filename,
maxiters=3)
maxiters = 3)
finally
rm(filename, force=true)
rm(filename, force = true)
end
end

Expand Down Expand Up @@ -106,22 +106,23 @@
# This is the default `maxiters` inserted by `trixi_include`
@test x == 10^5

@test_nowarn trixi_include(@__MODULE__, filename2, maxiters=7)
@test_nowarn trixi_include(@__MODULE__, filename2,
maxiters = 7)
# Test that `maxiters` got overwritten
@test x == 7

# Verify that adding `maxiters` to `maxiters` results in exactly one of them
# case 1) `maxiters` is *before* semicolon in included file
@test_nowarn trixi_include(@__MODULE__, filename3, maxiters=11)
@test_nowarn trixi_include(@__MODULE__, filename3, maxiters = 11)
@test y == 11
# case 2) `maxiters` is *after* semicolon in included file
@test_nowarn trixi_include(@__MODULE__, filename3, maxiters=14)
@test_nowarn trixi_include(@__MODULE__, filename3, maxiters = 14)
@test y == 14
finally
rm(filename1, force=true)
rm(filename2, force=true)
rm(filename3, force=true)
rm(filename4, force=true)
rm(filename1, force = true)
rm(filename2, force = true)
rm(filename3, force = true)
rm(filename4, force = true)
end
end
end

0 comments on commit 1dc5a93

Please sign in to comment.