Skip to content

Commit

Permalink
Merge pull request #62 from achilleasa/switch-to-dart-format
Browse files Browse the repository at this point in the history
Switch to dart format
  • Loading branch information
achilleasa authored Sep 30, 2021
2 parents 2541d36 + b76b760 commit 6615054
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
script:
- export PATH=$PATH:"${TRAVIS_HOME}/.pub-cache/bin"
- pub get
- dartfmt -n --set-exit-if-changed .
- dart format --set-exit-if-changed .
- dartanalyzer --fatal-warnings --fatal-hints --fatal-lints ./
- AMQP_RUN_TLS_TESTS=true dart --pause-isolates-on-exit --disable-service-auth-codes --enable-vm-service=9292 test/run_all.dart &
- pub global activate coverage
Expand Down
4 changes: 3 additions & 1 deletion lib/src/protocol/messages/bindings/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class ChannelCloseOk implements Message {
ChannelCloseOk.fromStream(TypeDecoder decoder) {}
@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}
4 changes: 3 additions & 1 deletion lib/src/protocol/messages/bindings/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ class ConnectionCloseOk implements Message {
ConnectionCloseOk.fromStream(TypeDecoder decoder) {}
@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}
12 changes: 9 additions & 3 deletions lib/src/protocol/messages/bindings/tx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class TxSelect implements Message {

@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}

Expand Down Expand Up @@ -56,7 +58,9 @@ class TxCommit implements Message {

@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}

Expand Down Expand Up @@ -90,7 +94,9 @@ class TxRollback implements Message {

@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}

Expand Down
4 changes: 3 additions & 1 deletion test/lib/auth_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ class ConnectionCloseOkMock extends Mock implements ConnectionCloseOk {

@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}

Expand Down
4 changes: 3 additions & 1 deletion test/lib/exception_handling_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ class TxSelectOkMock extends Mock implements TxSelectOk {

@override
void serialize(TypeEncoder encoder) {
encoder..writeUInt16(msgClassId)..writeUInt16(msgMethodId);
encoder
..writeUInt16(msgClassId)
..writeUInt16(msgMethodId);
}
}

Expand Down
16 changes: 12 additions & 4 deletions tool/generate_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,23 @@ ${String.fromCharCodes(List<int>.filled(className.length + methodName.length + 1
}

// End casacade
serializerMethod..write(" ;\n")..write(" }\n");
serializerMethod
..write(" ;\n")
..write(" }\n");

generatedClass..write("\n")..write(ctors);
generatedClass
..write("\n")
..write(ctors);

if (implementedByServer || !implementedByClient) {
generatedClass..write("\n")..write(serializerMethod);
generatedClass
..write("\n")
..write(serializerMethod);
} else {
// Write an empty serializer stub to avoid warnings
generatedClass..write("\n\n")..write("""
generatedClass
..write("\n\n")
..write("""
void serialize(TypeEncoder encoder) {}
""");
}
Expand Down

0 comments on commit 6615054

Please sign in to comment.