@@ -123,7 +123,7 @@ def quiet():
123
123
warning_count = 0
124
124
125
125
for issue in issues :
126
- if ( should_ignore (issue ['reason' ]) ):
126
+ if should_ignore (issue ['reason' ]):
127
127
continue
128
128
if issue ['isError' ]:
129
129
error_count += 1
@@ -152,7 +152,7 @@ def update_gutter_marks(issues):
152
152
marks = []
153
153
154
154
for item in issues :
155
- if ( should_ignore (item ['reason' ]) ):
155
+ if should_ignore (item ['reason' ]):
156
156
continue
157
157
msg = item ['reason' ]
158
158
if 'shortname' in item :
@@ -162,15 +162,24 @@ def update_gutter_marks(issues):
162
162
163
163
subprocess .call ([mate , '--clear-mark=warning' , file_path ])
164
164
165
- for mark in marks :
166
- subprocess .call (
167
- [
168
- mate ,
169
- '--set-mark=warning:[ESLint] {0}' .format (mark [0 ]),
170
- '--line={0}' .format (mark [1 ]),
171
- file_path
172
- ]
173
- )
165
+ # set the gutter marks 10 at a time to improve performance
166
+ # the choice of 10 is arbitrary -- enough to improve performance
167
+ # but shouldn’t cause the cmd line to be too long
168
+
169
+ def chunks (list_to_chunk , chunk_size ):
170
+ """
171
+ Yield successive chunk_size-sized chunks from list_to_chunk.
172
+ """
173
+ for i in xrange (0 , len (list_to_chunk ), chunk_size ):
174
+ yield list_to_chunk [i :i + chunk_size ]
175
+
176
+ for chunk in list (chunks (marks , 10 )):
177
+ args = [mate ]
178
+ for mark in chunk :
179
+ args .append ('--set-mark=warning:[ESLint] {0}' .format (mark [0 ]))
180
+ args .append ('--line={0}' .format (mark [1 ]))
181
+ args .append (file_path )
182
+ subprocess .call (args )
174
183
175
184
176
185
def fix ():
0 commit comments