refactor

Dev tools

code refactoring

SHOW HN2021

110points
33comments
#482of 2,533 in 2021
Top 20%of 2021 by points

How HN took it

QuietFewer than 5 comments about the project

0 positive, 3 neutral or asking, 0 mixed, 0 critical, out of 3 comments about the project.

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Useful for small-fragment refactors where formatting loss matters little

    From 1 comment
    • 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…
      treesciencebot on HN

Objections

  • stdlib ast loses comments and whitespace, so CST tools like parso or LibCST are better for large refactors

    From 2 comments
    • (Author of Bowler/maintainer of fissix) The main concern with using the ast module from stdlib is that you lose all formatting/whitespace/comments in your syntax tree, so writing…
      jreese on HN
    • You should check out parso which is a fully roundtrip-able AST. That way your tool won't throw away comments and formatting.
      boxed on HN

Requests

  • Support for other languages, a polyglot pattern-matching rewrite tool

    From 1 comment
    • I wonder if something like this exists for other languages? Most rewriting/refactoring tools make too many assumptions about the surrounding project. Something simple which…
      bmc7505 on HN

Questions

  • Whether it works on PyPy

    From 1 comment
    • The one thing I hope for when it comes to Python is that PyPy becomes the default runtime everywhere. CPython is so unbelievably slow when compared to languages like PHP and…
      TekMol on HN

Alternatives named

  • Bowler

    From 1 comment
    • A similar type project. Though I haven't seen much activity recently: https://github.com/facebookincubator/Bowler
      graton on HN
  • parso

    From 1 comment
    • You should check out parso which is a fully roundtrip-able AST. That way your tool won't throw away comments and formatting.
      boxed on HN
  • LibCST

    From 1 comment
    • (Author of Bowler/maintainer of fissix) The main concern with using the ast module from stdlib is that you lose all formatting/whitespace/comments in your syntax tree, so writing…
      jreese on HN
  • semgrep

    From 1 comment
    • Maybe something like this: https://semgrep.dev/ I found it last week. It may be able to detect a potential issue in multiple languages, but not sure if it supports refactoring.
      woile on HN
  • tree-sitter

    From 1 comment
    • This is not a problem I'd had, but it sounds like something tree-sitter might be able to help with. I've been using tree-sitter for syntax highlighting, simple refactors, and…
      jay-aye-see-key on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/28027016)