Skip to content

Replace Uncrustify with ClangFormat for C code formatting #562

Closed

Description

@botirkhaltaev

Feature Request: Replace Uncrustify with ClangFormat for C code formatting

Is your feature request related to a problem? Please describe.

Currently, our repository uses Uncrustify for C code formatting. This creates friction for developers using Language Server Protocol (LSP) tools since ClangFormat has better native integration with modern IDEs and code editors. LSP users cannot easily make formatting changes or see formatting issues in real-time, reducing productivity and code quality.

Describe the solution you'd like

Replace Uncrustify with ClangFormat as our C code formatter. This would involve:

  1. Creating a .clang-format file that matches our current style guidelines
  2. Updating documentation to reflect the change

Additional information

ClangFormat offers several advantages over Uncrustify:

  • Better LSP Integration: ClangFormat is natively supported by most C/C++ language servers
  • Wider Adoption: More developers are familiar with ClangFormat configuration
  • Active Development: ClangFormat is actively maintained as part of the LLVM project
  • Consistency: Many other C/C++ projects use ClangFormat, making it easier for contributors

We could start with a .clang-format file that closely matches our current style to minimize disruption, while providing better tooling support for all developers. This change would particularly benefit those using VS Code, Vim/Neovim, Emacs, and other editors with LSP support.

Activity

  1. jesperpedersen commented on Apr 2, 2025

    @jesperpedersen
    Member

    Ok, but not "closely"

  2. botirkhaltaev commented on Apr 2, 2025

    @botirkhaltaev
    ContributorAuthor

    Ok, but not "closely"

    Right, I should have reworded that; let's say exactly. Additionally, we can extend this to our yml files and other repos, e.g. pgexporter, if we can successfully attempt in this one.

  3. jesperpedersen commented on Apr 2, 2025

    @jesperpedersen
    Member

    Yes

  4. added a commit that references this issue on Jun 15, 2025
  5. added a commit that references this issue on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions