Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- name: "Analyze with latest stable"
uses: invertase/github-action-dart-analyzer@v2.0.0
with:
fatal-infos: true
- name: Run analysis
run: melos analyze

format:
runs-on: ubuntu-latest
Expand All @@ -38,7 +36,7 @@ jobs:
cache: true
- uses: bluefireteam/melos-action@v3
- name: Run format
run: melos format-check
run: melos format --set-exit-if-changed
Comment thread
spydon marked this conversation as resolved.
# END LINTING STAGE

# BEGIN TESTING STAGE
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ For a contribution to be accepted:
- Examples should always be updated or added.*
- Tests should always be updated or added.*
- Format the Dart code accordingly with `flutter format`.
- Your code should pass the analyzer checks `melos run analyze`.
- Your code should pass all tests `melos run test`.
- Your code should pass the analyzer checks `melos analyze`.
- Your code should pass all tests `melos test`.
- Start your PR title with a [conventional commit] type
(`feat:`, `fix:` etc).

Expand Down
66 changes: 0 additions & 66 deletions melos.yaml

This file was deleted.

34 changes: 18 additions & 16 deletions packages/tiled/lib/src/common/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@ class ColorData {
const ColorData.hex(this._hex);

const ColorData.rgb(int red, int green, int blue, [int alpha = 255])
: assert(red >= 0 && red <= 255),
assert(green >= 0 && green <= 255),
assert(blue >= 0 && blue <= 255),
assert(alpha >= 0 && alpha <= 255),
_hex = (alpha << 3 * 8) +
(red << 2 * 8) +
(green << 1 * 8) +
(blue << 0 * 8);
: assert(red >= 0 && red <= 255),
assert(green >= 0 && green <= 255),
assert(blue >= 0 && blue <= 255),
assert(alpha >= 0 && alpha <= 255),
_hex =
(alpha << 3 * 8) +
(red << 2 * 8) +
(green << 1 * 8) +
(blue << 0 * 8);

const ColorData.argb(int alpha, int red, int green, int blue)
: assert(red >= 0 && red <= 255),
assert(green >= 0 && green <= 255),
assert(blue >= 0 && blue <= 255),
assert(alpha >= 0 && alpha <= 255),
_hex = (alpha << 3 * 8) +
(red << 2 * 8) +
(green << 1 * 8) +
(blue << 0 * 8);
: assert(red >= 0 && red <= 255),
assert(green >= 0 && green <= 255),
assert(blue >= 0 && blue <= 255),
assert(alpha >= 0 && alpha <= 255),
_hex =
(alpha << 3 * 8) +
(red << 2 * 8) +
(green << 1 * 8) +
(blue << 0 * 8);

@override
bool operator ==(Object other) {
Expand Down
12 changes: 6 additions & 6 deletions packages/tiled/lib/src/common/flips.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class Flips {
});

const Flips.defaults()
: this(
horizontally: false,
vertically: false,
diagonally: false,
antiDiagonally: false,
);
: this(
horizontally: false,
vertically: false,
diagonally: false,
antiDiagonally: false,
);

Flips copyWith({
bool? horizontally,
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/common/frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Frame {
});

Frame.parse(Parser parser)
: this(
tileId: parser.getInt('tileid'),
duration: parser.getInt('duration'),
);
: this(
tileId: parser.getInt('tileid'),
duration: parser.getInt('duration'),
);
}
3 changes: 2 additions & 1 deletion packages/tiled/lib/src/common/gid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class Gid {
final flippedAntiDiagonally =
gid & flippedAntiDiagonallyFlag == flippedAntiDiagonallyFlag;
// clear id from flips
final tileId = gid &
final tileId =
gid &
~(flippedHorizontallyFlag |
flippedVerticallyFlag |
flippedDiagonallyFlag |
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/common/point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class Point {
Point({required this.x, required this.y});

Point.parse(Parser parser)
: this(
x: parser.getDouble('x'),
y: parser.getDouble('y'),
);
: this(
x: parser.getDouble('x'),
y: parser.getDouble('y'),
);

factory Point.parseFromString(String point) {
final split = point.split(',');
Expand Down
35 changes: 20 additions & 15 deletions packages/tiled/lib/src/common/property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,22 @@ class Property<T> {
);

case PropertyType.string:
final value = parser.formatSpecificParsing((json) {
return json.getString('value', defaults: '');
}, (xml) {
final attrString = parser.getStringOrNull('value');
if (attrString != null) {
return attrString;
} else {
// In tmx files, multi-line text property values can be stored
// inside the `<property>` node itself instead of in the 'value'
// attribute
return xml.element.innerText;
}
});
final value = parser.formatSpecificParsing(
(json) {
return json.getString('value', defaults: '');
},
(xml) {
final attrString = parser.getStringOrNull('value');
if (attrString != null) {
return attrString;
} else {
// In tmx files, multi-line text property values can be stored
// inside the `<property>` node itself instead of in the 'value'
// attribute
return xml.element.innerText;
}
},
);

return StringProperty(
name: name,
Expand Down Expand Up @@ -224,8 +227,10 @@ extension PropertiesParser on Parser {

// NOTE: two properties should never have the same name, if they do
// one will simply override the other
final byName =
properties.groupFoldBy((prop) => prop.name, (previous, element) {
final byName = properties.groupFoldBy((prop) => prop.name, (
previous,
element,
) {
return element;
});

Expand Down
14 changes: 7 additions & 7 deletions packages/tiled/lib/src/common/tiled_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class TiledImage {
});

TiledImage.parse(Parser parser)
: this(
source: parser.getStringOrNull('source'),
format: parser.getStringOrNull('format'),
width: parser.getIntOrNull('width'),
height: parser.getIntOrNull('height'),
trans: parser.getStringOrNull('trans'),
);
: this(
source: parser.getStringOrNull('source'),
format: parser.getStringOrNull('format'),
width: parser.getIntOrNull('width'),
height: parser.getIntOrNull('height'),
trans: parser.getStringOrNull('trans'),
);

/// Needed for getTiledImages in TileMap;
/// Images are equal if their source is equal.
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/editor_setting/chunk_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class ChunkSize {
ChunkSize({required this.width, required this.height});

ChunkSize.parse(Parser parser)
: this(
width: parser.getInt('width', defaults: 16),
height: parser.getInt('height', defaults: 16),
);
: this(
width: parser.getInt('width', defaults: 16),
height: parser.getInt('height', defaults: 16),
);
}
9 changes: 4 additions & 5 deletions packages/tiled/lib/src/editor_setting/editor_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ class EditorSetting {
EditorSetting({required this.chunkSize, required this.export});

EditorSetting.parse(Parser parser)
: this(
chunkSize:
parser.getSingleChildOrNullAs('chunksize', ChunkSize.parse),
export: parser.getSingleChildOrNullAs('export', Export.parse),
);
: this(
chunkSize: parser.getSingleChildOrNullAs('chunksize', ChunkSize.parse),
export: parser.getSingleChildOrNullAs('export', Export.parse),
);
}
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/editor_setting/export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Export {
});

Export.parse(Parser parser)
: this(
format: parser.getString('format'),
target: parser.getString('target'),
);
: this(
format: parser.getString('format'),
target: parser.getString('target'),
);
}
Loading
Loading