From 99bfddb70d1e021e1af0e50326edbb1bb8fc1392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 24 Oct 2023 16:54:52 +0200 Subject: [PATCH] Remove no longer needed code --- README.md | 1 - docs/src/index.md | 1 - src/utils.jl | 59 ---------------------------------------------- test/test_utils.jl | 20 +--------------- 4 files changed, 1 insertion(+), 80 deletions(-) diff --git a/README.md b/README.md index 9ebaf4b0..47c8061c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages: (`test/Project.toml`) are consistent. * Check that all external packages listed in `deps` have corresponding `compat` entry. -* `Project.toml` formatting is compatible with Pkg.jl output. * There are no "obvious" type piracies. See more in the [documentation](https://juliatesting.github.io/Aqua.jl/). diff --git a/docs/src/index.md b/docs/src/index.md index 14350961..32181aaf 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -11,7 +11,6 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages: (`test/Project.toml`) are consistent. * Check that all external packages listed in `deps` have corresponding `compat` entry. -* `Project.toml` formatting is compatible with Pkg.jl output. * There are no "obvious" type piracies. * The package does not create any persistent Tasks that might block precompilation of dependencies. diff --git a/src/utils.jl b/src/utils.jl index cb4bdd83..1a7a4413 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -84,68 +84,9 @@ function checked_repr(obj) return code end -const _project_key_order = [ - "name", - "uuid", - "keywords", - "license", - "desc", - "deps", - "weakdeps", - "extensions", - "compat", - "extras", - "targets", -] -project_key_order(key::String) = - something(findfirst(x -> x == key, _project_key_order), length(_project_key_order) + 1) - -print_project(io, dict) = - TOML.print(io, dict, sorted = true, by = key -> (project_key_order(key), key)) - ensure_exception(e::Exception) = e ensure_exception(x) = ErrorException(string(x)) -""" - trydiff(label_a => text_a, label_b => text_b) -> string or exception -""" -function trydiff( - (label_a, text_a)::Pair{<:AbstractString,<:AbstractString}, - (label_b, text_b)::Pair{<:AbstractString,<:AbstractString}, -) - # TODO: use a pure-Julia function - cmd = `diff --label $label_a --label $label_b -u` - mktemp() do path_a, io_a - print(io_a, text_a) - close(io_a) - mktemp() do path_b, io_b - print(io_b, text_b) - close(io_b) - try - return read(ignorestatus(`$cmd $path_a $path_b`), String) - catch err - return ensure_exception(err) - end - end - end -end - -function format_diff( - (label_a, text_a)::Pair{<:AbstractString,<:AbstractString}, - (label_b, text_b)::Pair{<:AbstractString,<:AbstractString}, -) - diff = trydiff(label_a => text_a, label_b => text_b) - diff isa AbstractString && return diff - # Fallback: - return """ - *** $label_a *** - $text_a - - *** $label_b *** - $text_b - """ -end - function is_kwcall(signature::DataType) @static if VERSION < v"1.9" try diff --git a/test/test_utils.jl b/test/test_utils.jl index 7550a62e..00e1d928 100644 --- a/test/test_utils.jl +++ b/test/test_utils.jl @@ -1,6 +1,6 @@ module TestUtils -using Aqua: askwargs, format_diff +using Aqua: askwargs using Test @testset "askwargs" begin @@ -10,22 +10,4 @@ using Test @test askwargs((a = 1,)) === (a = 1,) end -@testset "format_diff" begin - @testset "normal" begin - if Sys.which("diff") === nothing - @info "Comamnd `diff` not found; skip testing `format_diff`." - else - diff = format_diff("LABEL_A" => "TEXT_A", "LABEL_B" => "TEXT_B") - @test occursin("--- LABEL_A", diff) - @test occursin("+++ LABEL_B", diff) - end - end - @testset "fallback" begin - diff = withenv("PATH" => "/") do - format_diff("LABEL_A" => "TEXT_A", "LABEL_B" => "TEXT_B") - end - @test occursin("*** LABEL_A ***", diff) - end -end - end # module