From 8e8dad891dca6b2f844368b0fb3bea6530951fb0 Mon Sep 17 00:00:00 2001
From: Arno Strouwen <arno.strouwen@telenet.be>
Date: Sun, 26 Nov 2023 05:23:24 +0100
Subject: [PATCH] add Aqua QA

---
 Project.toml     | 12 +++++++++++-
 test/qa.jl       | 13 +++++++++++++
 test/runtests.jl |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 test/qa.jl

diff --git a/Project.toml b/Project.toml
index d8719ddfb..60764651b 100644
--- a/Project.toml
+++ b/Project.toml
@@ -43,7 +43,9 @@ NonlinearSolveZygoteExt = "Zygote"
 [compat]
 ADTypes = "0.2"
 ArrayInterface = "6.0.24, 7"
+Aqua = "0.8"
 BandedMatrices = "1"
+BenchmarkTools = "1"
 ConcreteStructs = "0.2"
 DiffEqBase = "6.141"
 EnumX = "1"
@@ -57,22 +59,30 @@ LeastSquaresOptim = "0.8"
 LineSearches = "7"
 LinearAlgebra = "<0.0.1, 1"
 LinearSolve = "2.12"
+NaNMath = "1"
 NonlinearProblemLibrary = "0.1"
+Pkg = "1"
 PrecompileTools = "1"
 Printf = "<0.0.1, 1"
+Random = "1"
 RecursiveArrayTools = "2"
 Reexport = "0.2, 1"
+SafeTestsets = "0.1"
 SciMLBase = "2.9"
 SciMLOperators = "0.3"
 SimpleNonlinearSolve = "0.1.23"
 SparseArrays = "<0.0.1, 1"
 SparseDiffTools = "2.12"
+StaticArrays = "1"
 StaticArraysCore = "1.4"
+Symbolics = "5"
+Test = "1"
 UnPack = "1.0"
 Zygote = "0.6"
 julia = "1.9"
 
 [extras]
+Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
 BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
 BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
 DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
@@ -94,4 +104,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
 Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
 
 [targets]
-test = ["Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase"]
+test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase"]
diff --git a/test/qa.jl b/test/qa.jl
new file mode 100644
index 000000000..960f7fc8b
--- /dev/null
+++ b/test/qa.jl
@@ -0,0 +1,13 @@
+using NonlinearSolve, Aqua
+
+@testset "Aqua" begin
+    Aqua.find_persistent_tasks_deps(NonlinearSolve)
+    Aqua.test_ambiguities(NonlinearSolve, recursive = false)
+    Aqua.test_deps_compat(NonlinearSolve)
+    Aqua.test_piracies(NonlinearSolve,
+        treat_as_own = [NonlinearProblem, NonlinearLeastSquaresProblem])
+    Aqua.test_project_extras(NonlinearSolve)
+    Aqua.test_stale_deps(NonlinearSolve)
+    Aqua.test_unbound_args(NonlinearSolve)
+    Aqua.test_undefined_exports(NonlinearSolve)
+end
diff --git a/test/runtests.jl b/test/runtests.jl
index a5365cf38..a6d9491db 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -13,6 +13,7 @@ end
 
 @time begin
     if GROUP == "All" || GROUP == "Core"
+        @time @safetestset "Quality Assurance" include("qa.jl")
         @time @safetestset "Basic Tests + Some AD" include("basictests.jl")
         @time @safetestset "Sparsity Tests" include("sparse.jl")
         @time @safetestset "Polyalgs" include("polyalgs.jl")