|
3 | 3 | // found in the LICENSE file. |
4 | 4 |
|
5 | 5 | import 'dart:convert' show LineSplitter, jsonDecode; |
6 | | -import 'dart:io' as io show File, stderr, stdout; |
| 6 | +import 'dart:io' as io show Directory, File, stderr, stdout; |
7 | 7 |
|
8 | 8 | import 'package:meta/meta.dart'; |
9 | 9 | import 'package:path/path.dart' as path; |
@@ -161,10 +161,20 @@ class ClangTidy { |
161 | 161 | ); |
162 | 162 | } |
163 | 163 |
|
| 164 | + io.File? configPath = options.configPath; |
| 165 | + io.Directory? rewriteDir; |
| 166 | + if (configPath != null && options.excludeSlowChecks) { |
| 167 | + configPath = _createClangTidyConfigExcludingSlowLints(configPath); |
| 168 | + rewriteDir = io.Directory(path.dirname(configPath.path)); |
| 169 | + } |
164 | 170 | final _ComputeJobsResult computeJobsResult = await _computeJobs( |
165 | 171 | changedFileBuildCommands, |
166 | 172 | options, |
| 173 | + configPath, |
167 | 174 | ); |
| 175 | + if (rewriteDir != null) { |
| 176 | + rewriteDir.deleteSync(recursive: true); |
| 177 | + } |
168 | 178 | final int computeResult = computeJobsResult.sawMalformed ? 1 : 0; |
169 | 179 | final List<WorkerJob> jobs = computeJobsResult.jobs; |
170 | 180 |
|
@@ -298,11 +308,8 @@ class ClangTidy { |
298 | 308 | Future<_ComputeJobsResult> _computeJobs( |
299 | 309 | List<Command> commands, |
300 | 310 | Options options, |
| 311 | + io.File? configPath, |
301 | 312 | ) async { |
302 | | - io.File? configPath = options.configPath; |
303 | | - if (configPath != null && options.excludeSlowChecks) { |
304 | | - configPath = _createClangTidyConfigExcludingSlowLints(configPath); |
305 | | - } |
306 | 313 | bool sawMalformed = false; |
307 | 314 | final List<WorkerJob> jobs = <WorkerJob>[]; |
308 | 315 | for (final Command command in commands) { |
|
0 commit comments