From 763d2441b3070dfc80c3fe1cc2814e45d9b76516 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Tue, 13 Aug 2024 10:59:40 +0200 Subject: [PATCH] Change the default indentation from 2 to 4 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 --- CHANGELOG.md | 1 + copier.yml | 2 +- src/debug/Data.jl | 2 +- template/docs/make.jl.jinja | 24 ++++++++++++------------ template/test/runtests.jl.jinja | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 883afb5c..4f6d5cc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/copier.yml b/copier.yml index 15fbd42e..31048107 100644 --- a/copier.yml +++ b/copier.yml @@ -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: diff --git a/src/debug/Data.jl b/src/debug/Data.jl index f46068ba..1875a606 100644 --- a/src/debug/Data.jl +++ b/src/debug/Data.jl @@ -25,7 +25,7 @@ const strategy_minimum = merge( Dict( "JuliaMinVersion" => "1.6", "License" => "MIT", - "Indentation" => "2", + "Indentation" => "4", "AnswerStrategy" => "minimum", ), ) diff --git a/template/docs/make.jl.jinja b/template/docs/make.jl.jinja index ae19dc57..643afedf 100644 --- a/template/docs/make.jl.jinja +++ b/template/docs/make.jl.jinja @@ -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") diff --git a/template/test/runtests.jl.jinja b/template/test/runtests.jl.jinja index 30041602..ea2bd9d0 100644 --- a/template/test/runtests.jl.jinja +++ b/template/test/runtests.jl.jinja @@ -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