refex VS Bear

Compare refex vs Bear and see what are their differences.

refex

A syntactically aware search-and-replace tool for Python. (by ssbr)

Bear

Bear is a tool that generates a compilation database for clang tooling. (by rizsotto)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
refex Bear
3 50
14 4,475
- -
5.0 5.7
7 months ago 7 days ago
Python C++
Apache License 2.0 GNU General Public License v3.0 only
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

refex

Posts with mentions or reviews of refex. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-22.
  • Writing and Linting Python at Scale
    4 projects | news.ycombinator.com | 22 Nov 2023
    As someone who worked on a similar tool (https://github.com/ssbr/refex/tree/main/refex/fix/fixers, I did a bunch of the work to prep this for open-sourcing, though I think all my contributions are hidden behind the "Google-internal" anonymization), having auto-applied or auto-appliable fixers like this is super useful.

    They can be auto-applied by post-commit (e.g. a generic `git fixcommit` style command that runs all the relevant lint tools and fixes them in the working copy, letting you review before push), or applied during code review (automatic comments with a "click here to apply fix" interface), both of which are nice.

    Plus the same underlying tooling can be used to write more complex one-off fixes that may be used for migrations or cleanups.

  • I learnt to use ASTs to patch 100,000s lines of python code
    2 projects | /r/Python | 5 Jun 2021
    You might like Refex, which automates AST transformations like this:
  • Semgrep: Like Grep but for Code
    12 projects | news.ycombinator.com | 22 Apr 2021
    There's lots of confusion about what semgrep does here, which is kind of unfortunate. I haven't touched it much, but I have built a very similar tool (I'm one of the contributors to refex[1], which is a very similar project).

    The starting point of semantic grep is very useful. When you have a big codebase, you often want to detect antipatterns, or not even antipatterns, but just uses of a thing, say you're renaming a method and want to track down the callers.

    Being able to act on the AST, instead of hoping you searched up all of the variants of whitespace and line breaks and, depending on the specific example, different uses of argument passing, is really useful.

    But often when you're semantically grepping, your goal is to replace something with something else (this is what refex was initially built for: to aide in large scale changes in python, as a sort of equivalent to the C++ tools that Google uses).

    But then you want to shift left even further: once you have a pattern that you want to replace once, you can just enforce that a linter yell at you when anyone does it again. So it's very natural to develop a linter-style thing on top of one of these[2].

    This is, as I understand it sort of the same thing that happens in C++: clang-tidy and clang-format are written on top of AST libraries that can be used for ad-hoc analysis and transformations, but you can also just plug them into a linter.

    The thing is, for most organizations, enforcing code style and best practices is more valuable than apply a refactoring to 10M lines of code, because most organizations don't have 10M lines of code to refactor. That doesn't mean that these tools aren't also useful for ad-hoc transforms and exploratory analysis. They absolutely are!

    [1]: https://github.com/ssbr/refex

    [2]: https://github.com/ssbr/refex/tree/main/refex/fix

Bear

Posts with mentions or reviews of Bear. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-06-17.
  • emacs lsp-mode with MPLAB X project
    1 project | /r/emacs | 30 Nov 2023
    Have you tried Bear? I used it for several projects and overall it works very well.
  • Eglot + clangd not working for NetHack code base
    3 projects | /r/emacs | 17 Jun 2023
    An update: I am now able to make everything work by generating `compile_commands.json` using compiledb. I'm aware that there is another tool Bear but for some reason it generates an empty `compile_commands.json` file for me.
  • I have an existing legacy build system. How do I leverage this with CLion to index my project?
    1 project | /r/cpp_questions | 1 Jun 2023
    Try https://github.com/rizsotto/Bear
  • New User C Setup Help?
    4 projects | /r/neovim | 24 May 2023
    Regarding the libraries, you might need to add it to clangd’s configuration. A convenient way is to have a compile_commands.json in your project (this is generated by some build tools like CMake, but if you don’t use them, have a look at bear).
  • vscode alternative for C++ on M1 mac?
    4 projects | /r/cpp | 15 May 2023
    Note that you need to have a compile_commands.json file. That file can easily be generated by CMake, Meson, etc. For other build systems checkout Bear https://github.com/rizsotto/Bear
  • I hope that cscope can make a comeback in the versions after 0.9
    2 projects | /r/neovim | 8 Apr 2023
    make a 'gcc' command/executable that do nothing and make it first in your PATH and then run bear with make: https://github.com/rizsotto/Bear/issues/219 It is unfortunate that bear doesn't catch the output of the make command with '--dry-run' as it still prints the compile commands, it seems not that hard to support this and I think many ppl would benefit..
  • CLion 2023.1 released
    1 project | /r/cpp | 29 Mar 2023
    You could try to start with Bear: https://github.com/rizsotto/Bear In worst cases, I had to use strace to catch every gcc/g++ invocation and restructure the compile_commands.json out of the strace logs.
  • Is CMake necessary to set up a C++ "IDE" in neovim?
    4 projects | /r/neovim | 17 Mar 2023
    But it sounds like maybe you’re assuming for the purposes of using something like clangd (highly recommended for coding in cpp projects in general, you want to be using this in vscode or whatever else anyway, codelion notwithstanding I suppose) with neovim on a c++ project that you have to use cmake to produce a compilation database to use with neovim plugins (e.g. clangd via nvim-lsp et. al.). In this case, be aware that the https://github.com/rizsotto/Bear tool is a handy way to just tack it on to whatever command you’re using to run a c++ code build step, and it will give you a compile_commands.json, corresponding to the compiler commands it invoked, on a silver platter.
  • Makefile versus CMake build system
    3 projects | /r/embedded | 8 Mar 2023
    I guess your questionmarks are about installing "bear", he refers to this project: https://github.com/rizsotto/Bear
  • how to use .clang-format with lunarvim ?
    1 project | /r/neovim | 8 Mar 2023
    You just simply go to the root of your project, use bear and just open your C files. That's all.

What are some alternatives?

When comparing refex and Bear you can also consider the following projects:

pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.

compiledb - Tool for generating Clang's JSON Compilation Database files for make-based build systems.

checkr - Custom static analysis rules for the lazy. Write project specific static analysis checks in a few lines of code.

vscode-cpptools - Official repository for the Microsoft C/C++ extension for VS Code.

tree-sitter-swift - Swift grammar for tree-sitter

NvChad - Blazing fast Neovim config providing solid defaults and a beautiful UI, enhancing your neovim experience.

ocaml-tree-sitter-semgrep - Generate parsers from tree-sitter grammars extended to support Semgrep patterns

scan-build - Clang's scan-build re-implementation in python

CCGrep - Code Clone Detector like grep

coc-clangd - clangd extension for coc.nvim

actions-preview.nvim - Fully customizable previewer for LSP code actions.

clangd - clangd language server