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

Experiment with #213 #218

Closed
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
24 changes: 21 additions & 3 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -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:
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
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 }}
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
fail_on_error: true
filter_mode: added
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Documenter, Aqua

makedocs(;
modules = [Aqua],
modules = [Aqua ],

Check warning on line 4 in docs/make.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: docs/make.jl:4:- modules = [Aqua ], docs/make.jl:4:+ modules = [Aqua],

Check warning on line 4 in docs/make.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: docs/make.jl:4:- modules = [Aqua ], docs/make.jl:4:+ 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)

Check warning on line 12 in docs/make.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: docs/make.jl:12:- warnonly = true docs/make.jl:12:+ warnonly = true,

Check warning on line 12 in docs/make.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: docs/make.jl:12:- warnonly = true docs/make.jl:12:+ warnonly = true,
16 changes: 8 additions & 8 deletions src/ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
if m in (Base, Core)
true
else
parentmodule(m) == m
parentmodule(m)==m

Check warning on line 51 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:51:- parentmodule(m)==m src/ambiguities.jl:51:+ parentmodule(m) == m

Check warning on line 51 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:51:- parentmodule(m)==m src/ambiguities.jl:51:+ parentmodule(m) == m
end

strnameof(x) = string(x)
Expand All @@ -71,7 +71,8 @@
end

function normalize_and_check_exclude(exclude::AbstractVector)
exspecs = mapfoldl(normalize_exclude, push!, exclude, init = ExcludeSpec[])
exspecs = mapfoldl(normalize_exclude, push!, exclude, init =

Check warning on line 74 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:74:- exspecs = mapfoldl(normalize_exclude, push!, exclude, init = src/ambiguities.jl:75:- ExcludeSpec[]) src/ambiguities.jl:74:+ exspecs = mapfoldl(normalize_exclude, push!, exclude, init = ExcludeSpec[])

Check warning on line 74 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:74:- exspecs = mapfoldl(normalize_exclude, push!, exclude, init = src/ambiguities.jl:75:- ExcludeSpec[]) src/ambiguities.jl:74:+ exspecs = mapfoldl(normalize_exclude, push!, exclude, init = ExcludeSpec[])
ExcludeSpec[])
for (spec, obj) in zip(exspecs, exclude)
if getobj(spec) !== obj
error("Name `$(spec[2])` is resolved to a different object.")
Expand All @@ -81,17 +82,16 @@
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)

Check warning on line 85 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:85:- itemreprs = map(exspecs) do (pkgid, name) src/ambiguities.jl:86:- string("(", reprpkgid(pkgid), " => ", repr(name), ")") src/ambiguities.jl:87:- end src/ambiguities.jl:88:- return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]") src/ambiguities.jl:84:+ itemreprs = map(exspecs) do (pkgid, name) src/ambiguities.jl:85:+ string("(", reprpkgid(pkgid), " => ", repr(name), ")") src/ambiguities.jl:86:+ end src/ambiguities.jl:87:+ return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]")

Check warning on line 85 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:85:- itemreprs = map(exspecs) do (pkgid, name) src/ambiguities.jl:86:- string("(", reprpkgid(pkgid), " => ", repr(name), ")") src/ambiguities.jl:87:- end src/ambiguities.jl:88:- return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]") src/ambiguities.jl:84:+ itemreprs = map(exspecs) do (pkgid, name) src/ambiguities.jl:85:+ string("(", reprpkgid(pkgid), " => ", repr(name), ")") src/ambiguities.jl:86:+ end src/ambiguities.jl:87:+ return string("Aqua.ExcludeSpec[", join(itemreprs, ", "), "]")
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)

Check warning on line 94 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:94:- print(stderr,strerr); print(stdout, strout) src/ambiguities.jl:93:+ print(stderr, strerr) src/ambiguities.jl:94:+ print(stdout, strout)

Check warning on line 94 in src/ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/ambiguities.jl:94:- print(stderr,strerr); print(stdout, strout) src/ambiguities.jl:93:+ print(stderr, strerr) src/ambiguities.jl:94:+ print(stdout, strout)

if broken
@test_broken num_ambiguities == 0
Expand Down
8 changes: 4 additions & 4 deletions test/test_ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
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)

Check warning on line 8 in test/test_ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: test/test_ambiguities.jl:8:- function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) test/test_ambiguities.jl:9:- pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities test/test_ambiguities.jl:8:+ function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) test/test_ambiguities.jl:9:+ pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities

Check warning on line 8 in test/test_ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: test/test_ambiguities.jl:8:- function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) test/test_ambiguities.jl:9:- pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities test/test_ambiguities.jl:8:+ function check_testcase(exclude, num_ambiguities::Int; broken::Bool = false) test/test_ambiguities.jl:9:+ pkgids = Aqua.aspkgids([PkgWithAmbiguities, Core]) # include Core to find constructor ambiguities
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 )

Check warning on line 16 in test/test_ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: test/test_ambiguities.jl:16:- @test isempty( strerr ) test/test_ambiguities.jl:16:+ @test isempty(strerr)

Check warning on line 16 in test/test_ambiguities.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: test/test_ambiguities.jl:16:- @test isempty( strerr ) test/test_ambiguities.jl:16:+ @test isempty(strerr)
end

@static if VERSION >= v"1.3-"
Expand All @@ -22,7 +22,7 @@
total = 8
end

check_testcase([], total)
check_testcase([ ], total)

# exclude just anything irrelevant, see #49
check_testcase([convert], total)
Expand Down
Loading