Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 3670875

Browse files
kevmoomkustermann
authored andcommitted
Travis ci (#8)
* Fix analysis options * Add travis-ci file * dartfmt
1 parent 96c0d26 commit 3670875

10 files changed

+1168
-1037
lines changed

.analysis_options

Lines changed: 0 additions & 2 deletions
This file was deleted.

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: dart
2+
sudo: false
3+
dart:
4+
- dev
5+
- stable
6+
dart_task:
7+
- test
8+
- dartfmt
9+
- dartanalyzer
10+
11+
# Only building master means that we don't run two builds for each pull request.
12+
branches:
13+
only: [master]
14+
15+
cache:
16+
directories:
17+
- $HOME/.pub-cache

analysis_options.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
analyzer:
2+
strong-mode:
3+
implicit-casts: false
4+
errors:
5+
unused_element: error
6+
unused_import: error
7+
unused_local_variable: error
8+
dead_code: error
9+
linter:
10+
rules:
11+
# Errors
12+
- avoid_empty_else
13+
#- comment_references
14+
- control_flow_in_finally
15+
- empty_statements
16+
- hash_and_equals
17+
- implementation_imports
18+
- test_types_in_equals
19+
- throw_in_finally
20+
- unrelated_type_equality_checks
21+
- valid_regexps
22+
23+
# Style
24+
#- annotate_overrides
25+
- avoid_init_to_null
26+
- avoid_return_types_on_setters
27+
- await_only_futures
28+
- camel_case_types
29+
- directives_ordering
30+
- empty_catches
31+
- empty_constructor_bodies
32+
- library_names
33+
- library_prefixes
34+
- non_constant_identifier_names
35+
- only_throw_errors
36+
- prefer_final_fields
37+
- prefer_is_not_empty
38+
#- prefer_single_quotes
39+
#- slash_for_doc_comments
40+
- type_init_formals

lib/src/bound_multipart_stream.dart

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,31 @@ library mime.bound_multipart_stream;
66
import 'dart:async';
77
import 'dart:convert';
88

9-
import 'mime_shared.dart';
109
import 'char_code.dart';
10+
import 'mime_shared.dart';
1111

1212
// Bytes for '()<>@,;:\\"/[]?={} \t'.
13-
const _SEPARATORS = const [40, 41, 60, 62, 64, 44, 59, 58, 92, 34, 47, 91, 93,
14-
63, 61, 123, 125, 32, 9];
13+
const _SEPARATORS = const [
14+
40,
15+
41,
16+
60,
17+
62,
18+
64,
19+
44,
20+
59,
21+
58,
22+
92,
23+
34,
24+
47,
25+
91,
26+
93,
27+
63,
28+
61,
29+
123,
30+
125,
31+
32,
32+
9
33+
];
1534

1635
bool _isTokenChar(int byte) {
1736
return byte > 31 && byte < 128 && _SEPARATORS.indexOf(byte) == -1;
@@ -102,25 +121,27 @@ class BoundMultipartStream {
102121
_controller = new StreamController(
103122
sync: true,
104123
onPause: _pauseStream,
105-
onResume: _resumeStream, onCancel: () {
106-
_controllerState = _CONTROLLER_STATE_CANCELED;
107-
_tryPropagateControllerState();
108-
}, onListen: () {
109-
_controllerState = _CONTROLLER_STATE_ACTIVE;
110-
_subscription = stream.listen((data) {
111-
assert(_buffer == null);
112-
_subscription.pause();
113-
_buffer = data;
114-
_index = 0;
115-
_parse();
116-
}, onDone: () {
117-
if (_state != _DONE) {
118-
_controller
119-
.addError(new MimeMultipartException("Bad multipart ending"));
120-
}
121-
_controller.close();
122-
}, onError: _controller.addError);
123-
});
124+
onResume: _resumeStream,
125+
onCancel: () {
126+
_controllerState = _CONTROLLER_STATE_CANCELED;
127+
_tryPropagateControllerState();
128+
},
129+
onListen: () {
130+
_controllerState = _CONTROLLER_STATE_ACTIVE;
131+
_subscription = stream.listen((data) {
132+
assert(_buffer == null);
133+
_subscription.pause();
134+
_buffer = data;
135+
_index = 0;
136+
_parse();
137+
}, onDone: () {
138+
if (_state != _DONE) {
139+
_controller
140+
.addError(new MimeMultipartException("Bad multipart ending"));
141+
}
142+
_controller.close();
143+
}, onError: _controller.addError);
144+
});
124145
}
125146

126147
void _resumeStream() {
@@ -300,9 +321,13 @@ class BoundMultipartStream {
300321

301322
case _HEADER_ENDING:
302323
_expectByteValue(byte, CharCode.LF);
303-
_multipartController = new StreamController(sync: true, onListen: () {
304-
if (_subscription.isPaused) _subscription.resume();
305-
}, onPause: _subscription.pause, onResume: _subscription.resume);
324+
_multipartController = new StreamController(
325+
sync: true,
326+
onListen: () {
327+
if (_subscription.isPaused) _subscription.resume();
328+
},
329+
onPause: _subscription.pause,
330+
onResume: _subscription.resume);
306331
_controller
307332
.add(new _MimeMultipart(_headers, _multipartController.stream));
308333
_headers = null;

0 commit comments

Comments
 (0)