Skip to content

Commit 7e2d04c

Browse files
authored
Code cleanup (#2297)
Add some nullability specifiers, remove a test that won't compile, change the pod gen script.
1 parent ddeb55f commit 7e2d04c

File tree

13 files changed

+38
-13
lines changed

13 files changed

+38
-13
lines changed

GoogleDataLogger/GoogleDataLogger/Classes/GDLLogWriter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
@protocol GDLLogTransformer;
2222

23+
NS_ASSUME_NONNULL_BEGIN
24+
2325
/** Manages the writing and log-time transforming of logs. */
2426
@interface GDLLogWriter : NSObject
2527

@@ -38,3 +40,5 @@
3840
afterApplyingTransformers:(nullable NSArray<id<GDLLogTransformer>> *)logTransformers;
3941

4042
@end
43+
44+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLLogStorage_Private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@class GDLUploadCoordinator;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
@interface GDLLogStorage ()
2224

2325
/** The queue on which all storage work will occur. */
@@ -34,3 +36,5 @@
3436
@property(nonatomic) GDLUploadCoordinator *uploader;
3537

3638
@end
39+
40+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLLogWriter_Private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@class GDLLogStorage;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
@interface GDLLogWriter ()
2224

2325
/** The queue on which all work will occur. */
@@ -27,3 +29,5 @@
2729
@property(nonatomic) GDLLogStorage *storageInstance;
2830

2931
@end
32+
33+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLLogger_Private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@class GDLLogWriter;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
@interface GDLLogger ()
2224

2325
/** The log mapping identifier that a GDLLogBackend will use to map the extension to proto. */
@@ -33,3 +35,5 @@
3335
@property(nonatomic) GDLLogWriter *logWriterInstance;
3436

3537
@end
38+
39+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLRegistrar_Private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@interface GDLRegistrar ()
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
/** The concurrent queue on which all registration occurs. */
2224
@property(nonatomic, readonly) dispatch_queue_t registrarQueue;
2325

@@ -30,3 +32,5 @@
3032
NSMutableDictionary<NSNumber *, id<GDLLogPrioritizer>> *logTargetToPrioritizer;
3133

3234
@end
35+
36+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogPrioritizer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@class GDLLogEvent;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
/** This protocol defines the common interface of a log prioritization. Log prioritizers are
2224
* stateful objects that prioritize logs upon insertion into storage and remain prepared to return a
2325
* set of log filenames to the storage system.
@@ -45,3 +47,5 @@
4547
- (NSSet<NSNumber *> *)logsForNextUpload;
4648

4749
@end
50+
51+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogProto.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
NS_ASSUME_NONNULL_BEGIN
20+
1921
/** This protocol defines the common interface that log protos should implement regardless of the
2022
* underlying transport technology (protobuf, nanopb, etc).
2123
*/
@@ -28,3 +30,5 @@
2830
- (NSData *)protoBytes;
2931

3032
@end
33+
34+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogTransformer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
@class GDLLogEvent;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
/** Defines the API that log transformers must adopt. */
2224
@protocol GDLLogTransformer <NSObject>
2325

@@ -32,3 +34,5 @@
3234
- (GDLLogEvent *)transform:(GDLLogEvent *)logEvent;
3335

3436
@end
37+
38+
NS_ASSUME_NONNULL_END

GoogleDataLogger/GoogleDataLogger/DependencyWrappers/GDLConsoleLogger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ typedef NS_ENUM(NSInteger, GDLMessageCode) {
5050
};
5151

5252
/** */
53-
FOUNDATION_EXTERN NSString *GDLMessageCodeEnumToString(GDLMessageCode code);
53+
FOUNDATION_EXTERN NSString *_Nonnull GDLMessageCodeEnumToString(GDLMessageCode code);
5454

5555
/** Logs the warningMessage string to the console at the warning level.
5656
*
5757
* @param warningMessageFormat The format string to log to the console.
5858
*/
5959
FOUNDATION_EXTERN void GDLLogWarning(GDLMessageCode messageCode,
60-
NSString *warningMessageFormat,
60+
NSString *_Nonnull warningMessageFormat,
6161
...) NS_FORMAT_FUNCTION(2, 3);
6262

6363
// A define to wrap GULLogWarning with slightly more convenient usage.

GoogleDataLogger/Tests/Unit/GDLClockTest.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ - (void)testSupportsSecureEncoding {
4848
XCTAssertTrue([GDLClock supportsSecureCoding]);
4949
}
5050

51+
/** Tests encoding and decoding a clock using a keyed archiver. */
5152
- (void)testEncoding {
5253
GDLClock *clock = [GDLClock snapshot];
5354
NSData *clockData = [NSKeyedArchiver archivedDataWithRootObject:clock];
@@ -56,6 +57,7 @@ - (void)testEncoding {
5657
XCTAssertEqualObjects(clock, unarchivedClock);
5758
}
5859

60+
/** Tests creating a clock that represents a future time. */
5961
- (void)testClockSnapshotInTheFuture {
6062
GDLClock *clock1 = [GDLClock snapshot];
6163
GDLClock *clock2 = [GDLClock clockSnapshotInTheFuture:1];

GoogleDataLogger/Tests/Unit/GDLLogWriterTest.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,4 @@ - (void)testWriteLogWithBadTransformer {
124124
[self waitForExpectations:@[ errorExpectation ] timeout:5.0];
125125
}
126126

127-
/** Tests that writing a nil log throws. */
128-
- (void)testWritingANilLogThrows {
129-
GDLLogWriter *writer = [GDLLogWriter sharedInstance];
130-
XCTAssertThrows([writer writeLog:nil afterApplyingTransformers:nil]);
131-
}
132-
133127
@end

GoogleDataLogger/Tests/Unit/GDLRegistrarTest.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ @interface GDLRegistrarTest : GDLTestCase
3131
@implementation GDLRegistrarTest
3232

3333
- (void)setUp {
34+
[super setUp];
3435
_logTarget = 23;
3536
}
3637

GoogleDataLogger/generate_project.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@
1818
# From https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
1919
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
2020

21-
# Remove the old generated project
22-
echo "Removing $DIR/gen"
23-
rm -rf "$DIR/gen/"
24-
25-
pod gen "$DIR/../GoogleDataLogger.podspec" --auto-open --gen-directory="$DIR/gen"
21+
pod gen "$DIR/../GoogleDataLogger.podspec" --auto-open --gen-directory="$DIR/gen" --clean

0 commit comments

Comments
 (0)