Skip to content

Commit 4590181

Browse files
committed
fix: QA for NonlinearSolveBase
1 parent 8cf9899 commit 4590181

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

lib/NonlinearSolveBase/Project.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,36 @@ NonlinearSolveBaseSparseArraysExt = "SparseArrays"
3131

3232
[compat]
3333
ADTypes = "1.9"
34+
Aqua = "0.8.7"
3435
ArrayInterface = "7.9"
3536
CommonSolve = "0.2.4"
3637
Compat = "4.15"
3738
ConcreteStructs = "0.2.3"
3839
DiffEqBase = "6.149"
3940
DifferentiationInterface = "0.6.1"
4041
EnzymeCore = "0.8"
42+
ExplicitImports = "1.10.1"
4143
FastClosures = "0.3"
4244
ForwardDiff = "0.10.36"
4345
FunctionProperties = "0.1.2"
46+
InteractiveUtils = "<0.0.1, 1"
4447
LinearAlgebra = "1.10"
4548
Markdown = "1.10"
4649
RecursiveArrayTools = "3"
4750
SciMLBase = "2.50"
4851
SparseArrays = "1.10"
4952
StaticArraysCore = "1.4"
53+
Test = "1.10"
5054
julia = "1.10"
55+
56+
[extras]
57+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
58+
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
59+
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
60+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
61+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
62+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
63+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
64+
65+
[targets]
66+
test = ["Aqua", "DiffEqBase", "ExplicitImports", "ForwardDiff", "InteractiveUtils", "SparseArrays", "Test"]

lib/NonlinearSolveBase/ext/NonlinearSolveBaseForwardDiffExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module NonlinearSolveBaseForwardDiffExt
33
using ADTypes: ADTypes, AutoForwardDiff, AutoPolyesterForwardDiff
44
using ArrayInterface: ArrayInterface
55
using CommonSolve: solve
6-
using DifferentiationInterface: DifferentiationInterface, Constant
6+
using DifferentiationInterface: DifferentiationInterface
77
using FastClosures: @closure
88
using ForwardDiff: ForwardDiff, Dual
99
using LinearAlgebra: mul!

lib/NonlinearSolveBase/src/NonlinearSolveBase.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module NonlinearSolveBase
22

3-
using ADTypes: ADTypes, AbstractADType, ForwardMode, ReverseMode
3+
using ADTypes: ADTypes, AbstractADType
44
using ArrayInterface: ArrayInterface
5+
using CommonSolve: CommonSolve
56
using Compat: @compat
67
using ConcreteStructs: @concrete
78
using DifferentiationInterface: DifferentiationInterface

lib/NonlinearSolveBase/src/termination_conditions.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function update_u!!(cache::NonlinearTerminationModeCache, u)
3030
end
3131
end
3232

33-
function SciMLBase.init(
34-
du, u, mode::AbstractNonlinearTerminationMode, saved_value_prototype...;
35-
abstol = nothing, reltol = nothing, kwargs...)
33+
function CommonSolve.init(
34+
::AbstractNonlinearProblem, mode::AbstractNonlinearTerminationMode, du, u,
35+
saved_value_prototype...; abstol = nothing, reltol = nothing, kwargs...)
3636
T = promote_type(eltype(du), eltype(u))
3737
abstol = get_tolerance(u, abstol, T)
3838
reltol = get_tolerance(u, reltol, T)
@@ -273,11 +273,11 @@ function init_termination_cache(
273273
prob, abstol, reltol, du, u, default_termination_mode(prob, callee), callee)
274274
end
275275

276-
function init_termination_cache(::AbstractNonlinearProblem, abstol, reltol, du,
276+
function init_termination_cache(prob::AbstractNonlinearProblem, abstol, reltol, du,
277277
u, tc::AbstractNonlinearTerminationMode, ::Val)
278278
T = promote_type(eltype(du), eltype(u))
279279
abstol = get_tolerance(u, abstol, T)
280280
reltol = get_tolerance(u, reltol, T)
281-
cache = SciMLBase.init(du, u, tc; abstol, reltol)
281+
cache = CommonSolve.init(prob, tc, du, u; abstol, reltol)
282282
return abstol, reltol, cache
283283
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1+
using InteractiveUtils, Test
12

3+
@info sprint(InteractiveUtils.versioninfo)
4+
5+
# Changing any code here triggers all the other tests to be run. So we intentionally
6+
# keep the tests here minimal.
7+
@testset "NonlinearSolveBase.jl" begin
8+
@testset "Aqua" begin
9+
using Aqua, NonlinearSolveBase
10+
11+
Aqua.test_all(NonlinearSolveBase; piracies = false, ambiguities = false)
12+
Aqua.test_piracies(NonlinearSolveBase)
13+
Aqua.test_ambiguities(NonlinearSolveBase; recursive = false)
14+
end
15+
16+
@testset "Explicit Imports" begin
17+
import ForwardDiff, SparseArrays, DiffEqBase
18+
using ExplicitImports, NonlinearSolveBase
19+
20+
@test check_no_implicit_imports(NonlinearSolveBase; skip = (Base, Core)) === nothing
21+
@test check_no_stale_explicit_imports(NonlinearSolveBase) === nothing
22+
@test check_all_qualified_accesses_via_owners(NonlinearSolveBase) === nothing
23+
end
24+
end

0 commit comments

Comments
 (0)