Skip to content

Commit

Permalink
Merge pull request #1109 from nextcloud/feat/dynamite/config_add_line…
Browse files Browse the repository at this point in the history
…length

feat(dynamite): allow to configure the pageWidth for the dart formatter
  • Loading branch information
Leptopoda authored Nov 4, 2023
2 parents dca7c81 + d414214 commit 7a6742e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/dynamite/dynamite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ targets:
# Options configure how source code is generated.
#
# The following are sensible default values that ignores the schemas for the coverage.
pageWidth: 120
analyzer_ignores:
- camel_case_types
- discarded_futures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ abstract class DynamiteConfig implements Built<DynamiteConfig, DynamiteConfigBui
/// All matches will be wrapped in `// coverage:ignore-start` and `// coverage:ignore-end` blocks.
@BuiltValueField(wireName: 'coverage_ignores')
BuiltSet<String>? get coverageIgnores;

/// The specified line with the formatter should use.
int? get pageWidth;
}

@SerializersFor([
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/dynamite/dynamite/lib/src/openapi_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class OpenAPIBuilder implements Builder {
}
}

final formatter = DartFormatter(pageWidth: 120);
final formatter = DartFormatter(pageWidth: buildConfig.pageWidth);
await buildStep.writeAsString(
outputId,
formatter.format(outputString),
Expand Down
1 change: 1 addition & 0 deletions packages/dynamite/dynamite_end_to_end_test/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ targets:
enabled: true
dynamite:
options:
pageWidth: 120
analyzer_ignores:
- camel_case_types
- discarded_futures
Expand Down
1 change: 1 addition & 0 deletions packages/nextcloud/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ targets:
enabled: true
dynamite:
options:
pageWidth: 120
analyzer_ignores:
- camel_case_types
- discarded_futures
Expand Down

0 comments on commit 7a6742e

Please sign in to comment.