Skip to content

Commit

Permalink
Fix ambiguities and test quality with Aqua (#1041)
Browse files Browse the repository at this point in the history
* Fix ambiguities and test quality with Aqua
* cleanup undefined exports
  • Loading branch information
Affie committed Aug 18, 2023
1 parent acd03da commit bde8a13
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ TimeZones = "1.3.1"
julia = "1.9"

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

[targets]
test = ["Test", "DataStructures", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]
test = ["Aqua", "Test", "DataStructures", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]
9 changes: 7 additions & 2 deletions src/DataBlobs/services/BlobStores.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function addBlob!(dfg::AbstractDFG, entry::BlobEntry, data)
return addBlob!(getBlobStore(dfg, entry.blobstore), entry, data)
end

function addBlob!(store::AbstractBlobStore, entry::BlobEntry, data)
function addBlob!(store::AbstractBlobStore{T}, entry::BlobEntry, data::T) where {T}
blobId = isnothing(entry.blobId) ? entry.originId : entry.blobId
return addBlob!(store, blobId, data)
end
Expand All @@ -125,7 +125,9 @@ function addBlob!(store::AbstractBlobStore, blobId::UUID, data, ::String)
return addBlob!(store, blobId, data)
end

addBlob!(store::AbstractBlobStore, data, ::String) = addBlob!(store, uuid4(), data)
function addBlob!(store::AbstractBlobStore{T}, data::T, ::String) where {T}
return addBlob!(store, uuid4(), data)
end

#update
function updateBlob!(dfg::AbstractDFG, entry::BlobEntry, data::T) where {T}
Expand Down Expand Up @@ -336,3 +338,6 @@ end
function deleteBlob!(store::LinkStore, args...)
return error("deleteDataBlob(::LinkStore) not supported")
end

deleteBlob!(store::LinkStore, ::BlobEntry) = deleteBlob!(store)
deleteBlob!(store::LinkStore, ::UUID) = deleteBlob!(store)
2 changes: 0 additions & 2 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ abstract type AbstractBlobEntry end
@deprecate addDataEntry!(w...; kw...) addBlobEntry!(w...; kw...)
@deprecate updateDataEntry!(w...; kw...) updateBlobEntry!(w...; kw...)
@deprecate deleteDataEntry!(w...; kw...) deleteBlobEntry!(w...; kw...)
@deprecate listDataEntry(w...; kw...) listBlobEntry(w...; kw...)
@deprecate listDataEntrySequence(w...; kw...) listBlobEntrySequence(w...; kw...)
@deprecate mergeDataEntry!(w...; kw...) mergeBlobEntry!(w...; kw...)

# @deprecate getData(w...;kw...) getBlob(w...;kw...)
@deprecate getDataBlob(w...; kw...) getBlob(w...; kw...)
Expand Down
12 changes: 2 additions & 10 deletions src/DistributedFactorGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export DFGFactor, DFGFactorSummary, SkeletonDFGFactor, PackedFactor

# Common
export getSolvable, setSolvable!, isSolvable
export getInternalId
export getVariableLabelNumber

# accessors
Expand All @@ -164,9 +163,6 @@ export isSolveInProgress, getSolveInProgress
# CRUD & SET
export listTags, mergeTags!, removeTags!, emptyTags!

#this isn't acttually implemented. TODO remove or implement
export addTags!

##------------------------------------------------------------------------------
# Variable
##------------------------------------------------------------------------------
Expand All @@ -185,8 +181,6 @@ export getVariableType
export getDimension, getManifold, getPointType
export getPointIdentity, getPoint, getCoordinates

export getManifolds # TODO Deprecate?

# Small Data CRUD
export SmallDataTypes,
getSmallData,
Expand Down Expand Up @@ -242,12 +236,11 @@ export hasBlobEntry,
addBlobEntry!,
updateBlobEntry!,
deleteBlobEntry!,
listBlobEntry,
listBlobEntrySequence,
mergeBlobEntry!
mergeBlobEntries!
export incrDataLabelSuffix

export getBlobEntries, listDataEntries, hasDataEntry, hasDataEntry
export getBlobEntries, hasDataEntry, hasDataEntry
export getBlobEntriesVariables
export listDataEntrySequence
# convenience wrappers
Expand Down Expand Up @@ -319,7 +312,6 @@ export compare,
compareFactor,
compareAllVariables,
compareSimilarVariables,
compareSubsetFactorGraph,
compareSimilarFactors,
compareFactorGraphs

Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using Dates
using TimeZones
using SHA
using UUIDs
using Aqua

# If you want to enable debugging logging (very verbose!)
# using Logging
Expand Down Expand Up @@ -142,3 +143,14 @@ struct NotImplementedDFG{T} <: AbstractDFG{T} end
@test_throws ErrorException isVariable(dfg, :a)
@test_throws ErrorException isFactor(dfg, :a)
end

@testset "Testing Code Quality with Aqua" begin
Aqua.test_ambiguities([DistributedFactorGraphs])
Aqua.test_unbound_args(DistributedFactorGraphs)
Aqua.test_undefined_exports(DistributedFactorGraphs)
Aqua.test_piracy(DistributedFactorGraphs)
Aqua.test_project_extras(DistributedFactorGraphs)
Aqua.test_stale_deps(DistributedFactorGraphs; ignore = [:Colors])
Aqua.test_deps_compat(DistributedFactorGraphs)
Aqua.test_project_toml_formatting(DistributedFactorGraphs)
end

0 comments on commit bde8a13

Please sign in to comment.