File tree 2 files changed +60
-1
lines changed
2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1
1
var Plugin = require ( '../plugin' ) ;
2
2
3
- // config: None
3
+ // [prerequisite]
4
+ //
5
+ // [config]
6
+ //
4
7
var plugin = new Plugin ( 100 , 'company' , '2017.07.25' ,
5
8
'Plugin to query by company for free user.' ) ;
6
9
Original file line number Diff line number Diff line change
1
+ var cp = require ( 'child_process' ) ;
2
+
3
+ var log = require ( '../log' ) ;
4
+ var Plugin = require ( '../plugin' ) ;
5
+
6
+ // [prerequisite]
7
+ //
8
+ // Need install cpplint:
9
+ // https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py
10
+ //
11
+ // [config]
12
+ //
13
+ // You can disable/enable some checks in "flags" section.
14
+ //
15
+ // "PLUGINS": {
16
+ // "cpplint": {
17
+ // "bin": "<path of cpplint script>",
18
+ // "flags": [
19
+ // "-whitespace/indent",
20
+ // <other flags>
21
+ // ]
22
+ // }
23
+ // }
24
+ var plugin = new Plugin ( 100 , 'cpplint' , '2017.07.25' ,
25
+ 'Plugin to do static code check on c++ code.' ) ;
26
+
27
+ var DEFAULT_FLAGS = [
28
+ '-legal/copyright' ,
29
+ '-build/include_what_you_use'
30
+ ] ;
31
+
32
+ plugin . testProblem = function ( problem , cb ) {
33
+ var flags = DEFAULT_FLAGS . concat ( plugin . config . flags || [ ] ) ;
34
+
35
+ var cmd = [
36
+ plugin . config . bin ,
37
+ '--filter=' + flags . join ( ',' ) ,
38
+ problem . file
39
+ ] . join ( ' ' ) ;
40
+
41
+ log . info ( '\nRunning cpplint ...' ) ;
42
+ log . debug ( cmd ) ;
43
+ log . info ( ) ;
44
+
45
+ cp . exec ( cmd , function ( e , stdout , stderr ) {
46
+ if ( e ) {
47
+ stderr . split ( '\n' ) . forEach ( function ( line ) {
48
+ if ( line . length > 0 ) log . error ( line ) ;
49
+ } ) ;
50
+ } else {
51
+ plugin . next . testProblem ( problem , cb ) ;
52
+ }
53
+ } ) ;
54
+ } ;
55
+
56
+ module . exports = plugin ;
You can’t perform that action at this time.
0 commit comments