Skip to content

Commit dd5f929

Browse files
Remove test_project_toml_formatting (#209)
* Remove test_project_toml_formatting It stands out from all other tests in Aqua in that it does not actually deal with 'quality'. The benefit is tiny if there is one at all, at the same time it is unreasonably compicated to implement and use right. * Update changelog * Remove no longer needed code --------- Co-authored-by: Lars Göttgens <[email protected]>
1 parent ebafef6 commit dd5f929

9 files changed

+5
-240
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- In `test_deps_compat`, the two subtests `check_extras` and `check_weakdeps` are now run by default. ([#202](https://github.com/JuliaTesting/Aqua.jl/pull/202)) [BREAKING]
2020
- `test_deps_compat` now reqiures compat entries for all dependencies. Stdlibs no longer get ignored. This change is motivated by similar changes in the General registry. ([#215](https://github.com/JuliaTesting/Aqua.jl/pull/215)) [BREAKING]
2121

22+
### Removed
23+
24+
- `test_project_toml_formatting` has been removed. Thus, the kwarg `project_toml_formatting` to `test_all` no longer exists. ([#209](https://github.com/JuliaTesting/Aqua.jl/pull/209)) [BREAKING]
25+
2226

2327
## [0.7.4] - 2023-10-24
2428

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages:
1616
(`test/Project.toml`) are consistent.
1717
* Check that all external packages listed in `deps` have corresponding
1818
`compat` entry.
19-
* `Project.toml` formatting is compatible with Pkg.jl output.
2019
* There are no "obvious" type piracies.
2120

2221
See more in the [documentation](https://juliatesting.github.io/Aqua.jl/).

docs/src/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages:
1111
(`test/Project.toml`) are consistent.
1212
* Check that all external packages listed in `deps` have corresponding
1313
`compat` entry.
14-
* `Project.toml` formatting is compatible with Pkg.jl output.
1514
* There are no "obvious" type piracies.
1615
* The package does not create any persistent Tasks that might block precompilation of dependencies.
1716

@@ -84,7 +83,6 @@ using Aqua
8483
project_extras=true,
8584
stale_deps=(ignore=[:SomePackage],),
8685
deps_compat=(ignore=[:SomeOtherPackage],),
87-
project_toml_formatting=true,
8886
piracy=false,
8987
)
9088
end

src/Aqua.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ include("exports.jl")
1919
include("project_extras.jl")
2020
include("stale_deps.jl")
2121
include("deps_compat.jl")
22-
include("project_toml_formatting.jl")
2322
include("piracy.jl")
2423
include("persistent_tasks.jl")
2524

@@ -34,7 +33,6 @@ Run following tests in isolated testset:
3433
* [`test_project_extras(testtarget)`](@ref test_project_extras)
3534
* [`test_stale_deps(testtarget)`](@ref test_stale_deps)
3635
* [`test_deps_compat(testtarget)`](@ref test_deps_compat)
37-
* [`test_project_toml_formatting(testtarget)`](@ref test_project_toml_formatting)
3836
* [`test_piracy(testtarget)`](@ref test_piracy)
3937
* [`test_persistent_tasks(testtarget)`](@ref test_persistent_tasks)
4038
@@ -50,7 +48,6 @@ passed to `\$x` to specify the keyword arguments for `test_\$x`.
5048
- `project_extras = true`
5149
- `stale_deps = true`
5250
- `deps_compat = true`
53-
- `project_toml_formatting = true`
5451
- `piracy = true`
5552
- `persistent_tasks = true`
5653
"""
@@ -62,7 +59,6 @@ function test_all(
6259
project_extras = true,
6360
stale_deps = true,
6461
deps_compat = true,
65-
project_toml_formatting = true,
6662
piracy = true,
6763
persistent_tasks = true,
6864
)
@@ -96,11 +92,6 @@ function test_all(
9692
test_deps_compat(testtarget; askwargs(deps_compat)...)
9793
end
9894
end
99-
@testset "Project.toml formatting" begin
100-
if project_toml_formatting !== false
101-
test_project_toml_formatting(testtarget; askwargs(project_toml_formatting)...)
102-
end
103-
end
10495
@testset "Piracy" begin
10596
if piracy !== false
10697
test_piracy(testtarget; askwargs(piracy)...)

src/project_toml_formatting.jl

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/utils.jl

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -84,68 +84,9 @@ function checked_repr(obj)
8484
return code
8585
end
8686

87-
const _project_key_order = [
88-
"name",
89-
"uuid",
90-
"keywords",
91-
"license",
92-
"desc",
93-
"deps",
94-
"weakdeps",
95-
"extensions",
96-
"compat",
97-
"extras",
98-
"targets",
99-
]
100-
project_key_order(key::String) =
101-
something(findfirst(x -> x == key, _project_key_order), length(_project_key_order) + 1)
102-
103-
print_project(io, dict) =
104-
TOML.print(io, dict, sorted = true, by = key -> (project_key_order(key), key))
105-
10687
ensure_exception(e::Exception) = e
10788
ensure_exception(x) = ErrorException(string(x))
10889

109-
"""
110-
trydiff(label_a => text_a, label_b => text_b) -> string or exception
111-
"""
112-
function trydiff(
113-
(label_a, text_a)::Pair{<:AbstractString,<:AbstractString},
114-
(label_b, text_b)::Pair{<:AbstractString,<:AbstractString},
115-
)
116-
# TODO: use a pure-Julia function
117-
cmd = `diff --label $label_a --label $label_b -u`
118-
mktemp() do path_a, io_a
119-
print(io_a, text_a)
120-
close(io_a)
121-
mktemp() do path_b, io_b
122-
print(io_b, text_b)
123-
close(io_b)
124-
try
125-
return read(ignorestatus(`$cmd $path_a $path_b`), String)
126-
catch err
127-
return ensure_exception(err)
128-
end
129-
end
130-
end
131-
end
132-
133-
function format_diff(
134-
(label_a, text_a)::Pair{<:AbstractString,<:AbstractString},
135-
(label_b, text_b)::Pair{<:AbstractString,<:AbstractString},
136-
)
137-
diff = trydiff(label_a => text_a, label_b => text_b)
138-
diff isa AbstractString && return diff
139-
# Fallback:
140-
return """
141-
*** $label_a ***
142-
$text_a
143-
144-
*** $label_b ***
145-
$text_b
146-
"""
147-
end
148-
14990
function is_kwcall(signature::DataType)
15091
@static if VERSION < v"1.9"
15192
try

test/test_project_toml_formatting.jl

Lines changed: 0 additions & 81 deletions
This file was deleted.

test/test_smoke.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Aqua.test_all(
1414
project_extras = false,
1515
stale_deps = false,
1616
deps_compat = false,
17-
project_toml_formatting = false,
1817
piracy = false,
1918
persistent_tasks = false,
2019
)

test/test_utils.jl

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module TestUtils
22

3-
using Aqua: askwargs, format_diff
3+
using Aqua: askwargs
44
using Test
55

66
@testset "askwargs" begin
@@ -10,22 +10,4 @@ using Test
1010
@test askwargs((a = 1,)) === (a = 1,)
1111
end
1212

13-
@testset "format_diff" begin
14-
@testset "normal" begin
15-
if Sys.which("diff") === nothing
16-
@info "Comamnd `diff` not found; skip testing `format_diff`."
17-
else
18-
diff = format_diff("LABEL_A" => "TEXT_A", "LABEL_B" => "TEXT_B")
19-
@test occursin("--- LABEL_A", diff)
20-
@test occursin("+++ LABEL_B", diff)
21-
end
22-
end
23-
@testset "fallback" begin
24-
diff = withenv("PATH" => "/") do
25-
format_diff("LABEL_A" => "TEXT_A", "LABEL_B" => "TEXT_B")
26-
end
27-
@test occursin("*** LABEL_A ***", diff)
28-
end
29-
end
30-
3113
end # module

0 commit comments

Comments
 (0)