Giter VIP home page Giter VIP logo

flycheck / flycheck Goto Github PK

View Code? Open in Web Editor NEW
2.4K 2.4K 446.0 21.37 MB

On the fly syntax checking for GNU Emacs

Home Page: https://www.flycheck.org

License: GNU General Public License v3.0

Emacs Lisp 98.08% Python 0.90% Haskell 0.04% Ada 0.04% C 0.02% C++ 0.05% Ruby 0.09% CoffeeScript 0.02% CSS 0.02% D 0.06% Erlang 0.17% HTML 0.03% Fortran 0.05% Go 0.17% JavaScript 0.04% Lua 0.04% Perl 0.04% PHP 0.08% Puppet 0.05% R 0.02%
emacs flycheck syntax-checking

flycheck's Introduction

Flycheck

License GPL 3 Join the chat MELPA MELPA stable version NonGNU ELPA CI Docs Lint Python

https://www.flycheck.org

Modern on-the-fly syntax checking extension for GNU Emacs. Try it!

Getting Started

Flycheck is available for installation with package.el on NonGNU ELPA, MELPA Stable and MELPA.

You can install Flycheck with the following command:

M-x package-install [RET] flycheck [RET]

Finally add this to your Emacs config:

(global-flycheck-mode +1)

Alternatively, if you're into use-package you can do the following:

(use-package flycheck
  :ensure t
  :config
  (add-hook 'after-init-hook #'global-flycheck-mode))

Now you can start using any of the bundled checkers or install additional checkers.

For a more gentle introduction read the Installation instructions and go through Quickstart guide.

Getting Help

Please ask questions about Flycheck on Stack Exchange or in our Gitter chat, and report bugs to our issue tracker.

Contributing

We welcome all kinds of contributions, whether you write patches, open pull requests, write documentation, help others with Flycheck issues, or just tell other people about your experiences with Flycheck. Please take a look at our Contributor’s Guide for help and guidance about contributing to Flycheck.

Sponsoring

You can support financially the development of Flycheck and related packages via:

Open Collective Backers

Open Collective Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Code of Conduct

We strive to create a safe, friendly and welcoming environment in the Flycheck community and have a Code of Conduct that defines acceptable and welcome behaviour as well as sanctions for violations. All contributors and all participants are expected to follow it, on Github, Gitter, Emacs.SX or any other place that’s part of Flycheck’s broader community.

License

Flycheck is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Flycheck is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

flycheck's People

Contributors

amorymeltzer avatar bbatsov avatar celeritascelery avatar cpitclaudel avatar cybershadow avatar dholm avatar dominikh avatar donkopotamus avatar eyal0 avatar fanael avatar fmdkdd avatar gastove avatar jcs090218 avatar marsam avatar mineo avatar mpolden avatar phst avatar ptrv avatar purcell avatar rski avatar s3bs avatar scop avatar sergv avatar simplify avatar spwhitton avatar swsnr avatar wyuenho avatar yasuyk avatar yzprofile avatar zonuexe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flycheck's Issues

Remember last checker

Introduce flycheck-last-checker to remember the last checker in flycheck-get-checker.

Jump to error

Add commands to jump forwards/backwards between errors.

Chaining checkers

Chaining of checkers

Enable chaining of checkers, i.e. execute checker A after checker B.

Rationale

Sometimes its useful to apply use more than one checkers to a buffer. For instance, in Haskell one'd like to first check for syntax error using ghc, and afterwards check for style errors with hslint.

Interface

Add property :next-checker. The property is a list, where each item is either a checker symbol or a cons cell (PREDICATE . SYMBOL). PREDICATE determines when to run the checker, SYMBOL refers to the checker to run. PREDICATE may be one of

  • no-errors: Run only if the current checker gave no errors at all.
  • warnings-only: Run if the current checker gave warnings only.

The second element is a checker symbol.

Example

(defvar flycheck-checker-haskell-ghc
   '(:command
     ...
     :next-checker
     ((only-warnings . flycheck-checker-hslint))))

Implementation

TBD.

Status

Planning.

No error on syntax error

The python checkers do no mark an error when there are syntax error on the python file. However, the underlying commands (pylint, pyflakes, etc) do report the error.

Example:

prin t "hello"

Can't flycheck .el.gz files

When enabling flycheck in emacs-lisp-mode, it will inevitably be enabled when browsing core library code, which is compressed.

Here's what happens if I have enabled flycheck in, say, "ido.el.gz":

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  jka-compr-write-region("" nil "/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/flymake27516f8S.gz" nil silent)
  apply(jka-compr-write-region ("" nil "/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/flymake27516f8S.gz" nil silent))
  jka-compr-handler(write-region "" nil "/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/flymake27516f8S.gz" nil silent)
  write-region("" nil "/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/flymake27516f8S.gz" nil silent nil excl)
  byte-code("<elided>" [prefix temporary-file-directory file suffix dir-flag make-temp-name zerop file-name-as-directory expand-file-name make-directory write-region "" nil silent excl] 8)
  make-temp-file("flymake" nil ".gz")
  flycheck-create-temp-system("/Applications/Emacs.app/Contents/Resources/lisp/ido.el.gz" "flymake")
  flymake-init-create-temp-buffer-copy(flycheck-create-temp-system)
  flycheck-substitute-argument(source)
  mapcar(flycheck-substitute-argument ("/Applications/Emacs.app/Contents/MacOS/Emacs" "--no-site-file" "--no-site-lisp" "--batch" "--eval" "\n(progn (setq byte-compile-dest-file-function (quote make-temp-file)) (dolist (file command-line-args-left) (byte-compile-file file)))\n" source))
  flycheck-get-substituted-command((:command ("/Applications/Emacs.app/Contents/MacOS/Emacs" "--no-site-file" "--no-site-lisp" "--batch" "--eval" "\n(progn (setq byte-compile-dest-file-function (quote make-temp-file)) (dolist (file command-line-args-left) (byte-compile-file file)))\n" source) :modes emacs-lisp-mode))
  flycheck-init-checker((:command ("/Applications/Emacs.app/Contents/MacOS/Emacs" "--no-site-file" "--no-site-lisp" "--batch" "--eval" "\n(progn (setq byte-compile-dest-file-function (quote make-temp-file)) (dolist (file command-line-args-left) (byte-compile-file file)))\n" source) :modes emacs-lisp-mode))
  byte-code("<elided>" [flycheck-checkers checker --dolist-tail-- properties nil flycheck-get-checker-properties flymake-log 3 "Trying checker %S with properties %S" flycheck-may-use-checker throw --cl-block-nil-- flycheck-init-checker] 6)
  flycheck-init()

I guess that the ".gz" extension for the temp file messes things up.

Add a secondary highlight for column-based highlighting

When highlighting just the error column, I'd still like to the see the error line with a very light-pink background. So, I would like there to be two error faces, but only one of them would be used in non-column highlighting mode.

Use multi checker for one mode.

Some modes have multiple checkers. For instance python-mode has three checkers using flake8,
pylint~or ~pyflakes. When doing syntax checking in python-mode, the checkers are tried in this order > and the first whose executable is found is used.

I want to use flake8 with pylint when editing a python file. According to your documentation, perhap it's impossible to do this.

I think it's a really useful features if you can implement it.

Add Haskell checker

Add checkers for Haskell.

Check Haskell buffers for syntax errors first, using ghc, and afterwards check for style errors with hslint.

Depends on #31.

Lisp error: (void-variable let)

Just downloaded snapshot of today, the I got the following error when tried to enable flycheck-mode in python-mode.

Debugger entered--Lisp error: (void-variable let)
  (cond ((string= directory "/") (when (file-exists-p full-path) full-path)) ((file-exists-p full-path) full-path) (let ((parent-directory (file-name-directory (directory-file-name (file-name-directory full-path))))) ((flycheck-find-file-in-tree filename parent-directory))))
  (let ((full-path (expand-file-name filename directory))) (cond ((string= directory "/") (when (file-exists-p full-path) full-path)) ((file-exists-p full-path) full-path) (let ((parent-directory (file-name-directory (directory-file-name (file-name-directory full-path))))) ((flycheck-find-file-in-tree filename parent-directory)))))
  flycheck-find-file-in-tree(".jshintrc" "e:/Python/nova-2011.2/nova/")

Seems (let .... should be (t (let .... here.

But another couple of problems:

  1. why .jshintrc would be searched for python-mode?
  2. (after fixing the let problem) on windows, flycheck-find-file-in-tree would run into end-less recursion. I think (string= directory (file-name-directory directory)) is a better exit than (string directory "/")

Globalize flycheck-mode

Make flycheck-mode global (see define-globalized-minor-mode and :global keyword).

Allows to enable flycheck-mode in all buffers regardless of visit-file-hook.

Requirements

  • Search suitable syntax checker immediately after enabling the mode.
  • Disable the mode if no syntax checker is available.

Advantages

  • Unified setup for all kinds of buffers, including temporary buffers without backing files.

Disadvantages

  • Syntax checking is enabled for all sorts of buffers, even if it doesn't make any sense at all (.e.g help buffers, customize buffers, etc.).

initialize message shows some warning?

I have used emacs V24.3.50.1 in mac 10.8.2 installed by :brew install emacs --cocoa --use-git-head.and configuration cloned from bbatsov/prelude master code.

When Emacs started, message buffer shows some warning like:

Checker emacs-lisp-checkdoc returned non-zero exit code 255, but no errors fromoutput: 


Args out of range: "", 1
*** #<buffer  *temp*>: checkdoc-current-buffer V 0.6.1
Checker definition probably flawed.

I am not sure where is wrong, @bbatsov deem: Seems like an upstream bug in flycheck. so i report issue here.

Error with temp buffers

When I add flycheck-mode as hook,
(add-hook 'LaTeX-mode-hook 'flycheck-mode)
and creating a temp buffer (i.e. when using org-mode export temp buffer)
flycheck returns an error
flycheck-find-file-for-buffer: Wrong type argument: stringp, nil

Happens also with other checkers, like html.

In temp buffers filename is nil, so functions like
flycheck-find-file-for-buffer and flycheck-create-temp-system
don't work properly when buffer is temp buffer.

Back to markdown

Use markdown for README and CONTRIBUTING, because Org formatting is really broken on Github.

Allow all details to be computed programmatically

For example, xmllint outputs the following:

environment.plist:5: parser error : expected '>'
    <key>MAVEN_OPTS</keyx>
                        ^

In a case like this, I can't find the column number using just a regexp, but I can find it programmatically by counting the number of spaces before the caret on the third line.

Also, since there is no newline between these error message, I need some way to be able to walk through the buffer around the point of match, and then back-track to the position where the next regexp match should resume from.

Add checkdoc checker.

Add checker for Emacs Lisp calling (checkdoc-current-buffer t) in an Emacs subprocess.

Use checker chaining #31 to call this checker after the standard Emacs Lisp.

Support jshint

flycheck is awesome plugin for emacs. I am writing javascript with jshint, which has so many features. Could support jshint to flycheck.

Stop error-pattern matching on first match

Currently each error line is matched against each error-pattern defined in the checker. When customizing checkers, it could be useful if the matching stops at the first error-pattern matched (similar to how url routers work in most web frameworks). This facilitates writing certain patterns: suppose I want flake8 warnings with a code > 800 to show as a flycheck error. I would have to write code like the one below. Note that the last error-pattern has to specifically avoid matching the previous one, otherwise the flake8 warning will be marked twice as a flycheck warning and as an flycheck error.

(flycheck-declare-checker my-python-flycheck-checker
  "my-python-flycheck-checker"
  :command '("flake8" "--max-complexity=12" source)
  :error-patterns
'(("^\\(?1:.*\\):\\(?2:[0-9]+\\): \\(?4:[[:alpha:]]\\{2\\}.*\\)$" error)
  ("^\\(?1:.*?\\):\\(?2:[0-9]+\\):\\(?:\\(?3:[0-9]*\\):?\\) \\(?4:E[0-9]+.*\\)$" error)
    ("^\\(?1:.*?\\):\\(?2:[0-9]+\\):\\(?:\\(?3:[0-9]*\\):?\\) \\(?4:W8.*\\)$" error)
    ("^\\(?1:.*?\\):\\(?2:[0-9]+\\):\\(?:\\(?3:[0-9]*\\):?\\) \\(?4:W[^8].*\\)$" warning)
    )
  :modes 'python-mode)

Viewing error message with flycheck

I installed flycheck and tried it out with some python files. I can see errors and warnings highlighted, but cant see the actual message anywhere. I'm most likely doing something wrong, but any pointers would be appreciated.

0.5 fringe overlay doesn't work well with linum-mode and flymake on Emacs HEAD

This is the behavior for 0.4, as you can see the error indicator works quite well with the fringe linum-mode added on the left. The error indicator is also put in the right place:

0.4 Screen Shot

This is what happens for 0.5:

0.5 Screen Shot

In addition to the error indicator added a new column to the error lines, the error lines also don't get the flymake-errline face unless turn off and then turn on flycheck-mode again.

interference with package.el installation

flycheck is active in the buffers that are created during package installation. This is causing an error with the sentinel selecting a deleted buffer. I reinstalled flycheck using the repository using version
flycheck-20130127.1807

disabling flycheck fixes the issue.

Allow buffer-local checker selection

Allow to select a specific checker per buffer.

Introduce a buffer-local variable flycheck-checker. The value of this variable is either:

  • a checker symbol
  • or a checker definition

If set this checker is directly used and the standard checker discovery is skipped. If the checker cannot be used, emit a warning and do not perform a syntax check at all.

Make collapsing of whitespace optional

For Haskell, collapsing whitespace makes certain diagnostics almost impossible to read. I fixed this locally with:

(defalias 's-collapse-whitespace 'identity)

It would be nice if this could be configured per-checker.

Symbol's function definition is void: condition-case-unless-debug

Hi there!

I'm using Emacs 23.3.50.1 (Aquamacs 2.4) and installed Flycheck via MELPA and getting the following error when launching flycheck-mode:

error in process sentinal: Symbol's function definition is void: condition-case-unless-debug

Here is my config:

(require 'flycheck)
(add-hook 'ruby-mode-hook 'flycheck-mode)

Any idea what could be causing this?

Thanks,
Matt

Support for multiline error messages

Add support for multiline error messages, required by Emacs Lisp and probably others.

May likely require large flymake hacking, because currently flymake processes output on the fly and thus may attempt to parse incomplete messages.

Probably add :parser keyword to provide a function for parsing error messages.

Missing function define-fringe-bitmap

Some Prelude users are getting the following error:

Warning (initialization): An error occurred while loading `/Users/akshatpradhan/.emacs.d/init.el':                                   

Symbol's function definition is void: define-fringe-bitmap                                                                           

To ensure normal operation, you should investigate and remove the                                                                    
cause of the error in your initialization file.  Start Emacs with                                                                    
the `--debug-init' option to view a complete error backtrace.  

More details here bbatsov/prelude#231 (comment)

Oddly enough I'm using the same Emacs 24.2 and flycheck works for me (meaning I have the define-fringe-bitmap function. I wonder if its a compilation flag problem or something like that.

Strange errors on Emacs startup with flycheck enabled

I really like flycheck and decided to include it by default in Emacs Prelude, but some very strange problem appeared afterwards. On Emacs startup I get infinite number of the following errors:

Buffer " Compiler Input" has a running process; kill it ?

and

error in process sentinel : Selecting deleted buffer

More details here - bbatsov/prelude#248

flycheck seems to interfere with the byte-code compiler when enabled in prog-mode for some reason. Any ideas what might be causing the problem?

parsing bug with phpcs checker

When updating to the latest head for the past few days, I have been getting this parsing error with the phpcs checker turned on in php-mode:

https://gist.github.com/4694396

I was using the phpcs checker fine last week.

The error goes away if I revert to this earlier commit.

3d98781 * Inhibit checkdoc in autoload source buffers [#45]

Let me know if I can provide more information about this possible bug.

Indicator display error

This is how indicator displayed at here:

 2013-01-06 5 34 17

flycheck-error-indicator's default value is "\240"

 2013-01-06 5 42 43

Add PHP CodeSniffer checker

I tried to implement the checker. This works for me in .emacs:

(flycheck-declare-checker phpcs
  "A PHP syntax checker using the PHP_CodeSniffer.

See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
  :command '("phpcs" "--report=emacs" source)
  :error-patterns
  '(("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): error - \\(?4:.*\\)" error)
    ("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): warning - \\(?4:.*\\)" warning))
  :modes '(php-mode php+-mode)
  :next-checkers '(php))
(add-to-list 'flycheck-checkers 'phpcs)

Feel free to use it...

Reporting no errors eventhough there are errors

I am using a custom syntax check tool and flycheck runs fine and finds:

... error C2143: syntax error : missing ';' before 'return'', got line-err-info

However, when the syntax check exits, flycheck seems to have lost the error:

0 error(s), 0 warning(s), 0 info in 1.15 second(s)

which results in a CFGERR?

The reason for this is that

(when (flymake-same-files real-file-name source-file-name)

fails since real-file-name has "_flymake" appended to it (I use source-inplace).

Info manual for Flycheck

Would an Info manual be useful for Flycheck?

Opinions?

Largely replace the README with a proper Info manual.

The README will only contain a short introduction, installation and usage information, and the credits as well as the license blurp. No information on customization and extending will remain.

Advantages

  • Online help within Emacs
  • Cross-references from docstrings

Disadvantages

  • Crude markup (not so crude actually)
  • Little to no tool support
  • No Github rendering
  • Unfancy HTML rendering like from the 90s

Status

Writing of an Info manual has begun in the info-manual branch.

Remaining chapters

  • Introduction
  • Usage
  • Customization
  • Extending
  • Further help
  • Credits
  • Index

Other tasks

  • Write Generate top level dir file.
  • Update the MELPA recipe to include the info file and dir file.
  • Implement automatic Marmalade packaging.

Remove the icon at beginning of line

flycheck

I really hate the icon at the beginning of a warning or error line.
It's messed up my format. Is warning and error face is not enough?

Please tell me the way to remove it.

Parse errors with a given function

Enable parsing of errors with a function specified in the checker declaration.

Interface

(defun my-cool-checker-parse-output (properties buffer output) …)

(defvar my-cool-checker
   '(…
    :error-parse-function 'my-cool-checker-parse-output)

The function my-cool-checker-parse-output is expected to return a list of flycheck-error objects.

Rationale

Some checking tools can print errors in some structured output format like XML or JSON (.e.g coffeelint or jshint). Parsing structured output directly into error objects is more reliable than throwing regular expressions onto human-readable output.

Code for displaying huge diagnostics in a separate window

I'm using this code right now to good effect:

(defun my-flycheck-show-error-in-window ()
  (interactive)
  (flycheck-cancel-error-display-timer)
  (when flycheck-mode
    (let ((buf (get-buffer-create "*Flycheck Info*"))
          (message (car (flycheck-overlay-messages-at (point)))))
      (with-current-buffer buf
        (delete-region (point-min) (point-max))
        (insert message))
      (display-buffer buf)
      (fit-window-to-buffer (get-buffer-window buf)))))

(defun flycheck-show-error-at-point ()
  "Show the first error message at point in minibuffer."
  (interactive)
  (flycheck-cancel-error-display-timer)
  (when flycheck-mode
    (if (flycheck-may-show-message)
        (let* ((buf (get-buffer-create "*Flycheck Info*"))
               (wind (get-buffer-window buf))
               (message (car (flycheck-overlay-messages-at (point)))))
          (if message
              (if (> (length (split-string message "\n")) 8)
                  (my-flycheck-show-error-in-window)
                (if wind (delete-window wind))
                (message "%s" message))
            (message nil)))
      ;; Try again if the minibuffer is busy at the moment
      (flycheck-show-error-at-point-soon))))

Wrong warning face

emacs

As you can see from screenshot, flycheck show me that line has a warning, but use flymake-errline face to indicate it.
Is this a bug?

In addition for that, https://github.com/illusori/emacs-flymake has a useful feature.

Error messages from the syntax checker can now be classed as info messages in addition or error and warning, and there's a new face to highlight info messages in: flymake-infoline

Do you think it's a good feature to adopt?

Flycheck in Tramp freezes Emacs

When editing a file over ssh with tramp, emacs stops responsing and wont work before kiling ssh process under emacs.

I think it tries to run syntax checker on remote which is not installed.

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.