Skip to content

feat: add multi-language formatters for native platform code#414

Closed
realmeylisdev wants to merge 12 commits intoVeryGoodOpenSource:mainfrom
realmeylisdev:feat/multi-language-formatters
Closed

feat: add multi-language formatters for native platform code#414
realmeylisdev wants to merge 12 commits intoVeryGoodOpenSource:mainfrom
realmeylisdev:feat/multi-language-formatters

Conversation

@realmeylisdev
Copy link
Copy Markdown
Contributor

Summary

Adds formatting and linting support for non-Dart languages in templates, addressing #127.

  • Kotlin: ktlint v1.5.0 for Android files
  • Swift: SwiftFormat for iOS/macOS files
  • C++: clang-format for Windows/Linux files

Changes

New Configuration Files

File Purpose
.editorconfig Shared editor settings (indent, line endings, etc.)
.swiftformat SwiftFormat configuration for Swift files
.clang-format clang-format configuration for C++ files

New Reusable Workflows

  • kotlin_format.yaml - Kotlin linting with ktlint
  • swift_format.yaml - Swift formatting with SwiftFormat
  • cpp_format.yaml - C++ formatting with clang-format

Updated Template Workflows

Template Format Checks Added
very_good_core Kotlin, Swift (macOS job), C++
very_good_flame_game Kotlin, Swift (macOS job), C++
very_good_flutter_plugin Kotlin, Swift (macOS job), C++
very_good_wear_app Kotlin (Android-only)

Test Plan

  • CI workflows pass for all templates
  • Kotlin formatting check runs on Android builds
  • Swift formatting check runs on iOS/macOS builds (separate macOS runner)
  • C++ formatting check runs on Windows/Linux builds
  • No functional changes to generated template code

Closes #127

Add formatting and linting support for non-Dart languages in templates:

- Kotlin: ktlint for Android files
- Swift: SwiftFormat for iOS/macOS files
- C++: clang-format for Windows/Linux files

New configuration files:
- .editorconfig: shared editor settings
- .swiftformat: Swift formatting rules
- .clang-format: C++ formatting rules

New reusable workflows:
- kotlin_format.yaml
- swift_format.yaml
- cpp_format.yaml

Updated template workflows with native format checks:
- very_good_core
- very_good_flame_game
- very_good_flutter_plugin
- very_good_wear_app

Closes VeryGoodOpenSource#127
@realmeylisdev realmeylisdev requested a review from a team as a code owner December 27, 2025 17:43
realmeylisdev and others added 9 commits January 13, 2026 23:50
Format Kotlin, Swift, and C++ files in templates to comply with the new
multi-language formatter CI checks:

- Kotlin: Fix import ordering, spacing, unused imports, line wrapping
- Swift: Fix 4-space indentation, import sorting, blank lines in scopes
- C++: Apply Google style formatting, pointer alignment, else placement
- Wrap long lines in GeneratedPluginRegistrant.swift
- Wrap long lines in Package.swift files and add trailing newline
- Fix if/else brace style in Linux plugin
- Re-format Linux example files with clang-format
- Exclude Flutter auto-generated files from swift-format checks
- Fix Kotlin plugin formatting to comply with ktlint rules
- Wrap class signature, MethodChannel args, and onMethodCall params in
  Kotlin plugin template to satisfy ktlint line length rules
- Update .swiftformat exclude patterns to use glob syntax for proper
  matching of Flutter-generated files
- Format Windows plugin C++ file to comply with clang-format rules
- Fix circular import in Fluttium check_platform_name action by using relative import
- Format Linux plugin C++ files (.cc and .h) to comply with clang-format
- Break long comment lines in iOS/macOS Package.swift to meet 100-char limit
@realmeylisdev
Copy link
Copy Markdown
Contributor Author

@marcossevilla I think I got it right correct now. Please review!

@marcossevilla
Copy link
Copy Markdown
Member

Hey @meylis1998, I’ve had a chance to look over this. I think we might be overthinking the formatting in the workflows. Wouldn’t it be simpler to start with some research if there’s already a workflow in place for this?

Also, are the formatting configurations standardized? I was thinking, before adding formatting to each platform, we should first add one at a time and check out the standard configurations for each formatter before making any changes.

@marcossevilla marcossevilla self-requested a review February 4, 2026 10:50
@marcossevilla marcossevilla self-assigned this Feb 4, 2026
@marcossevilla marcossevilla moved this from Needs Triage to In Review in VGV Open Source 🦄 🧙🌟 Feb 4, 2026
@realmeylisdev
Copy link
Copy Markdown
Contributor Author

Hey @meylis1998, I’ve had a chance to look over this. I think we might be overthinking the formatting in the workflows. Wouldn’t it be simpler to start with some research if there’s already a workflow in place for this?

Also, are the formatting configurations standardized? I was thinking, before adding formatting to each platform, we should first add one at a time and check out the standard configurations for each formatter before making any changes.

Hey @marcossevilla, thanks for the review! You raise good points.

On existing workflows: You're right to ask. I checked and there's no existing workflow for Swift/Kotlin/C++ formatting - only Dart. However, I did create reusable workflows (swift_format.yaml,
kotlin_format.yaml, cpp_format.yaml) but I'm not actually using them via workflow_call. Instead, the logic is duplicated inline in each template workflow. That's inconsistent and should be fixed.

On standardized configurations:

  • .clang-format uses Google style (industry standard ✅)
  • .swiftformat uses 4-space indent which matches Apple conventions, but the rest is custom
  • ktlint relies on .editorconfig with minimal Kotlin-specific settings

I should research the canonical/default configurations for each formatter before customizing.

On adding one at a time: Agreed. This PR required 8 fix commits after the initial implementation, which suggests it's too broad. I'll split this into separate PRs:

  1. Swift formatting first
  2. Kotlin formatting second
  3. C++ formatting third

This will also let us validate each formatter's config against the standard before moving on.

I'll also look into existing GitHub Actions (like jidicula/clang-format-action) that might simplify the workflows.

@marcossevilla marcossevilla moved this from In Review to Community in VGV Open Source 🦄 🧙🌟 Feb 4, 2026
@marcossevilla
Copy link
Copy Markdown
Member

@meylis1998 are you okay closing this in favor of the following PRs breaking down each formatter?

@realmeylisdev
Copy link
Copy Markdown
Contributor Author

@meylis1998 are you okay closing this in favor of the following PRs breaking down each formatter?

if you'd like me to resolve them one by one and you'll eventually give it a merge then I can do it either way I'm okay with closing it, appreciate your attention @marcossevilla

@realmeylisdev
Copy link
Copy Markdown
Contributor Author

I see all the CI erros now resolved

@marcossevilla
Copy link
Copy Markdown
Member

@meylis1998 are you okay closing this in favor of the following PRs breaking down each formatter?

if you'd like me to resolve them one by one and you'll eventually give it a merge then I can do it either way I'm okay with closing it, appreciate your attention @marcossevilla

@meylis1998 yes, that would be the approach I'd like to follow 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

chore: Investigate adding formatters for languages/platforms outside of Dart

2 participants