diff options
author | Gil <mcg@google.com> | 2018-04-09 11:54:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 11:54:39 -0700 |
commit | 0a6618705389543191a8c44278d4c6791c84602a (patch) | |
tree | 4f195f31da90b29ffa5219e016b2cfd9ad0a7ccf /Firestore/Source/Local | |
parent | 2f2bb7f4c717bb95df69735e93ae84de8b8feaad (diff) |
Add lint checking for Objective-C++ sources (#1048)
* lint.sh now lints Objective-C++ too
* cpplint checks system-style includes that should be user-style
This prevents it from recognizing project sources as if they were C
system headers and then complaining that they're in the wrong place.
* cpplint checks #imports and #includes
* cpplint checks that C++ system headers aren't #imported
* cpplint checks for C system headers that could be C++ system headers
* cpplint checks that Objective-C sources include their headers
Diffstat (limited to 'Firestore/Source/Local')
-rw-r--r-- | Firestore/Source/Local/FSTLevelDB.mm | 5 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBKey.h | 2 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBMigrations.mm | 8 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBMutationQueue.mm | 8 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBQueryCache.mm | 5 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm | 5 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLocalSerializer.mm | 2 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTLocalStore.mm | 2 | ||||
-rw-r--r-- | Firestore/Source/Local/FSTNoOpGarbageCollector.mm | 2 | ||||
-rw-r--r-- | Firestore/Source/Local/StringView.h | 17 |
10 files changed, 37 insertions, 19 deletions
diff --git a/Firestore/Source/Local/FSTLevelDB.mm b/Firestore/Source/Local/FSTLevelDB.mm index 4812228..fae85e7 100644 --- a/Firestore/Source/Local/FSTLevelDB.mm +++ b/Firestore/Source/Local/FSTLevelDB.mm @@ -16,7 +16,7 @@ #import "Firestore/Source/Local/FSTLevelDB.h" -#include <leveldb/db.h> +#include <memory> #import "FIRFirestoreErrors.h" #import "Firestore/Source/Local/FSTLevelDBMigrations.h" @@ -26,13 +26,14 @@ #import "Firestore/Source/Remote/FSTSerializerBeta.h" #import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/Source/Util/FSTLogger.h" -#include "absl/memory/memory.h" #include "Firestore/core/src/firebase/firestore/auth/user.h" #include "Firestore/core/src/firebase/firestore/core/database_info.h" #include "Firestore/core/src/firebase/firestore/local/leveldb_transaction.h" #include "Firestore/core/src/firebase/firestore/model/database_id.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" +#include "absl/memory/memory.h" +#include "leveldb/db.h" namespace util = firebase::firestore::util; using firebase::firestore::auth::User; diff --git a/Firestore/Source/Local/FSTLevelDBKey.h b/Firestore/Source/Local/FSTLevelDBKey.h index c7a64ee..5b234ec 100644 --- a/Firestore/Source/Local/FSTLevelDBKey.h +++ b/Firestore/Source/Local/FSTLevelDBKey.h @@ -16,6 +16,8 @@ #import <Foundation/Foundation.h> +#include <string> + #import "Firestore/Source/Core/FSTTypes.h" #import "Firestore/Source/Local/StringView.h" diff --git a/Firestore/Source/Local/FSTLevelDBMigrations.mm b/Firestore/Source/Local/FSTLevelDBMigrations.mm index cf06c9f..fefd0f7 100644 --- a/Firestore/Source/Local/FSTLevelDBMigrations.mm +++ b/Firestore/Source/Local/FSTLevelDBMigrations.mm @@ -14,16 +14,18 @@ * limitations under the License. */ -#include "Firestore/Source/Local/FSTLevelDBMigrations.h" +#import "Firestore/Source/Local/FSTLevelDBMigrations.h" -#include <absl/strings/match.h> -#include "leveldb/write_batch.h" +#include <string> #import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h" #import "Firestore/Source/Local/FSTLevelDBKey.h" #import "Firestore/Source/Local/FSTLevelDBQueryCache.h" #import "Firestore/Source/Util/FSTAssert.h" +#include "absl/strings/match.h" +#include "leveldb/write_batch.h" + NS_ASSUME_NONNULL_BEGIN // Current version of the schema defined in this file. diff --git a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm index 29acead..75c3cf6 100644 --- a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm +++ b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm @@ -16,13 +16,10 @@ #import "Firestore/Source/Local/FSTLevelDBMutationQueue.h" +#include <memory> #include <set> #include <string> -#include <absl/strings/match.h> -#include <leveldb/db.h> -#include <leveldb/write_batch.h> - #import "Firestore/Protos/objc/firestore/local/Mutation.pbobjc.h" #import "Firestore/Source/Core/FSTQuery.h" #import "Firestore/Source/Local/FSTLevelDB.h" @@ -38,6 +35,9 @@ #include "Firestore/core/src/firebase/firestore/model/resource_path.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" #include "Firestore/core/src/firebase/firestore/util/string_util.h" +#include "absl/strings/match.h" +#include "leveldb/db.h" +#include "leveldb/write_batch.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Firestore/Source/Local/FSTLevelDBQueryCache.mm b/Firestore/Source/Local/FSTLevelDBQueryCache.mm index aa1ab41..5fde7d7 100644 --- a/Firestore/Source/Local/FSTLevelDBQueryCache.mm +++ b/Firestore/Source/Local/FSTLevelDBQueryCache.mm @@ -16,6 +16,9 @@ #import "Firestore/Source/Local/FSTLevelDBQueryCache.h" +#include <memory> +#include <string> + #import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h" #import "Firestore/Source/Core/FSTQuery.h" #import "Firestore/Source/Local/FSTLevelDB.h" @@ -23,9 +26,9 @@ #import "Firestore/Source/Local/FSTLocalSerializer.h" #import "Firestore/Source/Local/FSTQueryData.h" #import "Firestore/Source/Util/FSTAssert.h" -#include "absl/strings/match.h" #include "Firestore/core/src/firebase/firestore/model/document_key.h" +#include "absl/strings/match.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm b/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm index 703fc69..f655e3a 100644 --- a/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm +++ b/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm @@ -16,8 +16,6 @@ #import "Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.h" -#include <leveldb/db.h> -#include <leveldb/write_batch.h> #include <string> #import "Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.h" @@ -29,8 +27,11 @@ #import "Firestore/Source/Model/FSTDocumentDictionary.h" #import "Firestore/Source/Model/FSTDocumentSet.h" #import "Firestore/Source/Util/FSTAssert.h" + #include "Firestore/core/src/firebase/firestore/local/leveldb_transaction.h" #include "Firestore/core/src/firebase/firestore/model/document_key.h" +#include "leveldb/db.h" +#include "leveldb/write_batch.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Firestore/Source/Local/FSTLocalSerializer.mm b/Firestore/Source/Local/FSTLocalSerializer.mm index 1d9455d..61e173a 100644 --- a/Firestore/Source/Local/FSTLocalSerializer.mm +++ b/Firestore/Source/Local/FSTLocalSerializer.mm @@ -16,7 +16,7 @@ #import "Firestore/Source/Local/FSTLocalSerializer.h" -#include <inttypes.h> +#include <cinttypes> #import "Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.h" #import "Firestore/Protos/objc/firestore/local/Mutation.pbobjc.h" diff --git a/Firestore/Source/Local/FSTLocalStore.mm b/Firestore/Source/Local/FSTLocalStore.mm index 990e332..b5dfeec 100644 --- a/Firestore/Source/Local/FSTLocalStore.mm +++ b/Firestore/Source/Local/FSTLocalStore.mm @@ -16,6 +16,8 @@ #import "Firestore/Source/Local/FSTLocalStore.h" +#include <set> + #import "FIRTimestamp.h" #import "Firestore/Source/Core/FSTListenSequence.h" #import "Firestore/Source/Core/FSTQuery.h" diff --git a/Firestore/Source/Local/FSTNoOpGarbageCollector.mm b/Firestore/Source/Local/FSTNoOpGarbageCollector.mm index 451cde2..421d283 100644 --- a/Firestore/Source/Local/FSTNoOpGarbageCollector.mm +++ b/Firestore/Source/Local/FSTNoOpGarbageCollector.mm @@ -16,6 +16,8 @@ #import "Firestore/Source/Local/FSTNoOpGarbageCollector.h" +#include <set> + #include "Firestore/core/src/firebase/firestore/model/document_key.h" using firebase::firestore::model::DocumentKey; diff --git a/Firestore/Source/Local/StringView.h b/Firestore/Source/Local/StringView.h index 4e36cff..85afcaa 100644 --- a/Firestore/Source/Local/StringView.h +++ b/Firestore/Source/Local/StringView.h @@ -19,9 +19,10 @@ #import <Foundation/Foundation.h> -#include <leveldb/slice.h> #include <string> + #include "absl/strings/string_view.h" +#include "leveldb/slice.h" namespace Firestore { @@ -43,7 +44,7 @@ class StringView { // Creates a StringView from an NSString. When StringView is an argument type // into which an NSString* is passed, the caller should ensure that the // NSString is retained. - StringView(NSString *str) + StringView(NSString *str) // NOLINT(runtime/explicit) : data_([str UTF8String]), size_([str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]) { } @@ -54,20 +55,24 @@ class StringView { // Creates a StringView from the given char* pointer but computes the size // with strlen. This is really only suitable for passing C string literals. - StringView(const char *data) : data_(data), size_(strlen(data)) { + StringView(const char *data) // NOLINT(runtime/explicit) + : data_(data), size_(strlen(data)) { } // Creates a StringView from the given slice. - StringView(leveldb::Slice slice) : data_(slice.data()), size_(slice.size()) { + StringView(leveldb::Slice slice) // NOLINT(runtime/explicit) + : data_(slice.data()), size_(slice.size()) { } // Creates a StringView from the absl::string_view. - StringView(absl::string_view s) : data_(s.data()), size_(s.size()) { + StringView(absl::string_view s) // NOLINT(runtime/explicit) + : data_(s.data()), size_(s.size()) { } // Creates a StringView from the given std::string. The string must be an // lvalue for the lifetime requirements to be satisfied. - StringView(const std::string &str) : data_(str.data()), size_(str.size()) { + StringView(const std::string &str) // NOLINT(runtime/explicit) + : data_(str.data()), size_(str.size()) { } // Converts this StringView to a Slice, which is an equivalent (and more |