Skip to content

Commit bde8a13

Browse files
authored
Fix ambiguities and test quality with Aqua (#1041)
* Fix ambiguities and test quality with Aqua * cleanup undefined exports
1 parent acd03da commit bde8a13

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ TimeZones = "1.3.1"
6060
julia = "1.9"
6161

6262
[extras]
63+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
6364
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
6465
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
6566
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -69,4 +70,4 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
6970
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7071

7172
[targets]
72-
test = ["Test", "DataStructures", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]
73+
test = ["Aqua", "Test", "DataStructures", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]

src/DataBlobs/services/BlobStores.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function addBlob!(dfg::AbstractDFG, entry::BlobEntry, data)
112112
return addBlob!(getBlobStore(dfg, entry.blobstore), entry, data)
113113
end
114114

115-
function addBlob!(store::AbstractBlobStore, entry::BlobEntry, data)
115+
function addBlob!(store::AbstractBlobStore{T}, entry::BlobEntry, data::T) where {T}
116116
blobId = isnothing(entry.blobId) ? entry.originId : entry.blobId
117117
return addBlob!(store, blobId, data)
118118
end
@@ -125,7 +125,9 @@ function addBlob!(store::AbstractBlobStore, blobId::UUID, data, ::String)
125125
return addBlob!(store, blobId, data)
126126
end
127127

128-
addBlob!(store::AbstractBlobStore, data, ::String) = addBlob!(store, uuid4(), data)
128+
function addBlob!(store::AbstractBlobStore{T}, data::T, ::String) where {T}
129+
return addBlob!(store, uuid4(), data)
130+
end
129131

130132
#update
131133
function updateBlob!(dfg::AbstractDFG, entry::BlobEntry, data::T) where {T}
@@ -336,3 +338,6 @@ end
336338
function deleteBlob!(store::LinkStore, args...)
337339
return error("deleteDataBlob(::LinkStore) not supported")
338340
end
341+
342+
deleteBlob!(store::LinkStore, ::BlobEntry) = deleteBlob!(store)
343+
deleteBlob!(store::LinkStore, ::UUID) = deleteBlob!(store)

src/Deprecated.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ abstract type AbstractBlobEntry end
9494
@deprecate addDataEntry!(w...; kw...) addBlobEntry!(w...; kw...)
9595
@deprecate updateDataEntry!(w...; kw...) updateBlobEntry!(w...; kw...)
9696
@deprecate deleteDataEntry!(w...; kw...) deleteBlobEntry!(w...; kw...)
97-
@deprecate listDataEntry(w...; kw...) listBlobEntry(w...; kw...)
9897
@deprecate listDataEntrySequence(w...; kw...) listBlobEntrySequence(w...; kw...)
99-
@deprecate mergeDataEntry!(w...; kw...) mergeBlobEntry!(w...; kw...)
10098

10199
# @deprecate getData(w...;kw...) getBlob(w...;kw...)
102100
@deprecate getDataBlob(w...; kw...) getBlob(w...; kw...)

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export DFGFactor, DFGFactorSummary, SkeletonDFGFactor, PackedFactor
152152

153153
# Common
154154
export getSolvable, setSolvable!, isSolvable
155-
export getInternalId
156155
export getVariableLabelNumber
157156

158157
# accessors
@@ -164,9 +163,6 @@ export isSolveInProgress, getSolveInProgress
164163
# CRUD & SET
165164
export listTags, mergeTags!, removeTags!, emptyTags!
166165

167-
#this isn't acttually implemented. TODO remove or implement
168-
export addTags!
169-
170166
##------------------------------------------------------------------------------
171167
# Variable
172168
##------------------------------------------------------------------------------
@@ -185,8 +181,6 @@ export getVariableType
185181
export getDimension, getManifold, getPointType
186182
export getPointIdentity, getPoint, getCoordinates
187183

188-
export getManifolds # TODO Deprecate?
189-
190184
# Small Data CRUD
191185
export SmallDataTypes,
192186
getSmallData,
@@ -242,12 +236,11 @@ export hasBlobEntry,
242236
addBlobEntry!,
243237
updateBlobEntry!,
244238
deleteBlobEntry!,
245-
listBlobEntry,
246239
listBlobEntrySequence,
247-
mergeBlobEntry!
240+
mergeBlobEntries!
248241
export incrDataLabelSuffix
249242

250-
export getBlobEntries, listDataEntries, hasDataEntry, hasDataEntry
243+
export getBlobEntries, hasDataEntry, hasDataEntry
251244
export getBlobEntriesVariables
252245
export listDataEntrySequence
253246
# convenience wrappers
@@ -319,7 +312,6 @@ export compare,
319312
compareFactor,
320313
compareAllVariables,
321314
compareSimilarVariables,
322-
compareSubsetFactorGraph,
323315
compareSimilarFactors,
324316
compareFactorGraphs
325317

test/runtests.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using Dates
66
using TimeZones
77
using SHA
88
using UUIDs
9+
using Aqua
910

1011
# If you want to enable debugging logging (very verbose!)
1112
# using Logging
@@ -142,3 +143,14 @@ struct NotImplementedDFG{T} <: AbstractDFG{T} end
142143
@test_throws ErrorException isVariable(dfg, :a)
143144
@test_throws ErrorException isFactor(dfg, :a)
144145
end
146+
147+
@testset "Testing Code Quality with Aqua" begin
148+
Aqua.test_ambiguities([DistributedFactorGraphs])
149+
Aqua.test_unbound_args(DistributedFactorGraphs)
150+
Aqua.test_undefined_exports(DistributedFactorGraphs)
151+
Aqua.test_piracy(DistributedFactorGraphs)
152+
Aqua.test_project_extras(DistributedFactorGraphs)
153+
Aqua.test_stale_deps(DistributedFactorGraphs; ignore = [:Colors])
154+
Aqua.test_deps_compat(DistributedFactorGraphs)
155+
Aqua.test_project_toml_formatting(DistributedFactorGraphs)
156+
end

0 commit comments

Comments
 (0)