| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library error_formatter; | 5 library error_formatter; |
| 6 | 6 |
| 7 import 'package:analyzer/src/analyzer_impl.dart'; | 7 import 'package:analyzer/src/analyzer_impl.dart'; |
| 8 | 8 |
| 9 import '../options.dart'; | 9 import '../options.dart'; |
| 10 import 'generated/engine.dart'; | 10 import 'generated/engine.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 out.write('|'); | 49 out.write('|'); |
| 50 out.write(location.lineNumber); | 50 out.write(location.lineNumber); |
| 51 out.write('|'); | 51 out.write('|'); |
| 52 out.write(location.columnNumber); | 52 out.write(location.columnNumber); |
| 53 out.write('|'); | 53 out.write('|'); |
| 54 out.write(length); | 54 out.write(length); |
| 55 out.write('|'); | 55 out.write('|'); |
| 56 out.write(escapePipe(error.message)); | 56 out.write(escapePipe(error.message)); |
| 57 } else { | 57 } else { |
| 58 String errorType = severity.displayName; | 58 String errorType = severity.displayName; |
| 59 if (error.errorCode.type == ErrorType.HINT) { | 59 if (error.errorCode.type == ErrorType.HINT || |
| 60 error.errorCode.type == ErrorType.LINT) { |
| 60 errorType = error.errorCode.type.displayName; | 61 errorType = error.errorCode.type.displayName; |
| 61 } | 62 } |
| 62 // [warning] 'foo' is not a... (/Users/.../tmp/foo.dart, line 1, col 2) | 63 // [warning] 'foo' is not a... (/Users/.../tmp/foo.dart, line 1, col 2) |
| 63 out.write('[$errorType] ${error.message} '); | 64 out.write('[$errorType] ${error.message} '); |
| 64 out.write('(${source.fullName}'); | 65 out.write('(${source.fullName}'); |
| 65 out.write(', line ${location.lineNumber}, col ${location.columnNumber})'); | 66 out.write(', line ${location.lineNumber}, col ${location.columnNumber})'); |
| 66 } | 67 } |
| 67 out.writeln(); | 68 out.writeln(); |
| 68 } | 69 } |
| 69 | 70 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 193 } |
| 193 | 194 |
| 194 static String pluralize(String word, int count) { | 195 static String pluralize(String word, int count) { |
| 195 if (count == 1) { | 196 if (count == 1) { |
| 196 return word; | 197 return word; |
| 197 } else { | 198 } else { |
| 198 return word + "s"; | 199 return word + "s"; |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 } | 202 } |
| OLD | NEW |