Giter Club home page Giter Club logo

flycheck-clang-tidy's Introduction

flycheck-clang-tidy

Flycheck syntax checker using clang-tidy

This library provides a flycheck checker for C/C++ source code using clang-tidy.

Installation

You'll need Emacs 24 for flycheck, so the recommended way to get flycheck-clang-tidy is as a package from the MELPA repository.

Alternatively you have to ensure flycheck is installed, then download this code and add the directory to your Emacs load-path.

Then, in your init.el:

(eval-after-load 'flycheck
  '(add-hook 'flycheck-mode-hook #'flycheck-clang-tidy-setup))

Or, if you use use-package:

(use-package flycheck-clang-tidy
  :after flycheck
  :hook
  (flycheck-mode . flycheck-clang-tidy-setup)
  )

Make sure that the clang-tidy binary is present on Emacs' exec-path, or customize flycheck-clang-tidy-executable to point to the clang-tidy binary.

Usage

When flycheck is enabled (e.g. with global-flycheck-mode), c-mode and c++-mode buffers will be automatically checked using this checker.

To have clang-tidy work correctly, you usally require a compile command database as described in clang-tidy --help. For example using CMake a file named compile_commands.json can be created using -DCMAKE_EXPORT_COMPILE_COMMANDS=ON. flycheck-clang-tidy then looks for this file via variable flycheck-clang-tidy-build-path which defaults to build.

You can pass additional options to clang-tidy using the variable flycheck-clang-tidy-extra-options.

This checker includes an error explainer. Invoking flycheck-explain-error-at-point will search clang.llvm.org for the documentation of the clang-tidy check under point and render the result HTML in a Help buffer. This requires that Emacs is compiled with XML support.

Other solutions

If you use lsp-mode with clangd 9.0 or above, you can use the embedded clang-tidy by adding --clang-tidy to lsp-clients-clangd-args.

flycheck-clang-tidy's People

Contributors

canatella avatar ch1bo avatar cipibad avatar danielmartin avatar tastytea avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.