forked from adrhill/SparseConnectivityTracer.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinting.jl
86 lines (80 loc) · 2.9 KB
/
linting.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using SparseConnectivityTracer
using Test
using JuliaFormatter: JuliaFormatter
using Aqua: Aqua
using JET: JET
using ExplicitImports: ExplicitImports
# Load package extensions so they get tested by ExplicitImports.jl
using DataInterpolations: DataInterpolations
using NaNMath: NaNMath
using NNlib: NNlib
using SpecialFunctions: SpecialFunctions
@testset "Code formatting" begin
# Using JuliaFormatter v1 (`add JuliaFormatter@1`)
# https://github.com/domluna/JuliaFormatter.jl/issues/909
@info "...with JuliaFormatter.jl"
@test JuliaFormatter.format(SparseConnectivityTracer; verbose=false, overwrite=false)
end
@testset "Aqua tests" begin
@info "...with Aqua.jl"
Aqua.test_all(
SparseConnectivityTracer;
ambiguities=false,
deps_compat=(check_extras=false,),
persistent_tasks=false,
)
end
if VERSION < v"1.12"
# JET v0.9 is compatible with Julia <1.12
# JET v0.10 is compatible with Julia ≥1.12
# TODO: Update when 1.12 releases
@testset "JET tests" begin
@info "...with JET.jl"
JET.test_package(SparseConnectivityTracer; target_defined_modules=true)
end
end
@testset "ExplicitImports tests" begin
@info "...with ExplicitImports.jl"
@testset "Improper implicit imports" begin
@test ExplicitImports.check_no_implicit_imports(SparseConnectivityTracer) ===
nothing
end
@testset "Improper explicit imports" begin
@test ExplicitImports.check_no_stale_explicit_imports(
SparseConnectivityTracer;
ignore=(
# Used in code generation, which ExplicitImports doesn't pick up
:AbstractTracer,
:AkimaInterpolation,
:BSplineApprox,
:BSplineInterpolation,
:ConstantInterpolation,
:CubicHermiteSpline,
:CubicSpline,
:LagrangeInterpolation,
:LinearInterpolation,
:QuadraticInterpolation,
:QuadraticSpline,
:QuinticHermiteSpline,
),
) === nothing
@test ExplicitImports.check_all_explicit_imports_via_owners(
SparseConnectivityTracer
) === nothing
# TODO: test in the future when `public` is more common
# @test ExplicitImports.check_all_explicit_imports_are_public(
# SparseConnectivityTracer
# ) === nothing
end
@testset "Improper qualified accesses" begin
@test ExplicitImports.check_all_qualified_accesses_via_owners(
SparseConnectivityTracer
) === nothing
@test ExplicitImports.check_no_self_qualified_accesses(SparseConnectivityTracer) ===
nothing
# TODO: test in the future when `public` is more common
# @test ExplicitImports.check_all_qualified_accesses_are_public(
# SparseConnectivityTracer
# ) === nothing
end
end