From 2a5d35a1166ee0ad2405c84d6a2b981af65e0e19 Mon Sep 17 00:00:00 2001 From: davidanthoff <1036561+davidanthoff@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:06:55 +0000 Subject: [PATCH] Format files using DocumentFormat --- src/packagedef.jl | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/packagedef.jl b/src/packagedef.jl index 579bae0..c033565 100644 --- a/src/packagedef.jl +++ b/src/packagedef.jl @@ -10,17 +10,17 @@ function find_test_detail!(node, testitems, testsetups, testerrors) child_nodes = children(node) # Check for various syntax errors - if length(child_nodes)==1 - push!(testerrors, (name = "Test definition error", message="Your @testitem is missing a name and code block.", range=testitem_range)) + if length(child_nodes) == 1 + push!(testerrors, (name="Test definition error", message="Your @testitem is missing a name and code block.", range=testitem_range)) return - elseif length(child_nodes)>1 && !(kind(child_nodes[2]) == K"string") - push!(testerrors, (name = "Test definition error", message="Your @testitem must have a first argument that is of type String for the name.", range=testitem_range)) + elseif length(child_nodes) > 1 && !(kind(child_nodes[2]) == K"string") + push!(testerrors, (name="Test definition error", message="Your @testitem must have a first argument that is of type String for the name.", range=testitem_range)) return - elseif length(child_nodes)==2 - push!(testerrors, (name = node[2,1].val, message="Your @testitem is missing a code block argument.", range=testitem_range)) + elseif length(child_nodes) == 2 + push!(testerrors, (name=node[2, 1].val, message="Your @testitem is missing a code block argument.", range=testitem_range)) return elseif !(kind(child_nodes[end]) == K"block") - push!(testerrors, (name = node[2,1].val, message="The final argument of a @testitem must be a begin end block.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The final argument of a @testitem must be a begin end block.", range=testitem_range)) return else option_tags = nothing @@ -30,18 +30,18 @@ function find_test_detail!(node, testitems, testsetups, testerrors) # Now check our keyword args for i in child_nodes[3:end-1] if kind(i) != K"=" - push!(testerrors, (name = node[2,1].val, message="The arguments to a @testitem must be in keyword format.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The arguments to a @testitem must be in keyword format.", range=testitem_range)) return - elseif !(length(children(i))==2) + elseif !(length(children(i)) == 2) error("This code path should not be possible.") elseif kind(i[1]) == K"Identifier" && i[1].val == :tags - if option_tags!==nothing - push!(testerrors, (name = node[2,1].val, message="The keyword argument tags cannot be specified more than once.", range=testitem_range)) + if option_tags !== nothing + push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags cannot be specified more than once.", range=testitem_range)) return end if kind(i[2]) != K"vect" - push!(testerrors, (name = node[2,1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range)) return end @@ -49,7 +49,7 @@ function find_test_detail!(node, testitems, testsetups, testerrors) for j in children(i[2]) if kind(j) != K"quote" || length(children(j)) != 1 || kind(j[1]) != K"Identifier" - push!(testerrors, (name = node[2,1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range)) return end @@ -57,24 +57,24 @@ function find_test_detail!(node, testitems, testsetups, testerrors) end elseif kind(i[1]) == K"Identifier" && i[1].val == :default_imports if option_default_imports !== nothing - push!(testerrors, (name = node[2,1].val, message="The keyword argument default_imports cannot be specified more than once.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument default_imports cannot be specified more than once.", range=testitem_range)) return end if !(i[2].val in (true, false)) - push!(testerrors, (name = node[2,1].val, message="The keyword argument default_imports only accepts bool values.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument default_imports only accepts bool values.", range=testitem_range)) return end option_default_imports = i[2].val elseif kind(i[1]) == K"Identifier" && i[1].val == :setup - if option_setup!==nothing - push!(testerrors, (name = node[2,1].val, message="The keyword argument setup cannot be specified more than once.", range=testitem_range)) + if option_setup !== nothing + push!(testerrors, (name=node[2, 1].val, message="The keyword argument setup cannot be specified more than once.", range=testitem_range)) return end if kind(i[2]) != K"vect" - push!(testerrors, (name = node[2,1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range)) return end @@ -82,27 +82,27 @@ function find_test_detail!(node, testitems, testsetups, testerrors) for j in children(i[2]) if kind(j) != K"Identifier" - push!(testerrors, (name = node[2,1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range)) return end push!(option_setup, j.val) end else - push!(testerrors, (name = node[2,1].val, message="Unknown keyword argument.", range=testitem_range)) + push!(testerrors, (name=node[2, 1].val, message="Unknown keyword argument.", range=testitem_range)) return end end - if option_tags===nothing + if option_tags === nothing option_tags = Symbol[] end - if option_default_imports===nothing + if option_default_imports === nothing option_default_imports = true end - if option_setup===nothing + if option_setup === nothing option_setup = Symbol[] end @@ -114,8 +114,8 @@ function find_test_detail!(node, testitems, testsetups, testerrors) end push!(testitems, - ( - name=node[2,1].val, + ( + name=node[2, 1].val, range=testitem_range, code_range=code_range, option_default_imports=option_default_imports, @@ -132,28 +132,28 @@ function find_test_detail!(node, testitems, testsetups, testerrors) child_nodes = children(node) # Check for various syntax errors - if length(child_nodes)==1 - push!(testerrors, (name = "Test definition error", message="Your $testkind is missing a name and code block.", range=testitem_range)) + if length(child_nodes) == 1 + push!(testerrors, (name="Test definition error", message="Your $testkind is missing a name and code block.", range=testitem_range)) return - elseif length(child_nodes)>1 && !(kind(child_nodes[2]) == K"Identifier") - push!(testerrors, (name = "Test definition error", message="Your $testkind must have a first argument that is an identifier for the name.", range=testitem_range)) + elseif length(child_nodes) > 1 && !(kind(child_nodes[2]) == K"Identifier") + push!(testerrors, (name="Test definition error", message="Your $testkind must have a first argument that is an identifier for the name.", range=testitem_range)) return - elseif length(child_nodes)==2 - push!(testerrors, (name = child_nodes[2].val, message="Your $testkind is missing a code block argument.", range=testitem_range)) + elseif length(child_nodes) == 2 + push!(testerrors, (name=child_nodes[2].val, message="Your $testkind is missing a code block argument.", range=testitem_range)) return elseif !(kind(child_nodes[end]) == K"block") - push!(testerrors, (name = child_nodes[2].val, message="The final argument of a $testkind must be a begin end block.", range=testitem_range)) + push!(testerrors, (name=child_nodes[2].val, message="The final argument of a $testkind must be a begin end block.", range=testitem_range)) return else # Now check our keyword args for i in child_nodes[3:end-1] if kind(i) != K"=" - push!(testerrors, (name = child_nodes[2].val, message="The arguments to a $testkind must be in keyword format.", range=testitem_range)) + push!(testerrors, (name=child_nodes[2].val, message="The arguments to a $testkind must be in keyword format.", range=testitem_range)) return - elseif !(length(children(i))==2) + elseif !(length(children(i)) == 2) error("This code path should not be possible.") else - push!(testerrors, (name = child_nodes[2].val, message="Unknown keyword argument.", range=testitem_range)) + push!(testerrors, (name=child_nodes[2].val, message="Unknown keyword argument.", range=testitem_range)) return end end @@ -166,9 +166,9 @@ function find_test_detail!(node, testitems, testsetups, testerrors) (first(our_range(code_block))+5):(last(our_range(code_block))-3) end - testkind2 = if testkind==Symbol("@testmodule") + testkind2 = if testkind == Symbol("@testmodule") :module - elseif testkind==Symbol("@testsnippet") + elseif testkind == Symbol("@testsnippet") :snippet else error("Unknown testkind")