Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Project formatting on Julia <1.7 if there are weakdeps #206

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/project_toml_formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ function _analyze_project_toml_formatting_2(path::AbstractString, original)

prj = TOML.parse(original)
formatted = sprint(print_project, prj)
if splitlines(original) == splitlines(formatted)
if VERSION < v"1.7" && (haskey(prj, "weakdeps") || haskey(prj, "extensions"))
LazyTestResult(
label,
"The file `$(path)` has not been tested because it has weak dependencies and Julia is in version $VERSION < 1.7.",
true,
)
elseif splitlines(original) == splitlines(formatted)
LazyTestResult(label, "The file `$(path)` is in canonical format.", true)
else
diff = format_diff(
Expand Down
30 changes: 30 additions & 0 deletions test/test_project_toml_formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,36 @@ using Test
@test t ⊜ false
@test occursin("is not in canonical format", string(t))
end
@testset "pass: weakdeps + extensions following Pkg >= 1.7" begin
@test _analyze_project_toml_formatting_2(
path,
"""
name = "Aqua"
uuid = "4c88cf16-eb10-579e-8560-4a9242c79595"
authors = ["Takafumi Arakaki <[email protected]>"]
version = "0.4.7-DEV"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[weakdeps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[extensions]
AquaRandomExt = "Random"

[compat]
julia = "1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
""",
) ⊜ true
end
end

end # module