Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update swift lint and format + appy fixes #2585

Merged

Conversation

mat1th
Copy link
Contributor

@mat1th mat1th commented Feb 16, 2024

Summary

Swift lint and swiftformat are outdated. This PR does update those + applies the new formatting form swiftformat.
There is 1 swift file with a manual change: Sources/Vehicle/Templates/Areas/CarPlayAreasViewModel.swift. This is done because swiftlint did create the following swiftlint error: error: Cyclomatic Complexity Violation: Function should have complexity 10 or less; currently complexity is 11 (cyclomatic_complexity).

Because it does change a lot of files the question is if we want to finetune the swiftformat rules.

Screenshots

No user facing changes.

Link to pull request in Documentation repository

NA

Any other notes

NA

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: 186 lines in your changes are missing coverage. Please review.

Comparison is base (6c34210) 27.54% compared to head (7b91f05) 28.81%.
Report is 11 commits behind head on master.

Files Patch % Lines
Sources/App/WebView/WebViewController.swift 0.00% 12 Missing ⚠️
Sources/App/WebView/WebViewWindowController.swift 11.11% 8 Missing ⚠️
Sources/App/Settings/Eureka/AccountRow.swift 0.00% 7 Missing ⚠️
Sources/Shared/API/HAAPI.swift 12.50% 7 Missing ⚠️
...s/Vehicle/Templates/Responses/HAAreaResponse.swift 0.00% 7 Missing ⚠️
...tifications/NotificationSoundsViewController.swift 0.00% 6 Missing ⚠️
Sources/App/AppDelegate.swift 0.00% 5 Missing ⚠️
Sources/App/Utilities/PermissionStatusRow.swift 0.00% 5 Missing ⚠️
...pp/QRCodeScanner/Camera/BarcodeScannerCamera.swift 0.00% 4 Missing ⚠️
Sources/App/Settings/ActionConfigurator.swift 0.00% 4 Missing ⚠️
... and 62 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2585      +/-   ##
==========================================
+ Coverage   27.54%   28.81%   +1.26%     
==========================================
  Files         311      320       +9     
  Lines       31699    23359    -8340     
==========================================
- Hits         8733     6730    -2003     
+ Misses      22966    16629    -6337     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bgoncal
Copy link
Member

bgoncal commented Feb 19, 2024

Could you check tests? And you got a conflict

@mat1th mat1th force-pushed the feature/update-swift-lint-and-format branch from f19f9aa to e1dee8e Compare February 19, 2024 17:30
@mat1th

This comment was marked as outdated.

@mat1th mat1th force-pushed the feature/update-swift-lint-and-format branch from 56b206c to bc0129b Compare February 20, 2024 11:18
Copy link
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides CarPlay, any other manual changes?

@@ -57,7 +57,7 @@ class SceneManager {
}
}

func resolve<T>(with possible: T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this done by SwiftLint/swiftformat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was done by swiftformat. I can create a rule that does not do this change.

}

let areasAndDevicesDict = mapToareasAndEntities(devicesAndAreas: devicesAndAreas)
var areasAndEntitiesDict = mapToAreasAndEntitiesDict(areasAndEntities: areasAndEntities)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked if the behavior is still the same? It looks good, but worth checking. If you dont see carplay right away you can manually add com.apple.developer.carplay-driving-task entitlement to test it out (just dont commit it)

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that would be really good

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer you can do it on a separate PR and add //swiftlint:disable cyclomatic_complexity for now in this class, so we can keep the PR topic in focus

Copy link
Contributor Author

@mat1th mat1th Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the change and disabled the swiftlint rule.

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft February 20, 2024 13:21
@mat1th mat1th force-pushed the feature/update-swift-lint-and-format branch 2 times, most recently from 16c9f11 to 14e1f34 Compare February 21, 2024 17:50
@mat1th
Copy link
Contributor Author

mat1th commented Feb 21, 2024

Besides CarPlay, any other manual changes?

No, all swift file changes are done by swiftformat or swiftlint --fix. Exept the XCTUnwrap in https://github.com/home-assistant/iOS/pull/2585/files#diff-5b0fea97bfd77bf0cb928fc473b2630777a7ab84391bb87b1f769efc089bc18dR108

@mat1th mat1th marked this pull request as ready for review February 21, 2024 17:51
@mat1th mat1th force-pushed the feature/update-swift-lint-and-format branch from 14e1f34 to 7b91f05 Compare February 22, 2024 09:41
Copy link
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bgoncal bgoncal merged commit 97834bf into home-assistant:master Feb 22, 2024
7 of 8 checks passed
@mat1th mat1th deleted the feature/update-swift-lint-and-format branch February 23, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants