Skip to content

Commit 115a2ec

Browse files
committed
Update templates
1 parent 3eb5df7 commit 115a2ec

File tree

10 files changed

+82
-77
lines changed

10 files changed

+82
-77
lines changed

templates/docs/docs/make.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ using {PKGNAME}: {PKGNAME}
22
using Documenter: Documenter, DocMeta, deploydocs, makedocs
33

44
DocMeta.setdocmeta!(
5-
{PKGNAME}, :DocTestSetup, :(using {PKGNAME}); recursive=true
5+
{PKGNAME}, :DocTestSetup, :(using {PKGNAME}); recursive = true
66
)
77

88
include("make_index.jl")
99

1010
makedocs(;
11-
modules=[{PKGNAME}],
12-
authors="ITensor developers <support@itensor.org> and contributors",
13-
sitename="{PKGNAME}.jl",
14-
format=Documenter.HTML(;
15-
canonical="https://itensor.github.io/{PKGNAME}.jl",
16-
edit_link="main",
17-
assets=["assets/favicon.ico", "assets/extras.css"],
18-
),
19-
pages=["Home" => "index.md", "Reference" => "reference.md"],
11+
modules = [{PKGNAME}],
12+
authors = "ITensor developers <support@itensor.org> and contributors",
13+
sitename = "{PKGNAME}.jl",
14+
format = Documenter.HTML(;
15+
canonical = "https://itensor.github.io/{PKGNAME}.jl",
16+
edit_link = "main",
17+
assets = ["assets/favicon.ico", "assets/extras.css"],
18+
),
19+
pages = ["Home" => "index.md", "Reference" => "reference.md"],
2020
)
2121

2222
deploydocs(;
23-
repo="github.com/ITensor/{PKGNAME}.jl", devbranch="main", push_preview=true
23+
repo = "github.com/ITensor/{PKGNAME}.jl", devbranch = "main", push_preview = true
2424
)

templates/docs/docs/make_index.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using {PKGNAME}: {PKGNAME}
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
```@raw html
77
<img class="display-light-only" src="assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
88
<img class="display-dark-only" src="assets/CCQ-dark.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
99
```
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir({PKGNAME}), "examples", "README.jl"),
17-
joinpath(pkgdir({PKGNAME}), "docs", "src");
18-
flavor=Literate.DocumenterFlavor(),
19-
name="index",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir({PKGNAME}), "examples", "README.jl"),
17+
joinpath(pkgdir({PKGNAME}), "docs", "src");
18+
flavor = Literate.DocumenterFlavor(),
19+
name = "index",
20+
postprocess = ccq_logo,
2121
)

templates/docs/docs/make_readme.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using {PKGNAME}: {PKGNAME}
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
<picture>
77
<source media="(prefers-color-scheme: dark)" width="20%" srcset="docs/src/assets/CCQ-dark.png">
88
<img alt="Flatiron Center for Computational Quantum Physics logo." width="20%" src="docs/src/assets/CCQ.png">
99
</picture>
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir({PKGNAME}), "examples", "README.jl"),
17-
joinpath(pkgdir({PKGNAME}));
18-
flavor=Literate.CommonMarkFlavor(),
19-
name="README",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir({PKGNAME}), "examples", "README.jl"),
17+
joinpath(pkgdir({PKGNAME}));
18+
flavor = Literate.CommonMarkFlavor(),
19+
name = "README",
20+
postprocess = ccq_logo,
2121
)

templates/examples/examples/README.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
```julia
2323
julia> using Pkg: Pkg
2424
25-
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
25+
julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry")
2626
```
2727
=#
2828
# or:
2929
#=
3030
```julia
31-
julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git")
31+
julia> Pkg.Registry.add(url = "git@github.com:ITensor/ITensorRegistry.git")
3232
```
3333
=#
3434
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

templates/formatter/.JuliaFormatter.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

templates/github/.github/workflows/FormatCheck.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: "Format Check"
22

3+
permissions:
4+
contents: read
5+
checks: write
6+
issues: write
7+
pull-requests: write
8+
39
on:
410
push:
511
branches:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ci:
2-
skip: [julia-formatter]
2+
skip: [runic]
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
exclude_types: [markdown] # incompatible with Literate.jl
1313

14-
- repo: "https://github.com/domluna/JuliaFormatter.jl"
15-
rev: v2.1.6
14+
- repo: https://github.com/fredrikekre/runic-pre-commit
15+
rev: v2.0.1
1616
hooks:
17-
- id: "julia-formatter"
17+
- id: runic

templates/test/test/runtests.jl

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,62 @@ using Suppressor: Suppressor
66
const pat = r"(?:--group=)(\w+)"
77
arg_id = findfirst(contains(pat), ARGS)
88
const GROUP = uppercase(
9-
if isnothing(arg_id)
10-
get(ENV, "GROUP", "ALL")
11-
else
12-
only(match(pat, ARGS[arg_id]).captures)
13-
end,
9+
if isnothing(arg_id)
10+
get(ENV, "GROUP", "ALL")
11+
else
12+
only(match(pat, ARGS[arg_id]).captures)
13+
end,
1414
)
1515

1616
"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
1717
function istestfile(fn)
18-
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
18+
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
1919
end
2020
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
2121
function isexamplefile(fn)
22-
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
22+
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
2323
end
2424

2525
@time begin
26-
# tests in groups based on folder structure
27-
for testgroup in filter(isdir, readdir(@__DIR__))
28-
if GROUP == "ALL" || GROUP == uppercase(testgroup)
29-
groupdir = joinpath(@__DIR__, testgroup)
30-
for file in filter(istestfile, readdir(groupdir))
31-
filename = joinpath(groupdir, file)
32-
@eval @safetestset $file begin
33-
include($filename)
26+
# tests in groups based on folder structure
27+
for testgroup in filter(isdir, readdir(@__DIR__))
28+
if GROUP == "ALL" || GROUP == uppercase(testgroup)
29+
groupdir = joinpath(@__DIR__, testgroup)
30+
for file in filter(istestfile, readdir(groupdir))
31+
filename = joinpath(groupdir, file)
32+
@eval @safetestset $file begin
33+
include($filename)
34+
end
35+
end
3436
end
35-
end
3637
end
37-
end
3838

39-
# single files in top folder
40-
for file in filter(istestfile, readdir(@__DIR__))
41-
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
42-
@eval @safetestset $file begin
43-
include($file)
39+
# single files in top folder
40+
for file in filter(istestfile, readdir(@__DIR__))
41+
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
42+
@eval @safetestset $file begin
43+
include($file)
44+
end
4445
end
45-
end
4646

47-
# test examples
48-
examplepath = joinpath(@__DIR__, "..", "examples")
49-
for (root, _, files) in walkdir(examplepath)
50-
contains(chopprefix(root, @__DIR__), "setup") && continue
51-
for file in filter(isexamplefile, files)
52-
filename = joinpath(root, file)
53-
@eval begin
54-
@safetestset $file begin
55-
$(Expr(
56-
:macrocall,
57-
GlobalRef(Suppressor, Symbol("@suppress")),
58-
LineNumberNode(@__LINE__, @__FILE__),
59-
:(include($filename)),
60-
))
47+
# test examples
48+
examplepath = joinpath(@__DIR__, "..", "examples")
49+
for (root, _, files) in walkdir(examplepath)
50+
contains(chopprefix(root, @__DIR__), "setup") && continue
51+
for file in filter(isexamplefile, files)
52+
filename = joinpath(root, file)
53+
@eval begin
54+
@safetestset $file begin
55+
$(
56+
Expr(
57+
:macrocall,
58+
GlobalRef(Suppressor, Symbol("@suppress")),
59+
LineNumberNode(@__LINE__, @__FILE__),
60+
:(include($filename)),
61+
)
62+
)
63+
end
64+
end
6165
end
62-
end
6366
end
64-
end
6567
end

templates/test/test/test_aqua.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ using Aqua: Aqua
33
using Test: @testset
44

55
@testset "Code quality (Aqua.jl)" begin
6-
Aqua.test_all({PKGNAME})
6+
Aqua.test_all({PKGNAME})
77
end

templates/test/test/test_basics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ using {PKGNAME}: {PKGNAME}
22
using Test: @test, @testset
33

44
@testset "{PKGNAME}" begin
5-
# Tests go here.
5+
# Tests go here.
66
end

0 commit comments

Comments
 (0)