FemtoCleaner usage HOWTO

Hi folks,

femtocleaner is gradually gaining knowledge of all the 0.7 deprecations. At this point it should already be helpful in upgrading packages to 0.7, so I figured I’d put together a quick tutorial for how to go about using femtocleaner to upgrade a package to 0.7. As an example, I will use the StructIO package (relevant PR here: Bump REQUIRE to 0.7-alpha by Keno · Pull Request #17 · JuliaIO/StructIO.jl · GitHub).

  1. Make sure femtocleaner is set up on the repository of intrest
  2. Create a new pull request that bumps julia to 0.7-alpha.
  3. Go to the Checks tab of the pull request. After a few seconds, a femtocleaner summary should appear:
  4. Click the “Fix it” button to ask femtocleaner to push a commit fixing the deprecations it found to this PR.
  5. If necessary, check out the PR locally to do any remaining deprecations manually, update the README, remove Compat (if appropriate), update CI scripts.
  6. Merge the PR (You may want to squash merge it, to do everything in one go)

We have a femtocleaner channel on Slack. Please join us for any questions or problems. Please note that femtocleaner for 0.7 is still experimental, so there may be bugs. If you encounter any, please let me know so we can get them fixed.

26 Likes

Do the old guidelines on how to run it locally rather than on a repository still apply?

I have code that I edit locally rather than in a commit repository on which I would like to run FemtoCleaner.

More or less, yes. However, it’s a bit tricky to get it set up correctly right now since things are in transition. Since the focus for the moment is on getting the ecosystem upgraded, I’d recommend waiting until FemtoCleaner has settled down enough that you can just install it locally and use it.

The “Fix It” button disappeared after the page was reloaded. Is there any way to manually download the diffs?

No, I’d recommend just hitting the button. If you want to undo it, just use git to drop the commit again (I can also add a button for that).

The problem is that I can’t find the button again. Would you recommend just reopening the PR?

Oh, I see. Yeah, that should work. If it happens again, let me know so we can ask github what happened.

Just tried it again, but the button didn’t even show up this time:

I am interested in running FemtoCleaner locally. Following the README and some help on discourse, I tried to run it on 0.6. This required checking out

Pkg.checkout("AbstractTrees", "kf/for06")

I tried running it on a local repo (GitHub - JuliaPolyhedra/Polyhedra.jl: Polyhedral Computation Interface) and I received the error I posted here: Femtocleaner causes MethodError: no method matching get_sig(::CSTParser.UnarySyntaxOpCall) · Issue #82 · julia-vscode/CSTParser.jl · GitHub, repeated:

ERROR: MethodError: no method matching get_sig(::CSTParser.UnarySyntaxOpCall)
Closest candidates are:
  get_sig(::CSTParser.BinarySyntaxOpCall) at /Users/goretkin/repos/update_polyhedra/jl_pkg/v0.6/CSTParser/src/interface.jl:266
  get_sig(::CSTParser.EXPR{CSTParser.Macro}) at /Users/goretkin/repos/update_polyhedra/jl_pkg/v0.6/CSTParser/src/interface.jl:264
  get_sig(::CSTParser.EXPR{CSTParser.FunctionDef}) at /Users/goretkin/repos/update_polyhedra/jl_pkg/v0.6/CSTParser/src/interface.jl:263
  ...

I thought I might try to find the offending line of syntax that is causing the parser to fail, but I wasn’t able to instrument Deprecations/CSTAnalyzer.jl to print out line numbers that were currently being processed.