flymake-google-cpplint-filter or linelength does not seem to take hold on my emacs file

760 Views Asked by At

I have the following packages installed in emacs 24 flymake-google-cpplint is an installed package.

 Status: Installed in `/home/myname/.emacs.d/elpa/flymake-google-cpplint-20140205.525/'.
Version: 20140205.525

and in my emacs I have the following,

; start flymake-google-cpplint-load
; let's define a function for flymake initialization
(defun my:flymake-google-init () 
  (require 'flymake-google-cpplint)
  (custom-set-variables
   '(flymake-google-cpplint-command "/usr/local/bin/cpplint")
   '(flymake-google-cpplint-verbose "3")
   '(flymake-google-cpplint-linelength "120")
   '(flymake-googlelint-filter "-whitespace/line_length"))
  (flymake-google-cpplint-load)
)
(add-hook 'c-mode-hook 'my:flymake-google-init)
(add-hook 'c++-mode-hook 'my:flymake-google-init)

The google-cpplint runs fine, but stead of filtering out the whitespace/line_length, cpplint still messages on long lines, and on lines greater than 80 characters it also warns; though I set it up to warn at 120 characters.

I have restarted emacs bunch of times. and also tried M-X load-file RET and loaded ~/.emacs

Am I missing a step here. Do I need to change something in cpplint.py or flymake-google-cpplint.el to make the changes take effect? Thanks

2

There are 2 best solutions below

0
On

Shouldn't you replace:

9: '(flymake-googlelint-filter "-whitespace/line_length"))    

by

9: '(flymake-google-cpplint-filter "-whitespace/line_length"))

?

Reference: https://github.com/senda-akiha/flymake-google-cpplint/blob/master/flymake-google-cpplint.el

0
On

I had the same problem. My fix was to just edit the binary to call cpplint with the right flags. I added an executable file with:

#!/usr/bin/env bash
/usr/local/bin/cpplint --linelength=120 "$@"

as ~/.emacs.d/cpplint and referenced that from my ~/.emacs with

(defun my:google-cpp-lint-init ()
  (require 'flymake-google-cpplint)
  (custom-set-variables
   '(flymake-google-cpplint-command "~/.emacs.d/cpplint")
  )
  (flymake-google-cpplint-load)
)