refactor

AST-based fragmental source code refactoring toolkit for Python (by isidentical)

Refactor Alternatives

Similar projects and alternatives to refactor

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better refactor alternative or higher similarity.

refactor reviews and mentions

Posts with mentions or reviews of refactor. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-08-01.
  • Show HN: Python Source Code Refactoring Toolkit via AST
    7 projects | news.ycombinator.com | 1 Aug 2021
    Indeed! I also would suggest people to use a CST implementation (parso / LibCST) instead of refactor if they intend do large scale refactors, but from what I can see in my previous attempts (e.g teyit, a unittest assertion formatter) when you deal with small code fragments (a single expression, or a small statement) then you generally don't need to worry much about the style. The only concern is the literals (especially strings, which there are a few different variations of the same AST) where you could resurrect them back from the token stream (which the CustomUnparser representative in refactor allows).

    The real start point for this project was to find / replace all type()'s in CPython codebase with type(type()) (e.g type('') would become type(str)) which is very light weight transformation, and I was able to write a script which did it without having any major problems about style on over 2000 files. Here it is for the reference: https://github.com/isidentical/refactor/blob/master/examples...

    Also one thing to note here is that; in the last couple of years, thanks to black (and yapf), the adoptance of code formatters have really increased which is very nice for custom refactoring tools like refactor since the end-code would be refactored anyways so that means if you convert a multi line call, or a list to a single line version then the formatter you use probably reformat that segment anyways.

    But thanks for authoring Bowler! It is a very cool project.

Stats

Basic refactor repo stats
7
431
0.0
3 months ago

isidentical/refactor is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of refactor is Python.

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com