Skip to content

Fix SwiftLint violations: trailing whitespace, identifier names, and closure syntax#2

Open
dillonvargo wants to merge 1 commit into
mainfrom
devin/1769446608-swiftlint-fixes
Open

Fix SwiftLint violations: trailing whitespace, identifier names, and closure syntax#2
dillonvargo wants to merge 1 commit into
mainfrom
devin/1769446608-swiftlint-fixes

Conversation

@dillonvargo

Copy link
Copy Markdown
Owner

Summary

This PR addresses SwiftLint violations, reducing the count from 637 violations to 16 warnings and 1 error. The remaining issues are style warnings that would require significant refactoring (file length, function parameter count, etc.).

Changes made:

  • Auto-fixed 600+ trailing whitespace violations across all 19 Swift files
  • Renamed short identifiers: iindex/dayOffset, vmviewModel, totargetUnit/sourceUnit
  • Renamed AppConstants.UI enum to AppConstants.UserInterface (minimum 3-character type name requirement)
  • Converted Button(action:) { } to Button { } label: { } syntax to fix multiple_closures_with_trailing_closure violations

Review & Testing Checklist for Human

  • Build the project in Xcode - These changes were made on Linux where Swift compilation isn't available. Verify the project compiles without errors.
  • Test Button interactions - The closure syntax changes should be semantically equivalent, but verify buttons still work correctly (Add Weight, Add Workout, Add Food, navigation buttons)
  • Verify AppConstants.UserInterface references - All usages of the renamed enum were updated, but confirm no build errors related to this rename

Test Plan

  1. Open project in Xcode 15+
  2. Build for iOS simulator
  3. Run the app and test each tab (Weight, Workouts, Nutrition, Exercise Progress)
  4. Verify add/edit/delete operations work in each section

Notes

Remaining violations (not addressed):

  • File length violations in DietViewModel.swift and DietTrackingView.swift (would require splitting files)
  • Function parameter count violations (would require API changes)
  • Line length violations (would require reformatting long lines)
  • Cyclomatic complexity in NutritionInfo.swift (would require logic restructuring)

Requested by: Dillon Vargo (@dillonvargo)
Link to Devin run: https://app.devin.ai/sessions/99e0f6749f2243e9ae459218d9dd7fb5

…closure syntax

- Auto-fix 600+ trailing whitespace violations
- Rename short identifiers: 'i' -> 'index'/'dayOffset', 'vm' -> 'viewModel', 'to' -> 'targetUnit'
- Rename 'UI' enum to 'UserInterface' to meet minimum length requirement
- Convert Button(action:) to Button { } label: { } syntax to fix multiple_closures violations
- Update all references to AppConstants.UI to AppConstants.UserInterface

Remaining 16 warnings are style issues requiring significant refactoring:
- File/type body length violations (would require splitting files)
- Function parameter count (would require API changes)
- Line length violations (would require reformatting)
- Cyclomatic complexity (would require logic restructuring)

Co-Authored-By: Dillon Vargo <dillonvargo@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant