Git Product home page Git Product logo

deprecations.jl's People

Contributors

alexmorley avatar fredrikekre avatar keno avatar kristofferc avatar zacln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deprecations.jl's Issues

VERSION deprecation ternary

-lower(mod, arg) = VERSION < v"0.7-" ? expand(arg) : Meta.lower(mod, arg)
+lower(mod, arg) = false ? expand(arg) : Meta.lower(mod, arg)

Do not report deprecations when defining methods and macros

 a bunch of functions got keyword arguments instead of positional arguments
    In file /tmp/tmpH3kn24/src/intervals/rounding_macros.jl starting at line 49:
        macro round(ex1, ex2)

I am defining a macro @round, so the deprecation for the function round is not relevant.

`warn("foo")` -> `@warn("foo")` etc

It would be good to catch the low-hanging fruit on fixing for the logging changes.
Just getting the single argument forms of info, and warn
would presumably catch 90% of all uses.

Slack-dump for context:

Lyndon White [6:35 PM]
Does Femto cleaner not do warn(foo) --> @warn(foo) ?

Fredrik Ekre [6:36 PM]
No

Lyndon White [6:36 PM]
Should I open an issue on Deprecations.jl?

Fredrik Ekre [6:37 PM]
I am not sure the transformation is always possible though

Lyndon White [6:38 PM]
You are probably right, (though idk why) that issue is listed as a breaking change so the deprecation mustn't always work

Fredrik Ekre [6:39 PM]
warn takes several arguments for example

Lyndon White [6:39 PM]
It might still be better to have Femtocleaner fix it, since presumably 90% of the time it does work?
Maybe making it fix it in the simplest case

Fredrik Ekre [6:39 PM]
Yea
warn("foo") -> @warn("foo") for example

Incorrect action in GPUArrays.jl

-(::Type{<: JLArray{T}})(x::AbstractArray) where T = JLArray(convert(Array{T}, x), size(x))
+<: JLArray{T}(x::AbstractArray) where T = JLArray(convert(Array{T}, x), size(x))

AST Matching bug

While trying to clean Documenter.jl

BoundsError: attempt to access 0-element Array{Any,1} at index [1]
Stacktrace:
 [1] getindex(::Array{Any,1}, ::Int64) at ./array.jl:549
 [2] getindex(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Int64) at /opt/pkgs/v0.6/Deprecations/src/CSTUtils/treewalking.jl:46
 [3] match_parameters(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Dict{Any,Any}) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:66
 [4] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:144
 [5] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Do}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185 (repeats 2 times)
 [6] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
 [7] #text_replacements#86(::Void, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
 [8] #collect_deprecation_annotations#10(::Bool, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:187
 [9] (::FemtoCleaner.##57#63{GitHub.GitHubWebAPI})(::Tuple{Base.LibGit2.GitRepo,String}) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:356
 [10] with_cloned_repo(::FemtoCleaner.##57#63{GitHub.GitHubWebAPI}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:25
 [11] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:353
 [12] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
 [13] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
 [14] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:525
 [15] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:501
 [16] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335

Add pure to the whitelist macro list

E.g. eps wasn't picked up in

@pure function Rational{T}(x::AbstractIrrational) where T<:Integer
    o = precision(BigFloat)
    p = 256
    while true
        setprecision(BigFloat, p)
        bx = BigFloat(x)
        r = rationalize(T, bx, tol=0)
        if abs(BigFloat(r) - bx) > eps(bx)
            setprecision(BigFloat, o)
            return r
        end
        p += 32
    end
end

UTF8String is not changed if it's a type field

Consider the following diff, generated by Deprecations current master (as of this writing):

-immutable PkgMeta
+struct PkgMeta
     name::Compat.UTF8String
     url::Compat.UTF8String
     versions::Vector{PkgMetaVersion}
@@ -93,7 +93,7 @@ function get_pkg(pkg_name::AbstractString;
         ver_path = joinpath(vers_path, dir)
         sha = strip(readstring(joinpath(ver_path,"sha1")))
         req_path = joinpath(ver_path,"requires")
-        reqs = Compat.UTF8String[]
+        reqs = String[]

Notice that in the type definition, the field name is declared as ::Compat.UTF8String, but this is left untouched. But at the bottom of the diff, when Compat.UTF8String is used in a typed empty array literal, it gets properly changed to String.

Removal of comments

julia> Deprecations.edit_text("""
       if VERSION < v"0.1.0"
           foo() = 1
       else
           # comment
           foo() = 2
       end
       """)
(true, "foo() = 2\n")

I believe the # comment comment should be preserved?

unable to precompile on 0.6.3.

I tried to use FemtoCleaner locally on 0.6.3 (as I could not get it to work on 0.7 alpha).
It is not clear to me which version of AbstractTrees, CSTParser and Deprecations I should use for that.
Currently, I fail due to Deprecations not compiling (I installed AbstractTrees v0.1.0 which does not seem to work).

Is there any way I can get this working.

using FemtoCleaner
INFO: Precompiling module CSTParser.
ERROR: LoadError: LoadError: LoadError: UndefVarError: prevsibling not defined
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:576
 [2] include(::String) at .\sysimg.jl:14
 [3] include_from_node1(::String) at .\loading.jl:576
 [4] eval(::Module, ::Any) at .\boot.jl:235
 [5] _require(::Symbol) at .\loading.jl:490
 [6] require(::Symbol) at .\loading.jl:405
 [7] include_from_node1(::String) at .\loading.jl:576
 [8] eval(::Module, ::Any) at .\boot.jl:235
 [9] _require(::Symbol) at .\loading.jl:490
 [10] require(::Symbol) at .\loading.jl:405
while loading C:\Users\bernhard.konig\.julia\v0.6\Deprecations\src\astmatching.jl, in expression starting on line 116
while loading C:\Users\bernhard.konig\.julia\v0.6\Deprecations\src\Deprecations.jl, in expression starting on line 27
while loading C:\Users\bernhard.konig\.julia\v0.6\FemtoCleaner\src\FemtoCleaner.jl, in expression starting on line 9

Error when cleaning GPUArrays.jl

WARNING: Exception thrown when fixing file gpuarray_interface.jl. Exception was:
BoundsError
Stacktrace:
 [1] indexed_next(::Bool, ::Int64, ::Bool) at ./tuple.jl:56
 [2] reassemble_tree(::Deprecations.CSTUtils.OverlayNode{CSTParser.Block}, ::Dict{Any,Any}, ::Deprecations.ChildReplacementNode) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:251
 [3] reassemble_tree(::Deprecations.CSTUtils.OverlayNode{CSTParser.Struct}, ::Dict{Any,Any}, ::Void) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:244
 [4] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Struct}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:146
 [5] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185
 [6] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
 [7] #text_replacements#96(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
 [8] (::Deprecations.#kw##text_replacements)(::Array{Any,1}, ::Deprecations.#text_replacements, ::String, ::Array{Any,1}) at ./<missing>:0
 [9] #edit_text#100(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:194
 [10] (::Deprecations.#kw##edit_text)(::Array{Any,1}, ::Deprecations.#edit_text, ::String, ::Array{Any,1}) at ./<missing>:0
 [11] #edit_file#105(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:199
 [12] (::Deprecations.#kw##edit_file)(::Array{Any,1}, ::Deprecations.#edit_file, ::String, ::Array{Any,1}, ::Function) at ./<missing>:0
 [13] #process_deprecations#6(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:80
 [14] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
 [15] #apply_deprecations#11(::Int64, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:215
 [16] apply_deprecations_if_updated(::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::String, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:282
 [17] with_cloned_repo(::FemtoCleaner.##59#65{GitHub.GitHubWebAPI,Base.LibGit2.Signature,GitHub.WebhookEvent}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:25
 [18] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:444
 [19] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
 [20] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
 [21] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:525
 [22] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:501
 [23] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335

Nullable{T} -> Union{T, Nothing}

I am just writing this down, I think it is maybe not a good use of anyones time to implement it.
But I want it down for my thought process.

For all of the below, assume T != Void (for T=Void it is likely better to fix by hand)

  • Nulltable{T} --> Union{Nothing, T}
  • get(x) with x::Nullable (knowing type required) --> x
    • Not completely safe because someone could be relying on the exception that get(null) throws), but generally useful
  • isnull(x) --> x==nothing

Space out ternaries

Omitting a space between the condition and the question mark in ternaries is deprecated as of JuliaLang/julia#22523 (0.7.0-DEV.797). Further, as of JuliaLang/julia#22712 (0.7.0-DEV.1004), omitting spaces on either side of ? and : is deprecated in ternaries. It would be great if this was something that could be recognized and handled appropriately.

Scoping incorrect when docstring ahead of signature

 Reorders the vectors of a generalized Schur decomposition. `select` specifies
 the eigenvalues in each cluster.
 """
-tgsen!(select::AbstractVector{BlasInt}, S::AbstractMatrix, T::AbstractMatrix, Q::AbstractMatrix, Z::AbstractMatrix)
+tgsen!(partialsort::AbstractVector{BlasInt}, S::AbstractMatrix, T::AbstractMatrix, Q::AbstractMatrix, Z::AbstractMatrix)

List of deprecations to implement

Will keep adding to this:

  • Ptr{Void} -> Ptr{Cvoid}
  • Void -> Nothing
  • unshift! -> pushfirst!, shift!-> popfirst!
  • CartesianRange -> CartesianIndices
  • sub2ind -> CartesianIndices, ind2sub -> LinearIndices
  • JULIA_HOME -> Sys.BINDIR
  • ipermute! -> invpermute!
  • spones(A) -> fillstored!(copy(A), 1)
  • info, warn to macro versions (might be a bit tricky).
  • Display -> AbstractDisplay
  • linspace(a, b) -> linspace(a, b, 50), logspace(a, b) -> logspace(a, b, 50).
  • (x...) -> (x...,)
  • strwidth, charwidth -> textwidth
  • Array{T, N}(m::Int, ...::Int) -> Array{T, N}(uninitialized, m, ...)
  • logm -> log, expm -> exp, sqrtm -> sqrt
  • union() -> Set().
  • A_mul_B! -> mul! and co
  • isleaftype -> isconcretetype JuliaLang/julia#25496
  • isabstract-> isabstracttype JuliaLang/julia#25496
  • doc" " -> @doc doc""
  • iteratorsize -> IteratorSize
  • digits keyword argument to round.
  • parse -> Meta.parse
  • prod, sum needs to take dims keyword
  • linspace to range with keyword arguments
  • Automatically escape previously invalid escape sequences in strings
  • showcompact
  • eval -> Core.eval
  • atan2 -> atan
  • Compat.@__MODULE__ -> @__MODULE__
  • parse(Int, s, b) -> parse(Int, s, base=b).
  • is_unix -> Sys.isunix

Some of these might be unsafe to do without semantic analysis. Look into using https://github.com/ZacLN/StaticLint.jl and see how well it can be used to figure out where the binding originate from.

parse @docs code blocks as code

Such that e.g. the following would get changed in an md doc:

Base.typemin
Base.typemax
Base.realmin
Base.realmax
Base.maxintfloat
Base.ulp(::Type{<:AbstractFloat})
Base.ulp(::AbstractFloat)
Base.instances

Deprecations errors when processing base julia

ArgumentError("stream is closed or WARNING: Iterations did not converge for file io.jl
WARNING: Iterations did not converge for file regex.jl
WARNING: Iterations did not converge for file util.jl
ARNING: Exception thrown when fixing file basic.jl. Exception was:
UnicodeError: invalid character index 1 (0x80 is a continuation byte)
Stacktrace:
 [1] getindex(::String, ::UnitRange{Int64}) at ./strings/string.jl:239
 [2] parse_string_or_cmd(::CSTParser.ParseState, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/strings.jl:89
 [3] parse_string_or_cmd(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/strings.jl:25
 [4] CSTParser.LITERAL(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/spec.jl:83
 [5] INSTANCE(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/spec.jl:156
 [6] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:68
 [7] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:119 [inlined]
 [8] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [9] parse_comma_sep(::CSTParser.ParseState, ::Array{Any,1}, ::Bool, ::Bool, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:116
 [10] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [11] parse_paren(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:257
 [12] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [13] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:59
 [14] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:119 [inlined]
 [15] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [16] parse_comma_sep(::CSTParser.ParseState, ::Array{Any,1}, ::Bool, ::Bool, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:116
 [17] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [18] parse_paren(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:257
 [19] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [20] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:59
 [21] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:85 [inlined]
 [22] parse_comp_operator(::CSTParser.ParseState, ::Any, ::CSTParser.OPERATOR) at /opt/pkgs/v0.6/CSTParser/src/components/operators.jl:218
 [23] parse_operator(::CSTParser.ParseState, ::Any, ::CSTParser.OPERATOR) at /opt/pkgs/v0.6/CSTParser/src/components/operators.jl:377
 [24] parse_compound(::CSTParser.ParseState, ::Any) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:198
 [25] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [26] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:89
 [27] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [28] parse_ranges(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/loops.jl:13
 [29] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
 [30] parse_for(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/loops.jl:3
 [31] parse_kw(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:110
 [32] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [33] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:57
 [34] parse_doc(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:304
 [35] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [36] parse_block(::CSTParser.ParseState, ::Array{Any,1}, ::Tuple{Tokenize.Tokens.Kind}, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/genericblocks.jl:38
 [37] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
 [38] parse_begin(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/genericblocks.jl:4
 [39] parse_kw(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:106
 [40] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [41] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:57
 [42] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
 [43] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/macros.jl:48 [inlined]
 [44] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
 [45] parse_macrocall(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/macros.jl:47
 [46] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
 [47] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:74
 [48] parse_doc(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:304
 [49] parse(::CSTParser.ParseState, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:325
 [50] parse(::String, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:277
 [51] overlay_parse at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:87 [inlined] (repeats 2 times)
 [52] edit_text(::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:117
 [53] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:172
 [54] #process_deprecations#6(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:64
 [55] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
 [56] #apply_deprecations#8(::Int64, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:95
 [57] with_cloned_repo(::FemtoCleaner.##53#57{GitHub.GitHubWebAPI,Base.LibGit2.Signature}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:23
 [58] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:221
 [59] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
 [60] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
 [61] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:498
 [62] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:474
 [63] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335

Broken on ReverseDiffSparse

I noticed that femtocleaner ignored ReverseDiffSparse, so I tried to run this myself. From inside ReverseDiffSparse/src, I get:

julia> Deprecations.edit_file("forward.jl")
ERROR: UnicodeError: invalid character index
Stacktrace:
 [1] slow_utf8_next(::Ptr{UInt8}, ::UInt8, ::Int64, ::Int64) at ./strings/string.jl:172
 [2] next at ./strings/string.jl:204 [inlined]
 [3] getindex(::String, ::Int64) at ./strings/basic.jl:32
 [4] findprev(::Deprecations.##3#4, ::String, ::Int64) at ./array.jl:1466
 [5] line_pos at /home/mlubin/.julia/v0.6/Deprecations/src/formatting.jl:40 [inlined]
 [6] rewrite_param_syntax(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:189
 [7] (::Deprecations.##24#28)(::Tuple{Deprecations.OldParametricSyntax,Deprecations.OverlayNode{CSTParser.FunctionDef},Array{Deprecations.TextReplacement,1},Deprecations.Context}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:212
 [8] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:133
 [9] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:162
 [10] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:119
 [11] edit_text(::String, ::Array{Any,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:166
 [12] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:172
 [13] edit_file(::String) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:171

julia> Deprecations.edit_file("reverse.jl")
ERROR: UnicodeError: invalid character index
Stacktrace:
 [1] slow_utf8_next(::Ptr{UInt8}, ::UInt8, ::Int64, ::Int64) at ./strings/string.jl:172
 [2] next at ./strings/string.jl:204 [inlined]
 [3] getindex(::String, ::Int64) at ./strings/basic.jl:32
 [4] findprev(::Deprecations.##3#4, ::String, ::Int64) at ./array.jl:1466
 [5] line_pos at /home/mlubin/.julia/v0.6/Deprecations/src/formatting.jl:40 [inlined]
 [6] rewrite_param_syntax(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:189
 [7] (::Deprecations.##24#28)(::Tuple{Deprecations.OldParametricSyntax,Deprecations.OverlayNode{CSTParser.FunctionDef},Array{Deprecations.TextReplacement,1},Deprecations.Context}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:212
 [8] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:133
 [9] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:162
 [10] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:119
 [11] edit_text(::String, ::Array{Any,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:166
 [12] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:172
 [13] edit_file(::String) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:171

Whitespacing in expression matching.

Trying to do the ismatch(reg, str) -> contains(str, reg) deprecations I am having some troubles:

Using

    match(IsMatchRegex,
        "ismatch(\$r,\$s)",
        "contains(\$s!, \$r!)",
    )

I get:

ismatch(a, b)-> ismatch( a,b). I would have assumed that the ! would strip the initial and trailing whitespace from the matched expression and use the whitespace I put in for the replacement. Is there another way to do what I want?

Consistent curly use in `where` syntax?

For my packages, I've been using the convention that the where keyword is always accompanied by curlies. Thus:

# yes
function foo(x::T) where {T<:Int}
end
# no
function foo(x::T) where T<:Int
end

To get a second opinion I looked in Base with some rough grepping. The results are, unfortunately, inconclusive, but slightly prefer including the curlies:

# Without curiles
~/src/julia-git/base$ grep '\<where\> *[^ {][^`,}]*.*$' $(find -name \*.jl) | wc -l
942 # a little inflated by false positives due to docs

# With curlies
~/src/julia-git/base$ grep '\<where\> *{[^ {][^`,}]*}.*$' $(find -name \*.jl) | wc -l
1123

Should Deprecations be updated to always produce curlies for consistency? This might be a contentious issue, but I thought I'd ask :-)

missing a case of inner constructor

julia> struct S{T}
         foo
         S(v::Vector{T}) = 42
       end

WARNING: deprecated syntax "inner constructor S(...) around REPL[6]:3".
Use "S{T}(...) where T" instead.

julia> edit_text("""
       struct S{T}
         foo
         S(v::Vector{T}) = 42
       end
       """
       )
(false, "struct S{T}\n  foo\n  S(v::Vector{T}) = 42\nend\n")

Function renames should match function call pattern instead of identifier

For example here https://github.com/JuliaDocs/Documenter.jl/blob/916386343a54b8041078bb0bfcf83d213ed6f4f7/src/Writers/HTMLWriter.jl#L316 we get

    a number of identifiers were renamed
    In file /tmp/tmpbqwXRj/src/Writers/HTMLWriter.jl starting at line 316:
        @tags a form h1 img input nav div select option

and in the same function https://github.com/JuliaDocs/Documenter.jl/blob/916386343a54b8041078bb0bfcf83d213ed6f4f7/src/Writers/HTMLWriter.jl#L333 we get

    a number of identifiers were renamed
    In file /tmp/tmpbqwXRj/src/Writers/HTMLWriter.jl starting at line 333:
        let version_selector = select["#version-selector", :onChange => "window.location.href=this.value"]()

New heuristic has an error

type MissingBinding has no field t
Stacktrace:
 [1] filter_not_likely_type(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Deprecations.KeywordsUnlocked, ::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Dict{Any,Any}) at /opt/pkgs/v0.6/Deprecations/src/database/simple.jl:438
 [2] (::Deprecations.##74#76)(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Vararg{Any,N} where N) at /opt/pkgs/v0.6/Deprecations/src/database/simple.jl:557
 [3] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:145
 [4] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185 (repeats 4 times)
 [5] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
 [6] #text_replacements#100(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
 [7] (::Deprecations.#kw##text_replacements)(::Array{Any,1}, ::Deprecations.#text_replacements, ::String, ::Array{Any,1}) at ./<missing>:0
 [8] #edit_text#104(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:194
 [9] (::Deprecations.#kw##edit_text)(::Array{Any,1}, ::Deprecations.#edit_text, ::String, ::Array{Any,1}) at ./<missing>:0
 [10] #edit_file#109(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:199
 [11] (::Deprecations.#kw##edit_file)(::Array{Any,1}, ::Deprecations.#edit_file, ::String, ::Array{Any,1}, ::Function) at ./<missing>:0
 [12] #process_deprecations#8(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:83
 [13] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
 [14] (::FemtoCleaner.##46#47{GitHub.GitHubWebAPI,GitHub.Repo,GitHub.OAuth2,Base.LibGit2.Signature})(::Tuple{Base.LibGit2.GitRepo,String}) at /opt/pkgs/v0.6/FemtoCleaner/src/autodeployment.jl:15
 [15] with_cloned_repo(::FemtoCleaner.##46#47{GitHub.GitHubWebAPI,GitHub.Repo,GitHub.OAuth2,Base.LibGit2.Signature}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:28
 [16] foreach(::FemtoCleaner.##48#50{GitHub.GitHubWebAPI,Base.LibGit2.Signature}, ::Array{GitHub.Repo,1}) at ./abstractarray.jl:1733
 [17] update_existing_repos(::GitHub.GitHubWebAPI, ::Base.LibGit2.Signature, ::Int64) at /opt/pkgs/v0.6/FemtoCleaner/src/autodeployment.jl:54
 [18] macro expansion at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:495 [inlined]
 [19] (::FemtoCleaner.##70#74{Int64})() at ./distributed/macros.jl:25
 [20] #103 at ./distributed/process_messages.jl:264 [inlined]
 [21] run_work_thunk(::Base.Distributed.##103#104{Base.Distributed.CallMsg{:call}}, ::Bool) at ./distributed/process_messages.jl:56
 [22] run_work_thunk at ./distributed/process_messages.jl:65 [inlined]
 [23] (::Base.Distributed.##96#98{Base.Distributed.RemoteValue,Base.Distributed.##103#104{Base.Distributed.CallMsg{:call}}})() at ./event.jl:73

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.