kumar8600 / flycheck-clangcheck

A Flycheck checker difinition for ClangCheck.
11 stars 7 forks source link

+AUTHOR: kumar8600

+LANGUAGE: en

[[http://melpa.org/#/flycheck-clangcheck][file:http://melpa.org/packages/flycheck-clangcheck-badge.svg]]

A [[https://github.com/flycheck/flycheck][Flycheck]] checker difinition for [[http://clang.llvm.org/docs/ClangCheck.html][ClangCheck]].

** Installation

*** Prerequisites

- clang-check (this is part of clang.)

*** Setup

1. Install:

  MELPA:

    [[http://melpa.org/#/flycheck-clangcheck][file:http://melpa.org/packages/flycheck-clangcheck-badge.svg]]

  or clone this repository:

   : $ git clone https://github.com/kumar8600/flycheck-clangcheck

2. Add settings for =~/.emacs.d/init.el=:

   #+BEGIN_SRC emacs-lisp
     (add-to-list 'load-path "/path/to/flycheck-clangcheck") ;; if you installed manually
     (require 'flycheck-clangcheck)

     (defun my-select-clangcheck-for-checker ()
       "Select clang-check for flycheck's checker."
       (flycheck-set-checker-executable 'c/c++-clangcheck
                                        "/path/to/clang-check")
       (flycheck-select-checker 'c/c++-clangcheck))

     (add-hook 'c-mode-hook #'my-select-clangcheck-for-checker)
     (add-hook 'c++-mode-hook #'my-select-clangcheck-for-checker)

     ;; enable static analysis
     (setq flycheck-clangcheck-analyze t)
   #+END_SRC

*** Customizable variables

- =flycheck-clangcheck-analyze= :: Whether to enable Static Analysis to C/C++ in ClangCheck.

- =flycheck-clangcheck-extra-arg= :: Additional argument to append to the compiler command line for ClangCheck.

- =flycheck-clangcheck-extra-arg-before= :: Additional argument to prepend to the compiler command line for ClangCheck.

- =flycheck-clangcheck-fatal-assembler-warnings= :: Whether to enable Considering warning as error to C/C++ in ClangCheck.

- =flycheck-clangcheck-dbname= :: The name of the [[http://clang.llvm.org/docs/JSONCompilationDatabase.html][JSON Compilation Database]] (default =compile_commands.json=).

- =flycheck-clangcheck-build-path= :: Build directory for ClangCheck. If this is defined, a [[http://clang.llvm.org/docs/JSONCompilationDatabase.html][JSON Compilation Database]] (=flycheck-clangcheck-dbname=) must be placed to there.