Hey,

I’m exploring the idea of a webpage where you can paste a function (or a block of code) in any programming language, and it outputs a list of specific, actionable refactoring suggestions - things like:

  • Unnecessary complexity
  • Poor naming conventions
  • Duplicated logic
  • Violations of language-specific best practices
  • Readability issues

The goal is to help developers quickly spot areas for improvement and make their code cleaner, more maintainable, and easier to understand.

Questions for you:

  • Would you use such a tool? Why or why not?
  • What features would make it important for you? (e.g., integration with GitHub, support for obscure languages, explanations for each suggestion, etc.)
  • Are you ready to pay for a tool like this (for example, paying for access to advanced checks or being able to tune checks for your programming style)?
  • Are there existing tools you love (or hate) that do something similar?
  • Jayjader@jlai.lu
    link
    fedilink
    arrow-up
    25
    ·
    5 days ago

    Are you aware of sonarqube?

    It does the complexity and best practices parts of your list, and can be plugged into continuous delivery systems. Jetbrains’ IDEs have a free plugin that will run it locally, and I would be surprised if similar integrations didn’t exist for (neo)vim, vs-code, etc.

    It’s pretty decent at explaining why it considers a chunk of code to be problematic, and can even propose quick fixes as if it were an LSP.

    You can also flag issues it finds as “intended/deemed non-fixable by the dev(s)”.

    • Kissaki@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      4 days ago

      I love SonarQube (previously called SonarLint). I/We use it at work in dotnet/C# and web/Blazor projects.

      Their free offer is great.

      The dotnet and Visual Studio analyzer suggestions are already a great tool. Adding SonarQube on top, and recently I’ve added Roslynator Analyzers as well gives great free tooling, linting, suggestions of various levels, and quick actions to apply.

      With the commercial backing they have, SonarQube is very well maintained/developed as well, with regular updates.

    • pHr34kY@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      5 days ago

      I use this at work. It’s actually quite good. Its suggestions aren’t the sort of thing you’d ignore.

      It does slow the IDE on large projects though.

    • YUART@feddit.orgOP
      link
      fedilink
      English
      arrow-up
      7
      ·
      5 days ago

      Hi, hmm, I think that’s almost the tool I had in mind. So if sonarqube exists, I guess there is no need for another tool in the same area. Thanks for sharing

      • Jayjader@jlai.lu
        link
        fedilink
        arrow-up
        8
        ·
        5 days ago

        You’re welcome! I would suggest giving it a try, maybe there’s a feature or functionality you have in mind that sonarqube doesn’t do.

      • entwine@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        4 days ago

        Just because a product exists already doesn’t mean there isn’t opportunity for a competitor! You could try competing on price, maybe offer a more generous free tier which can help you get more sign ups. Maybe make it free for self-hosting, but you make money offering it as a service as most devs probably won’t bother.

        Sonarqube proved there’s a market for this type of product already, which is the hardest part!

      • grandel@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        5 days ago

        Im not OP but I use VS Code and it’s setup to:

        • perform a static code analysis
        • auto format code according to my defined code style
        • highlight unused variables, namespaces, etc.
        • make some suggestions to improve code quality

        Which is what I think OP is trying to say. Your idea sounds like what IDEs should do (and mostly do).

  • 6nk06@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    6 days ago

    JetBrains and Cursor do that already but better and without pasting anything. I’m sure it also exists with Copilot, Claude or ChatGPT.

  • PokerChips@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    4 days ago

    Make an open source project for this. I’d love something like this for neovim. Not that I ever have any novel code to leak but I still find it odd that we just invite businesses to just spy on our code.

  • RonSijm@programming.dev
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    5 days ago

    Are there existing tools you love (or hate) that do something similar?

    This sounds similar to “Static code analysis” tools. Especially now that these code analysis tools are getting AI integrations.

    For example we use coderabbit.ai. That does a code review on PRs in github, and reviews these sort of things. Especially the simpler things that you’ve mentioned like poor naming conventions, violations of language-specific best practices, and readability issues. I’m not sure if it will automatically come up with “large refactoring opportunities” by default - but maybe you can custom-prompt configure it to try, I guess

    (Comment) Why have a separate webpage if such of helper can be built into IDE/editor?

    Coderabbit also has IDE extensions: https://www.coderabbit.ai/ide - I think the separate webpage exists for org level configurations and overviews. These “best practices” are probably defined on a team level to ensure everyone uses the same code-style and things like that

    I’m not sure if “just a website to copypaste code and get reviews” is really a good idea. Maybe for juniors that want to review one class or method or something. But usually code is spread across multiple files, and structural refactor opportunities are on a larger scale then just a couple files

  • Andrés@lile.cl
    link
    fedilink
    arrow-up
    2
    ·
    6 days ago

    @YUART what would be tje difference to do it with Zed or Avante (nvim) directly? I already ask sometimes to my editor for refactor a code. I also somtimes copy and paste it to Lumo (from proton)

    • YUART@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      6 days ago

      I believe those are tools that use general-purpose LLMs, which aren’t tuned for refactoring specifically. So I guess a specifically tuned tool for refactoring will beat those you mentioned in refactoring tasks.

      I also imagine a tool that is not AI-driven. While AI will be used for sure for some checks, I believe static checks and other “computable” heuristics will produce better output faster. I don’t want to throw a bunch of prompts into AI and sell mediocre-quality software to people.

      But overall, I think about what you said, but from another perspective - why have a separate webpage if such of helper can be built into IDE/editor? I think this is harder to do than to create a webpage, but maybe this will be better for users (developers).

      • Andrés@lile.cl
        link
        fedilink
        arrow-up
        3
        ·
        6 days ago

        @YUART yes too, i thibk will be hard to hace another tab just for that purpose. And for refactoring you must know what refactor, I mean, I know when a name is no the best or the code was repeated or a code produce a n+1 problem, so when I ask for refactor to an LLM I make a specific query and not just: refactor it

        • YUART@feddit.orgOP
          link
          fedilink
          English
          arrow-up
          2
          arrow-down
          1
          ·
          5 days ago

          That’s true, and that’s a hard part. I have some ideas on how to solve that problem, but I can’t prove anything because this is the first time I’m working on a helper like that one.

          That’s also the reason why I decided to ask people - there is no point in engaging in complex problem-solving, like for that tool, to only find out that no one actually needs it