Skip to content

Commit

Permalink
Change the default indentation from 2 to 4
Browse files Browse the repository at this point in the history
This is the default in the Julia ecosystem, both in the official
guidelines and on various styles.

The Julia files in the template have been changed to use 4 spaces. The
other files in the template are still using 2 spaces. This should be
changed to 4 when pre-commit is run for the first time.

Closes #403
  • Loading branch information
abelsiqueira committed Aug 13, 2024
1 parent 90b3862 commit 763d244
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning].

- Update pre-commit hook versions
- JuliaFormatter 1.0.58 -> 1.0.59
- Default Indentation changed from 2 to 4 (#403)

## [0.9.1] - 2024-07-24

Expand Down
2 changes: 1 addition & 1 deletion copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Indentation:
type: int
help: Indentation length (Used in .JuliaFormatter and other configuration files of formatters and linters if you add them)
validator: "{% if Indentation <= 0 %}Indentation must be positive{% endif %}"
default: 2
default: 4

# Optional
AnswerStrategy:
Expand Down
2 changes: 1 addition & 1 deletion src/debug/Data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const strategy_minimum = merge(
Dict(
"JuliaMinVersion" => "1.6",
"License" => "MIT",
"Indentation" => "2",
"Indentation" => "4",
"AnswerStrategy" => "minimum",
),
)
Expand Down
24 changes: 12 additions & 12 deletions template/docs/make.jl.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ DocMeta.setdocmeta!({{ PackageName }}, :DocTestSetup, :(using {{ PackageName }})
const page_rename = Dict("developer.md" => "Developer docs") # Without the numbers

makedocs(;
modules = [{{ PackageName }}],
authors = "{{ AuthorName }} <{{ AuthorEmail }}> and contributors",
repo = "https://github.com/{{ PackageOwner }}/{{ PackageName }}.jl/blob/{commit}{path}#{line}",
sitename = "{{ PackageName }}.jl",
format = Documenter.HTML(; canonical = "https://{{ PackageOwner }}.github.io/{{ PackageName }}.jl"),
pages = [
"index.md"
[
file for
file in readdir(joinpath(@__DIR__, "src")) if file != "index.md" && splitext(file)[2] == ".md"
]
],
modules = [{{ PackageName }}],
authors = "{{ AuthorName }} <{{ AuthorEmail }}> and contributors",
repo = "https://github.com/{{ PackageOwner }}/{{ PackageName }}.jl/blob/{commit}{path}#{line}",
sitename = "{{ PackageName }}.jl",
format = Documenter.HTML(; canonical = "https://{{ PackageOwner }}.github.io/{{ PackageName }}.jl"),
pages = [
"index.md"
[
file for file in readdir(joinpath(@__DIR__, "src")) if
file != "index.md" && splitext(file)[2] == ".md"
]
],
)

deploydocs(; repo = "github.com/{{ PackageOwner }}/{{ PackageName }}.jl")
2 changes: 1 addition & 1 deletion template/test/runtests.jl.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ using {{ PackageName }}
using Test

@testset "{{ PackageName }}.jl" begin
@test {{ PackageName }}.hello_world() == "Hello, World!"
@test {{ PackageName }}.hello_world() == "Hello, World!"
end

0 comments on commit 763d244

Please sign in to comment.