diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index abc424d8..ad3ed1be 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -1,10 +1,28 @@ -name: Code style +name: Format suggestions on: pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: - code-style: + format: runs-on: ubuntu-latest + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_TOKEN }} steps: - - uses: tkf/julia-code-style-suggesters@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + - run: | + julia --color=yes -e 'using Pkg; Pkg.add("JuliaFormatter")' + julia --color=yes -e 'using JuliaFormatter; format("."; verbose=true)' + - uses: reviewdog/action-suggester@v1 + with: + tool_name: JuliaFormatter + github_token: ${{ secrets.github_token }} + fail_on_error: true + filter_mode: added diff --git a/docs/make.jl b/docs/make.jl index 5cc0a9b3..d9bdd73a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,12 +1,12 @@ using Documenter, Aqua makedocs(; - modules = [Aqua], + modules = [Aqua ], pages = ["Home" => "index.md"], sitename = "Aqua.jl", format = Documenter.HTML(; repolink = "https://github.com/JuliaTesting/Aqua.jl"), authors = "Takafumi Arakaki", - warnonly = true, + warnonly = true ) -deploydocs(; repo = "github.com/JuliaTesting/Aqua.jl", push_preview = true) +deploydocs(repo = "github.com/JuliaTesting/Aqua.jl", push_preview = true) diff --git a/src/ambiguities.jl b/src/ambiguities.jl index 4c22060e..79d2ea10 100644 --- a/src/ambiguities.jl +++ b/src/ambiguities.jl @@ -48,7 +48,7 @@ ispackage(m::Module) = if m in (Base, Core) true else - parentmodule(m) == m + parentmodule(m)==m end strnameof(x) = string(x) @@ -71,7 +71,8 @@ function getobj((pkgid, name)::ExcludeSpec) end function normalize_and_check_exclude(exclude::AbstractVector) - exspecs = mapfoldl(normalize_exclude, push!, exclude, init = ExcludeSpec[]) + exspecs = mapfoldl(normalize_exclude, push!, exclude, init = + ExcludeSpec[]) for (spec, obj) in zip(exspecs, exclude) if getobj(spec) !== obj error("Name `$(spec[2])` is resolved to a different object.") @@ -81,17 +82,16 @@ function normalize_and_check_exclude(exclude::AbstractVector) end function reprexclude(exspecs::Vector{ExcludeSpec}) - itemreprs = map(exspecs) do (pkgid, name) - string("(", reprpkgid(pkgid), " => ", repr(name), ")") - end - return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]") + itemreprs = map(exspecs) do (pkgid, name) + string("(", reprpkgid(pkgid), " => ", repr(name), ")") + end + return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]") end function _test_ambiguities(packages::Vector{PkgId}; broken::Bool = false, kwargs...) num_ambiguities, strout, strerr = _find_ambiguities(packages; kwargs...) - print(stderr, strerr) - print(stdout, strout) + print(stderr,strerr); print(stdout, strout) if broken @test_broken num_ambiguities == 0 diff --git a/test/test_ambiguities.jl b/test/test_ambiguities.jl index ad2d8557..ca4bb78f 100644 --- a/test/test_ambiguities.jl +++ b/test/test_ambiguities.jl @@ -5,15 +5,15 @@ include("preamble.jl") using PkgWithAmbiguities @testset begin - function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) - pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities + function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) + pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities num_ambiguities_, strout, strerr = Aqua._find_ambiguities(pkgids; exclude = exclude) if broken @test_broken num_ambiguities_ == num_ambiguities else @test num_ambiguities_ == num_ambiguities end - @test isempty(strerr) + @test isempty( strerr ) end @static if VERSION >= v"1.3-" @@ -22,7 +22,7 @@ using PkgWithAmbiguities total = 8 end - check_testcase([], total) + check_testcase([ ], total) # exclude just anything irrelevant, see #49 check_testcase([convert], total)