https://github.com/juliacomputing/deprecations.jl
A database of julia deprecations and how to fix them
https://github.com/juliacomputing/deprecations.jl
Last synced: 4 months ago
JSON representation
A database of julia deprecations and how to fix them
- Host: GitHub
- URL: https://github.com/juliacomputing/deprecations.jl
- Owner: JuliaComputing
- License: other
- Created: 2017-07-30T21:11:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T05:44:40.000Z (over 4 years ago)
- Last Synced: 2025-02-23T06:13:20.010Z (4 months ago)
- Language: Julia
- Size: 447 KB
- Stars: 17
- Watchers: 42
- Forks: 7
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Deprecations
[](https://travis-ci.org/JuliaComputing/Deprecations.jl)
[](http://codecov.io/github/JuliaComputing/Deprecations.jl?branch=master)This package contains a database of deprecated syntax and functions and how to automatically upgrade them. This database can be found in the src/database.jl
repository. In addition, it contains a number of utilities to aid in this task. The main user-facing entrypoints are the
`edit_text` and `edit_file` functions, which take a text snippet or a file name respectively and applies all upgrades it knows how to.
For the `edit_file` function, this is done in-place, so make sure not to use this on a file that you have not committed to version control.
Ideally, however, you should not need to use this package directly, as it does not have sufficient context to determine which julia/package versions
your file supports. Instead, consider using [FemtoCleaner](https://github.com/Keno/FemtoCleaner.jl), or an IDE with integrated support for using
the information in this package.## Installation Notes
Deprecations.jl requires the latest master of `AbstractTrees` and `CSTParser`.
To Build first do:
```
Pkg.checkout("AbstractTrees")
Pkg.checkout("CSTParser")
```# Adding additional deprecations
There are currently two ways of adding deprecations to this package. However, they are both rather ad-hoc and if
you can think of a better way, please open a PR. The two ways are:1. Manually using the CSTParser API. As an example see the `ObsoleteVersionCheck` deprecations. This kind of check
can register itself to any CSTParser AST node and will get a callback whenever that node is encountered. This
callback then determines whether or not the deprecation applies, and if so what the appropriate replacement is.
2. By using the AST matcher utilities in this package. Most other deprecations follow this pattern. To use it, you simply
provide two strings: The pattern to match, and the pattern to replace. Both must be vaild, parseable julia expressions.
At any point you may insert a `$NAME` or `$NAME...` expression, which represents a wildcard match of one (or several for `...`)
expressions at that position in the parse tree. Similarly, using the same name in the replacement expression will splice
the matched values in at that location in the parse tree. Appending an `!` to the name in the replacement expression,
will cause it to ignore surrounding whitespace. Otherwise whitespace from the replacement expression is added in addition
to any whitespace that may be matched by one of the template variables.