tonyhffong / Lint.jl

A lint tool for Julia code
Other
168 stars 33 forks source link

Tests fail on Julia 0.7 #252

Closed ufechner7 closed 5 years ago

ufechner7 commented 6 years ago

Lint.jl needs some updating:

(v0.7) pkg> add Lint#master
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/tonyhffong/Lint.jl.git`
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v0.7/Manifest.toml`
 [no changes]

(v0.7) pkg> test Lint
   Testing Lint
    Status `/tmp/tmpwkhh4L/Manifest.toml`
  [15f4f7f2] AutoHashEquals v0.2.0
  [34da2185] Compat v1.0.1
  [682c06a0] JSON v0.19.0
  [d4b2101a] Lint v0.5.2+ #master (https://github.com/tonyhffong/Lint.jl.git)
  [2a0f44e3] Base64  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Base64`]
  [ade2ca70] Dates  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Dates`]
  [8bb1440f] DelimitedFiles  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/DelimitedFiles`]
  [8ba89e20] Distributed  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Distributed`]
  [b77e0a4c] InteractiveUtils  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/InteractiveUtils`]
  [76f85450] LibGit2  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/LibGit2`]
  [8f399da3] Libdl  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Libdl`]
  [37e2e46d] LinearAlgebra  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/LinearAlgebra`]
  [56ddb016] Logging  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Logging`]
  [d6f4376e] Markdown  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Markdown`]
  [a63ad114] Mmap  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Mmap`]
  [44cfe95a] Pkg  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Pkg`]
  [de0858da] Printf  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Printf`]
  [3fa0cd96] REPL  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/REPL`]
  [9a3f8284] Random  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Random`]
  [ea8e919c] SHA  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/SHA`]
  [9e88b42a] Serialization  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Serialization`]
  [1a1011a3] SharedArrays  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/SharedArrays`]
  [6462fe0b] Sockets  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Sockets`]
  [2f01184e] SparseArrays  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/SparseArrays`]
  [10745b16] Statistics  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Statistics`]
  [8dfed614] Test  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Test`]
  [cf7118a7] UUIDs  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/UUIDs`]
  [4ec0a83e] Unicode  [`~/00Software/julia-0.7.0/bin/../share/julia/stdlib/v0.7/Unicode`]
┌ Warning: Deprecated syntax `try without catch or finally` at /home/ufechner/.julia/packages/Lint/7lMno/test/runtests.jl:58.
└ @ ~/.julia/packages/Lint/7lMno/test/runtests.jl:58
┌ Warning: Deprecated syntax `try without catch or finally` at /home/ufechner/.julia/packages/Lint/7lMno/test/runtests.jl:65.
└ @ ~/.julia/packages/Lint/7lMno/test/runtests.jl:65
┌ Warning: Deprecated syntax `try without catch or finally` at /home/ufechner/.julia/packages/Lint/7lMno/test/runtests.jl:73.
└ @ ~/.julia/packages/Lint/7lMno/test/runtests.jl:73
┌ Warning: `using A: B` will only be allowed for single bindings, not modules. Use `using A.B` instead
│   caller = ip:0x0
└ @ Core :-1
WARNING: importing deprecated binding Base.Nullable into LintCompat.
ERROR: LoadError: LoadError: ArgumentError: invalid type for argument x in method definition for BROADCAST at /home/ufechner/.julia/packages/Lint/7lMno/src/compat.jl:7
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/ufechner/.julia/packages/Lint/7lMno/src/Lint.jl:3
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:399
 [13] top-level scope at ./none:3
in expression starting at /home/ufechner/.julia/packages/Lint/7lMno/src/compat.jl:6
in expression starting at /home/ufechner/.julia/packages/Lint/7lMno/src/Lint.jl:29
ERROR: LoadError: Failed to precompile Lint [d4b2101a-7710-563d-8e49-77b01dd33fad] to /home/ufechner/.julia/compiled/v0.7/Lint/2G6O3.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834
 [8] include at ./boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include(::Module, ::String) at ./sysimg.jl:29
 [11] include(::String) at ./client.jl:398
 [12] top-level scope at none:0
in expression starting at /home/ufechner/.julia/packages/Lint/7lMno/test/runtests.jl:1
ERROR: Package Lint errored during testing
gabrielpreviato commented 6 years ago

It also fails in Julia 1.0

(v1.0) pkg> test Lint
   Testing Lint
    Status `/tmp/tmpD2WQrV/Manifest.toml`
  [34da2185] Compat v1.0.1
  [682c06a0] JSON v0.19.0
  [d4b2101a] Lint v0.5.2
  [2a0f44e3] Base64  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Base64`]
  [ade2ca70] Dates  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Dates`]
  [8bb1440f] DelimitedFiles  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/DelimitedFiles`]
  [8ba89e20] Distributed  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Distributed`]
  [b77e0a4c] InteractiveUtils  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/InteractiveUtils`]
  [76f85450] LibGit2  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/LibGit2`]
  [8f399da3] Libdl  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Libdl`]
  [37e2e46d] LinearAlgebra  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/LinearAlgebra`]
  [56ddb016] Logging  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Logging`]
  [d6f4376e] Markdown  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Markdown`]
  [a63ad114] Mmap  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Mmap`]
  [44cfe95a] Pkg  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Pkg`]
  [de0858da] Printf  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Printf`]
  [3fa0cd96] REPL  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/REPL`]
  [9a3f8284] Random  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Random`]
  [ea8e919c] SHA  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/SHA`]
  [9e88b42a] Serialization  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Serialization`]
  [1a1011a3] SharedArrays  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/SharedArrays`]
  [6462fe0b] Sockets  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Sockets`]
  [2f01184e] SparseArrays  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/SparseArrays`]
  [10745b16] Statistics  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Statistics`]
  [8dfed614] Test  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Test`]
  [cf7118a7] UUIDs  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/UUIDs`]
  [4ec0a83e] Unicode  [`~/Programs/julia-1.0.0/bin/../share/julia/stdlib/v1.0/Unicode`]
ERROR: LoadError: LoadError: UndefVarError: Nullable not defined
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/previato/.julia/packages/Lint/cRkXj/src/Lint.jl:3
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:389
 [13] top-level scope at ./none:3
in expression starting at /home/previato/.julia/packages/Lint/cRkXj/src/exprutils.jl:10
in expression starting at /home/previato/.julia/packages/Lint/cRkXj/src/Lint.jl:32
ERROR: LoadError: Failed to precompile Lint [d4b2101a-7710-563d-8e49-77b01dd33fad] to /home/previato/.julia/compiled/v1.0/Lint/2G6O3.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834
 [8] include at ./boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include(::Module, ::String) at ./sysimg.jl:29
 [11] include(::String) at ./client.jl:388
 [12] top-level scope at none:0
in expression starting at /home/previato/.julia/packages/Lint/cRkXj/test/runtests.jl:1
ERROR: Package Lint errored during testing
MichaelDS commented 6 years ago

Tests also failing for me, using Julia 1.0.

(v1.0) pkg> add Lint#master
  Updating git-repo `https://github.com/tonyhffong/Lint.jl.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.0/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v1.0/Manifest.toml`
 [no changes]

(v1.0) pkg> test Lint
   Testing Lint
    Status `/tmp/tmpBpyrQp/Manifest.toml`
  [15f4f7f2] AutoHashEquals v0.2.0
  [34da2185] Compat v1.0.1
  [682c06a0] JSON v0.19.0
  [d4b2101a] Lint v0.5.2+ #master (https://github.com/tonyhffong/Lint.jl.git)
  [2a0f44e3] Base64  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Base64`]
  [ade2ca70] Dates  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Dates`]
  [8bb1440f] DelimitedFiles  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/DelimitedFiles`]
  [8ba89e20] Distributed  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Distributed`]
  [b77e0a4c] InteractiveUtils  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/InteractiveUtils`]
  [76f85450] LibGit2  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/LibGit2`]
  [8f399da3] Libdl  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Libdl`]
  [37e2e46d] LinearAlgebra  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/LinearAlgebra`]
  [56ddb016] Logging  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Logging`]
  [d6f4376e] Markdown  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Markdown`]
  [a63ad114] Mmap  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Mmap`]
  [44cfe95a] Pkg  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Pkg`]
  [de0858da] Printf  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Printf`]
  [3fa0cd96] REPL  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/REPL`]
  [9a3f8284] Random  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Random`]
  [ea8e919c] SHA  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/SHA`]
  [9e88b42a] Serialization  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Serialization`]
  [1a1011a3] SharedArrays  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/SharedArrays`]
  [6462fe0b] Sockets  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Sockets`]
  [2f01184e] SparseArrays  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/SparseArrays`]
  [10745b16] Statistics  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Statistics`]
  [8dfed614] Test  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Test`]
  [cf7118a7] UUIDs  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/UUIDs`]
  [4ec0a83e] Unicode  [`~/julia/usr/bin/../share/julia/stdlib/v1.0/Unicode`]
ERROR: LoadError: LoadError: UndefVarError: Nullable not defined
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/mdsalerno/.julia/packages/Lint/7lMno/src/Lint.jl:3
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:389
 [13] top-level scope at ./none:3
in expression starting at /home/mdsalerno/.julia/packages/Lint/7lMno/src/compat.jl:6
in expression starting at /home/mdsalerno/.julia/packages/Lint/7lMno/src/Lint.jl:29
ERROR: LoadError: Failed to precompile Lint [d4b2101a-7710-563d-8e49-77b01dd33fad] to /home/mdsalerno/.julia/compiled/v1.0/Lint/2G6O3.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834
 [8] include at ./boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include(::Module, ::String) at ./sysimg.jl:29
 [11] include(::String) at ./client.jl:388
 [12] top-level scope at none:0
in expression starting at /home/mdsalerno/.julia/packages/Lint/7lMno/test/runtests.jl:1
ERROR: Package Lint errored during testing
cossio commented 6 years ago

Hope to see this resolved soon.

x-ji commented 5 years ago

Doesn't seem to work on 0.7. Trying to using Lint results in the following error. Guess I might as well stay at 0.6 for now for my project.

julia> using Lint
[ Info: Precompiling Lint [d4b2101a-7710-563d-8e49-77b01dd33fad]
WARNING: importing deprecated binding Base.Nullable into ExpressionUtils.
ERROR: LoadError: LoadError: ArgumentError: invalid type for argument x in method definition for BROADCAST at /home/jx/.julia/packages/Lint/cRkXj/src/exprutils.jl:11
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/jx/.julia/packages/Lint/cRkXj/src/Lint.jl:3
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1038
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:399
 [13] top-level scope at ./none:3
in expression starting at /home/jx/.julia/packages/Lint/cRkXj/src/exprutils.jl:10
in expression starting at /home/jx/.julia/packages/Lint/cRkXj/src/Lint.jl:32
ERROR: Failed to precompile Lint [d4b2101a-7710-563d-8e49-77b01dd33fad] to /home/jx/.julia/compiled/v0.7/Lint/2G6O3.ji.
Stacktrace:
 [1] macro expansion at ./logging.jl:313 [inlined]
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
 [3] macro expansion at ./logging.jl:311 [inlined]
 [4] _require(::Base.PkgId) at ./loading.jl:941
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834
gabrielpreviato commented 5 years ago

I had a look at the package code and saw that are some pieces of code that need to be updated to 0.7 new syntaxes. Things like Nullables, the syntax for parametric methods, and maybe more. Unfortunately, I'm not very proficient in Julia, so if I try to fix I may do some bad changes. I'll try to fix it locally and if I succeed I'll open a PR.

TotalVerb commented 5 years ago

Thanks, I have had very little time to maintain this package lately. I'll be happy to review any PRs if you have them.

x-ji commented 5 years ago

Just wanted to mention that there is a similar package https://github.com/ZacLN/StaticLint.jl that works for versions 0.7/1.0 and is a part of the VSCode extension, together with the language server. It's still under active development though and can be unstable with 0.7/1.0.

richiejp commented 5 years ago

@gabrielpreviato

I have also tried to fix this for 1.0, but it is turning out to be quite a challenge for my newbie Julia skills. I'm not sure I trust some of my changes, but I'll post the diff here just in case you find it useful: https://github.com/tonyhffong/Lint.jl/compare/master...richiejp:v1.0-fixes?expand=1

I have at least managed to get the module to precompile and some of the tests to pass.