roslint 1

find -regextype egrep -regex '.*\.[ch](pp)?$' -exec astyle '{}' --style=allman --indent=spaces=2 --pad-oper --unpad-paren --pad-header --convert-tabs \;

roslint error:

Single-parameter constructors should be marked explicit.  [runtime/explicit] [5]

So put explicit before these constructors in header files.

This adds a space after a comment:

s/\/\//\/\/ /

But how to correct only //foo to // foo? This detects that case:


So this is the combination for ‘Should have a space between // and comment’:

g/ \/\/[A-z]/ s/\/\//\/\/ /

Add space before comment after semicolon:

%s/; \/\//;  \/\//

Add space after bracket:

g/\S\/\// s/\/\//  \/\//
g/\S \/\// s/\/\// \/\//

Move ) to preceding line:

%s/\n \+)/)/

Find instances of ‘Redundant blank line’:

/^\n \+}/
/{\n^\n \+/

(How to match zero or more whitespaces?)

Look for lines >= 120 characters ‘Lines shoule be <= 120 characters long [whitespace/line_length]’:


In vimrc:

" highlight long lines
au BufRead,BufNewFile * syntax match Search /\%<121v.\%>111v/
au BufRead,BufNewFile * syntax match ErrorMsg /\%>120v.\+/

‘Line ends in whitespace’ Eliminate trailing white space (astyle should take care of this):


Type 80| to jump to 80th column.

‘Do not use namespace using-directives. Use using-declarations instead’. Change using namespace std; to using std::string etc., or replace all instances of string to std::string.

Visual select, then :sort and the [lines will be alphabetized] (

Written on December 4, 2015