Skip to content

Commit 1fb74bb

Browse files
ViralBShahclaude
andauthored
Add Aqua.jl to CI (#167)
* Add an Aqua job to CI and fix what it flags - Drop exports of names that were never defined (SparseArrayCompat, hvcat!, BinaryOps.BinaryOp, BinaryOps.fmod). - Add compat entries for the stdlib dependencies. - Ambiguities are skipped (many pre-existing) and the two unbound-parameter defaultfill methods are marked broken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix unbound type parameters in defaultfill defaultfill(::Type{Union{T, Nothing}}) where T (and the Missing variant) left T unbound and returned the type T instead of a value. The generic method now strips Nothing/Missing and returns zero of the remaining type. Aqua's unbound_args check is no longer marked broken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e53284b commit 1fb74bb

5 files changed

Lines changed: 35 additions & 10 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@ jobs:
4040
files: lcov.info
4141
token: ${{ secrets.CODECOV_TOKEN }}
4242
fail_ci_if_error: false
43+
aqua:
44+
name: Aqua
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v7
48+
- uses: julia-actions/setup-julia@v3
49+
with:
50+
version: '1'
51+
- uses: julia-actions/cache@v3
52+
- run: |
53+
julia --color=yes -e '
54+
using Pkg
55+
Pkg.activate(temp = true)
56+
Pkg.develop(PackageSpec(path = pwd()))
57+
Pkg.add(name = "Aqua", version = "0.8")
58+
using Aqua, SuiteSparseGraphBLAS
59+
# ambiguities: ~190 pre-existing.
60+
Aqua.test_all(SuiteSparseGraphBLAS; ambiguities = false)'
4361
docs:
4462
name: Documentation
4563
runs-on: ubuntu-latest

‎Project.toml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
2323
Blobs = "1"
2424
ChainRulesCore = "1"
2525
KLU = "0.6"
26+
Libdl = "1"
27+
LinearAlgebra = "1"
2628
MacroTools = "0.5"
2729
Preferences = "1"
28-
SSGraphBLAS_jll = "10.5"
30+
Random = "1"
31+
Serialization = "1"
32+
SparseArrays = "1"
2933
SpecialFunctions = "2"
34+
SSGraphBLAS_jll = "10.5"
3035
StorageOrders = "0.3.2"
36+
SuiteSparse = "1"
3137
julia = "1.10"

‎src/SuiteSparseGraphBLAS.jl‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ include("solvers/klu.jl")
109109
include("solvers/umfpack.jl")
110110
include("solvers/cholmod.jl")
111111

112-
export SparseArrayCompat
113112
export LibGraphBLAS
114113
# export UnaryOps, BinaryOps, Monoids, Semirings #Submodules
115114
export unaryop, binaryop, Monoid, semiring #UDFs
@@ -131,7 +130,7 @@ export firsti, firstj, secondi, secondj
131130
#SelectOps not found in Julia/stdlibs
132131
export offdiag
133132

134-
export extract, extract!, subassign!, assign!, hvcat! #array functions
133+
export extract, extract!, subassign!, assign! #array functions
135134

136135
#operations
137136
export select, select!, eadd, eadd!, emul, emul!, gbtranspose, gbtranspose!,

‎src/operators/binaryops.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ using ..SuiteSparseGraphBLAS: isGxB, isGrB, TypedBinaryOperator, GBType,
44
valid_vec, juliaop, gbtype, symtotype, Itypes, Ftypes, Ztypes, FZtypes, Rtypes, optype,
55
Ntypes, Ttypes, suffix, valid_union, GBArrayOrTranspose, binaryop
66
using ..LibGraphBLAS
7-
export BinaryOp, binaryop
7+
export binaryop
88

9-
export second, rminus, iseq, isne, isgt, islt, isge, isle, ∨, ∧, lxor, xnor, fmod,
9+
export second, rminus, iseq, isne, isgt, islt, isge, isle, ∨, ∧, lxor, xnor,
1010
bxnor, bget, bset, bclr, firsti0, firsti, firstj0, firstj, secondi0, secondi, secondj0,
1111
secondj, pair
1212

‎src/types.jl‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -991,13 +991,15 @@ StorageOrders.comptime_storageorder(::AbstractGBArray{<:Any, <:Any, O}) where O
991991
defaultfill(::Type{T}) where {Te, T <: GBVecOrMat{Te}} = defaultfill(Te)
992992
defaultfill(::Type{T}) where {Te, Tf, T <: GBVecOrMat{Te, Tf}} = defaultfill(Tf)
993993

994-
defaultfill(::Type{T}) where T = zero(T)
995-
defaultfill(::Type{Nothing}) = nothing
996-
defaultfill(::Type{Missing}) = missing
994+
# Union{T, Nothing} and Union{T, Missing} default to zero(T) rather than nothing/missing.
997995
# This is bold, I'm not sure if I like it...
998996
# It boils down to whether we want numeric sparse arrays to be default
999997
# or for graph sparse arrays to be default.
1000998
# I don't think it is onerous for graph algorithm writers to say `GBMatrix{Int64, Nothing}`,
1001999
# and provides better defaults for other users.
1002-
defaultfill(::Type{Union{T, Nothing}}) where T = T
1003-
defaultfill(::Type{Union{T, Missing}}) where T = T
1000+
function defaultfill(::Type{T}) where T
1001+
S = nonmissingtype(Base.nonnothingtype(T))
1002+
return S === T ? zero(T) : defaultfill(S)
1003+
end
1004+
defaultfill(::Type{Nothing}) = nothing
1005+
defaultfill(::Type{Missing}) = missing

0 commit comments

Comments
 (0)