From a1f8e48fa3e64ab6d8bda99d4edd189e49cb0d66 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Wed, 15 May 2024 11:19:27 +0300 Subject: [PATCH 1/3] feat: basic format integration --- .clang-format | 33 +++++++++++++++++++++++++++++++++ Countly-PL.podspec | 2 +- Countly.podspec | 2 +- Package.swift | 1 + format.sh | 17 +++++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .clang-format create mode 100755 format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..b38e7695 --- /dev/null +++ b/.clang-format @@ -0,0 +1,33 @@ +# Basic indentation settings +IndentWidth: 2 +TabWidth: 2 +ContinuationIndentWidth: 4 +UseTab: Never +IndentPPDirectives: BeforeHash + +# Code formatting rules +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false +ColumnLimit: 300 + +# Blank lines +MaxEmptyLinesToKeep: 1 + +# Alignment +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignOperands: true +AlignTrailingComments: true + +# Import statements +SortIncludes: true \ No newline at end of file diff --git a/Countly-PL.podspec b/Countly-PL.podspec index e1590e8e..7d2acbe6 100644 --- a/Countly-PL.podspec +++ b/Countly-PL.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.subspec 'Core' do |core| core.source_files = '*.{h,m}' core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h', 'CountlyExperimentInformation.h', 'CountlyAPMConfig.h', 'CountlySDKLimitsConfig.h', 'Resettable.h' - core.preserve_path = 'countly_dsym_uploader.sh' + core.preserve_paths = ['countly_dsym_uploader.sh', 'format.sh'] core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity'] end diff --git a/Countly.podspec b/Countly.podspec index bd9efb1d..f5982b1c 100644 --- a/Countly.podspec +++ b/Countly.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.subspec 'Core' do |core| core.source_files = '*.{h,m}' core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h', 'CountlyExperimentInformation.h', 'CountlyAPMConfig.h', 'CountlySDKLimitsConfig.h', 'Resettable.h' - core.preserve_path = 'countly_dsym_uploader.sh' + core.preserve_paths = ['countly_dsym_uploader.sh', 'format.sh'] core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity'] end diff --git a/Package.swift b/Package.swift index 70ecfc6f..10bf0da8 100644 --- a/Package.swift +++ b/Package.swift @@ -36,6 +36,7 @@ let package = Package( "LICENSE", "README.md", "countly_dsym_uploader.sh", + "format.sh", "CHANGELOG.md", "SECURITY.md", "CountlyTests/" diff --git a/format.sh b/format.sh new file mode 100755 index 00000000..a3ee02f3 --- /dev/null +++ b/format.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +CDP=$(osascript -e ' +tell application "Xcode" + activate + --wait for Xcode to remove edited flag from filename + delay 0.3 + set last_word_in_main_window to (word -1 of (get name of window 1)) + set current_document to document 1 whose name ends with last_word_in_main_window + set current_document_path to path of current_document + --CDP is assigned last set value: current_document_path +end tell ') + +sleep 0.6 ### during save Xcode stops listening for file changes +/usr/local/bin/clang-format -style=file -i ${CDP} + +# EOF From b87862171746eb298f44894c212eab892603e5fe Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray <57103426+arifBurakDemiray@users.noreply.github.com> Date: Thu, 16 May 2024 10:09:03 +0300 Subject: [PATCH 2/3] Update Countly.podspec --- Countly.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Countly.podspec b/Countly.podspec index f5982b1c..bd9efb1d 100644 --- a/Countly.podspec +++ b/Countly.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.subspec 'Core' do |core| core.source_files = '*.{h,m}' core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h', 'CountlyExperimentInformation.h', 'CountlyAPMConfig.h', 'CountlySDKLimitsConfig.h', 'Resettable.h' - core.preserve_paths = ['countly_dsym_uploader.sh', 'format.sh'] + core.preserve_path = 'countly_dsym_uploader.sh' core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity'] end From 98d0a1ddaa31f5447bdffb3dd6ee2551f1383c57 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray <57103426+arifBurakDemiray@users.noreply.github.com> Date: Thu, 16 May 2024 10:09:17 +0300 Subject: [PATCH 3/3] Update Countly-PL.podspec --- Countly-PL.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Countly-PL.podspec b/Countly-PL.podspec index 7d2acbe6..e1590e8e 100644 --- a/Countly-PL.podspec +++ b/Countly-PL.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.subspec 'Core' do |core| core.source_files = '*.{h,m}' core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h', 'CountlyFeedbackWidget.h', 'CountlyRCData.h', 'CountlyRemoteConfig.h', 'CountlyViewTracking.h', 'CountlyExperimentInformation.h', 'CountlyAPMConfig.h', 'CountlySDKLimitsConfig.h', 'Resettable.h' - core.preserve_paths = ['countly_dsym_uploader.sh', 'format.sh'] + core.preserve_path = 'countly_dsym_uploader.sh' core.ios.frameworks = ['Foundation', 'UIKit', 'UserNotifications', 'CoreLocation', 'WebKit', 'CoreTelephony', 'WatchConnectivity'] end