Sarcasm / flycheck-irony

C, C++ and Objective-C support for Flycheck, using Irony Mode
56 stars 10 forks source link

Chain cppcheck #9

Open nickbroon opened 9 years ago

nickbroon commented 9 years ago

The flycheck build in clang and gcc checker both chain cppcheck checker. It would be nice if flycheck-irony also did this.

:next-checkers ((warning . c/c++-cppcheck)))

http://flycheck.readthedocs.org/en/0.22/dev/extending.html#applying-more-than-one-syntax-checker https://github.com/flycheck/flycheck/blob/master/flycheck.el#L5262

Sarcasm commented 9 years ago

Well, I don't understand why a checker will decide for the user what to chain. IMHO, a better API for flycheck would be the possibility to let the user decide of that, a bit like how company-mode let the users group backends.

nickbroon commented 9 years ago

True, but alas that's not currently the way flycheck works. It could also be argued that this is just case of setting up reasonable default chain of checkers for the user. At any rate I have the following in my .emacs file:

(with-eval-after-load 'flycheck
     (require 'flycheck-irony)
     (add-hook 'flycheck-mode-hook #'flycheck-irony-setup)
     (flycheck-add-next-checker 'irony '(warning . c/c++-cppcheck)))
Sarcasm commented 9 years ago

Well, your line is perfect no?

 (flycheck-add-next-checker 'irony '(warning . c/c++-cppcheck)))

Oh, nice to know about this way.

I may add some checkers in the future but only if there are related to irony/clang I think. But I think letting the user choose the next checkers is better. Because if I choose one checker for them but they want another one, I'm pretty sure it will require more work, I think users should opt-in, not opt-out.

nickbroon commented 9 years ago

I added the above to my .emacs so that the irony checker behaved the same as gcc and clang checkers.

I was just pointing out that the gcc and clang checkers that ship with flycheck both chain cppcheck by default, and that I thought that it would nice if the irony checker did the same. I guess that might be the least surprise for the user as the default behaviour would be the same across all 3 checkers. The user always has the ability to override the config if they wanted other behaviour.

So this not bug report, just a suggestion for consistent behaviour with the other C/C++ checkers.

raxod502 commented 7 years ago

Personally one of the things that I think is indicative of well-designed software is that it doesn't make me think. Flycheck and Magit are two packages that really satisfy that—they just work for pretty much all of my use cases with no configuration required, even though they let me customize things really extensively if you really need to. With Flycheck, I'm continually surprised by how it magically lints files in new languages without my needing to tell it to. So I think that having all the linters enabled by default is a really good idea, as it makes for a better user experience. Also, consistency is quite important, as @nickbroon pointed out.