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

MINIFICPP-1203 - Enable header linting in include directories and resolve linter recommendations #789

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e41f293
MINIFICPP-1203 - Remove build/include suppression from linter, reorde…
hunyadi-dev May 4, 2020
00850d9
MINIFICPP-1203 - Swap include order in OSUtils.cpp for correct Window…
hunyadi-dev May 21, 2020
c3dc81c
MINIFICPP-1203 - Enable linting for headers
hunyadi-dev May 4, 2020
7289446
MINIFICPP-1203 - Rename header guards according to linter recommendat…
hunyadi-dev May 18, 2020
c360e0b
MINIFICPP-1203 - Add comments to header guard endif according to lint…
hunyadi-dev May 18, 2020
24a176c
MINIFICPP-1203 - Do not mark zero-parameter constructors explicit acc…
hunyadi-dev May 18, 2020
557e290
MINIFICPP-1203 - Do not leave blank lines after visibility modifiers …
hunyadi-dev May 19, 2020
1b347af
MINIFICPP-1203 - Add blank lines before visibility modifiers accordin…
hunyadi-dev May 19, 2020
531345a
MINIFICPP-1203 - Remove blank lines from the beginning/end of code bl…
hunyadi-dev May 19, 2020
d5178bb
MINIFICPP-1203 - Remove redundant virtual specifiers on overridden fu…
hunyadi-dev May 19, 2020
df5290a
MINIFICPP-1203 - Remove whitespaces from line ends according to linte…
hunyadi-dev May 19, 2020
1402e22
MINIFICPP-1203 - Add whitespace before { according to linter recommen…
hunyadi-dev May 19, 2020
7163a43
MINIFICPP-1203 - Remove new line before { according to linter recomme…
hunyadi-dev May 19, 2020
3d7e996
MINIFICPP-1203 - Add space between // and comments according to linte…
hunyadi-dev May 19, 2020
8fee876
MINIFICPP-1203 - Add missing spaces according to compiler recommendat…
hunyadi-dev May 19, 2020
34721e4
MINIFICPP-1203 - Add at least two spaces between code and comment acc…
hunyadi-dev May 19, 2020
a704db5
MINIFICPP-1203 - Remove linter errors due to visibility modifiers fol…
hunyadi-dev May 19, 2020
25d3da3
MINIFICPP-1203 - Remove only-semicolon lines according to linter reco…
hunyadi-dev May 19, 2020
b0c44b1
MINIFICPP-1203 - Remove "should be indented +1" errors according to l…
hunyadi-dev May 19, 2020
f346cd4
MINIFICPP-1203 - Remove extra space before last semicolon according t…
hunyadi-dev May 19, 2020
0cf1e80
MINIFICPP-1203 - Eliminate extra space around () according to linter …
hunyadi-dev May 19, 2020
5ea1768
MINIFICPP-1203 - Add NOLINT rule to lines longer than 200 characters
hunyadi-dev May 19, 2020
c902cf0
MINIFICPP-1203 - Replace tabs with spaces according to linter recomme…
hunyadi-dev May 19, 2020
aa53ff9
MINIFICPP-1203 - Fix non-unix compilant line endings according to lin…
hunyadi-dev May 19, 2020
fca40bd
MINIFICPP-1203 - Fix weird number of spaces in beginning of line acco…
hunyadi-dev May 19, 2020
9a08d3d
MINIFICPP-1203 - Fix else statements placed on new line according to …
hunyadi-dev May 19, 2020
07a4eb8
MINIFICPP-1203 - Resolve namespace should be terminated with ... acco…
hunyadi-dev May 19, 2020
a955b7b
MINIFICPP-1203 - Remove redundant ";"-s according to linter recommend…
hunyadi-dev May 19, 2020
14b8a14
MINIFICPP-1203 - Fix missing includes according to linter recommendat…
hunyadi-dev May 20, 2020
d6dcdc5
MINIFICPP-1203 - Resolve include order linter recommendations
hunyadi-dev May 20, 2020
4514bed
MINIFICPP-1203 - Put at least two spaces before comments according to…
hunyadi-dev May 20, 2020
199aa18
MINIFICPP-1203 - Fix all leftover linter recommendations
hunyadi-dev May 20, 2020
19e566d
MINIFICPP-1203 - Remove extra empty lines between c++ headers
hunyadi-dev May 26, 2020
87f558d
MINIFICPP-1203 - Make comments on closing braces for namespaces consi…
hunyadi-dev May 26, 2020
c52d9bb
MINIFICPP-1203 - Split multiple commands on same line, remove leftove…
hunyadi-dev May 26, 2020
8b4a717
MINIFICPP-1203 - Fix whitespace issues, comments, redundancies and on…
hunyadi-dev Jun 2, 2020
ab4cea9
MINIFICPP-1203 - Correct linter recommendations for Kafka related hea…
hunyadi-dev Jun 4, 2020
d044e2e
MINIFICPP-1203 - Synchronize HashContent.h with master
hunyadi-dev Jun 12, 2020
2be2aec
MINIFICPP-1203 - Correct newly introduced incorrect namespace comment…
hunyadi-dev Jun 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
set noparent
filter=-runtime/reference,-runtime/string,-build/c++11

3 changes: 0 additions & 3 deletions extensions/expression-language/ExpressionLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@

bool ExpressionObjectFactory::added = core::FlowConfiguration::add_static_func("createExpressionFactory");
extern "C" {



void *createExpressionFactory(void) {
return new ExpressionObjectFactory();
}
Expand Down
4 changes: 0 additions & 4 deletions extensions/http-curl/HTTPCurlLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@

bool HttpCurlObjectFactory::added = core::FlowConfiguration::add_static_func("createHttpCurlFactory");
extern "C" {



void *createHttpCurlFactory(void) {
return new HttpCurlObjectFactory();
}

}
16 changes: 7 additions & 9 deletions extensions/http-curl/client/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ HTTPClient::~HTTPClient() {
}

void HTTPClient::forceClose() {

if (nullptr != callback) {
callback->stop = true;
}

if (nullptr != write_callback_) {
write_callback_->stop = true;
}

}

int HTTPClient::debug_callback(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr) {
Expand Down Expand Up @@ -142,7 +140,7 @@ bool HTTPClient::setSpecificSSLVersion(SSLVersion specific_version) {
#endif
}

/* If not set, the default will be TLS 1.0, see https://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html */
// If not set, the default will be TLS 1.0, see https://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html
bool HTTPClient::setMinimumSSLVersion(SSLVersion minimum_version) {
CURLcode ret = CURLE_UNKNOWN_OPTION;
switch (minimum_version) {
Expand Down Expand Up @@ -186,7 +184,7 @@ void HTTPClient::setUploadCallback(HTTPUploadCallback *callbackObj) {
logger_->log_debug("Setting callback for %s", url_);
write_callback_ = callbackObj;
if (method_ == "put" || method_ == "PUT") {
curl_easy_setopt(http_session_, CURLOPT_INFILESIZE_LARGE, (curl_off_t ) callbackObj->ptr->getBufferSize());
curl_easy_setopt(http_session_, CURLOPT_INFILESIZE_LARGE, (curl_off_t) callbackObj->ptr->getBufferSize());
}
curl_easy_setopt(http_session_, CURLOPT_READFUNCTION, &utils::HTTPRequestResponse::send_write);
curl_easy_setopt(http_session_, CURLOPT_READDATA, static_cast<void*>(callbackObj));
Expand Down Expand Up @@ -419,8 +417,8 @@ void HTTPClient::setInterface(const std::string &ifc) {
curl_easy_setopt(http_session_, CURLOPT_INTERFACE, ifc.c_str());
}

} /* namespace utils */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace utils
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org
57 changes: 28 additions & 29 deletions extensions/http-curl/client/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __HTTP_UTILS_H__
#define __HTTP_UTILS_H__
#ifndef EXTENSIONS_HTTP_CURL_CLIENT_HTTPCLIENT_H_
#define EXTENSIONS_HTTP_CURL_CLIENT_HTTPCLIENT_H_

#include "utils/HTTPClient.h"
#ifdef WIN32
Expand All @@ -29,16 +29,18 @@
#else
#include <curl/curl.h>
#endif
#include <curl/easy.h>
#include <vector>
#include <memory>
#include <iostream>
#include <map>
#include <chrono>
#include <string>
#include <curl/easy.h>
#ifdef WIN32
#include <regex>
#else
#include <regex.h>
#endif
#include <chrono>

#include "utils/ByteArrayCallback.h"
#include "controllers/SSLContextService.h"
Expand All @@ -63,52 +65,51 @@ namespace utils {
*/
class HTTPClient : public BaseHTTPClient, public core::Connectable {
public:

HTTPClient();

HTTPClient(std::string name, utils::Identifier uuid);

HTTPClient(const std::string &url, const std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service = nullptr);
explicit HTTPClient(const std::string &url, const std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service = nullptr);

~HTTPClient();

static int debug_callback(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr);

virtual void setVerbose(bool use_stderr = false) override;
void setVerbose(bool use_stderr = false) override;

void forceClose();

virtual void initialize(const std::string &method, const std::string url = "", const std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service = nullptr) override;
void initialize(const std::string &method, const std::string url = "", const std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service = nullptr) override;

// This is a bad API and deprecated. Use the std::chrono variant of this
// It is assumed that the value of timeout provided to this function
// is in seconds units
DEPRECATED(/*deprecated in*/ 0.8.0, /*will remove in */ 2.0) virtual void setConnectionTimeout(int64_t timeout) override;
DEPRECATED(/*deprecated in*/ 0.8.0, /*will remove in */ 2.0) void setConnectionTimeout(int64_t timeout) override;

// This is a bad API and deprecated. Use the std::chrono variant of this
// It is assumed that the value of timeout provided to this function
// is in seconds units
DEPRECATED(/*deprecated in*/ 0.8.0, /*will remove in */ 2.0) virtual void setReadTimeout(int64_t timeout) override;
DEPRECATED(/*deprecated in*/ 0.8.0, /*will remove in */ 2.0) void setReadTimeout(int64_t timeout) override;

virtual void setConnectionTimeout(std::chrono::milliseconds timeout) override;
void setConnectionTimeout(std::chrono::milliseconds timeout) override;

virtual void setReadTimeout(std::chrono::milliseconds timeout) override;
void setReadTimeout(std::chrono::milliseconds timeout) override;

virtual void setUploadCallback(HTTPUploadCallback *callbackObj) override;
void setUploadCallback(HTTPUploadCallback *callbackObj) override;

virtual void setReadCallback(HTTPReadCallback *callbackObj);

struct curl_slist *build_header_list(std::string regex, const std::map<std::string, std::string> &attributes);

virtual void setContentType(std::string content_type) override;
void setContentType(std::string content_type) override;

virtual std::string escape(std::string string_to_escape) override;
std::string escape(std::string string_to_escape) override;

virtual void setPostFields(const std::string& input) override;
void setPostFields(const std::string& input) override;

void setHeaders(struct curl_slist *list);

virtual void appendHeader(const std::string &new_header) override;
void appendHeader(const std::string &new_header) override;

void appendHeader(const std::string &key, const std::string &value);

Expand Down Expand Up @@ -161,7 +162,7 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {

void setInterface(const std::string &);

virtual const std::map<std::string, std::string> &getParsedHeaders() override {
const std::map<std::string, std::string> &getParsedHeaders() override {
return header_response_.getHeaderMap();
}

Expand All @@ -186,7 +187,7 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
/**
* Determines if we are connected and operating
*/
virtual bool isRunning() override {
bool isRunning() override {
return true;
}

Expand All @@ -197,15 +198,14 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
void waitForWork(uint64_t timeoutMs) {
}

virtual void yield() override {

void yield() override {
}

/**
* Determines if work is available by this connectable
* @return boolean if work is available.
*/
virtual bool isWorkAvailable() override {
bool isWorkAvailable() override {
return true;
}

Expand Down Expand Up @@ -239,7 +239,6 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
Progress progress_;

protected:

inline bool matches(const std::string &value, const std::string &sregex) override;

static CURLcode configure_ssl_context(CURL *curl, void *ctx, void *param) {
Expand Down Expand Up @@ -287,10 +286,10 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
std::shared_ptr<logging::Logger> logger_{logging::LoggerFactory<HTTPClient>::getLogger()};
};

} /* namespace utils */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace utils
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org

#endif
#endif // EXTENSIONS_HTTP_CURL_CLIENT_HTTPCLIENT_H_
10 changes: 5 additions & 5 deletions extensions/librdkafka/KafkaConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ void KafkaConnection::logCallback(const rd_kafka_t* rk, int level, const char* /
}
}

} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace processors
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org
24 changes: 12 additions & 12 deletions extensions/librdkafka/KafkaConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
* limitations under the License.
*/

#ifndef NIFI_MINIFI_CPP_KAFKACONNECTION_H
#define NIFI_MINIFI_CPP_KAFKACONNECTION_H
#ifndef EXTENSIONS_LIBRDKAFKA_KAFKACONNECTION_H_
#define EXTENSIONS_LIBRDKAFKA_KAFKACONNECTION_H_

#include <atomic>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>

#include "core/logging/LoggerConfiguration.h"
#include "core/logging/Logger.h"
#include "rdkafka.h"
#include "rdkafka.h" // NOLINT
#include "KafkaTopic.h"
#include "utils/gsl.h"

Expand All @@ -36,7 +38,7 @@ namespace minifi {
namespace processors {

class KafkaConnectionKey {
public:
public:
std::string client_id_;
std::string brokers_;

Expand All @@ -47,7 +49,6 @@ class KafkaConnectionKey {

class KafkaConnection {
public:

explicit KafkaConnection(const KafkaConnectionKey &key);

KafkaConnection(const KafkaConnection&) = delete;
Expand Down Expand Up @@ -76,7 +77,6 @@ class KafkaConnection {
static void logCallback(const rd_kafka_t* rk, int level, const char* /*fac*/, const char* buf);

private:

std::shared_ptr<logging::Logger> logger_;

bool initialized_;
Expand Down Expand Up @@ -117,10 +117,10 @@ class KafkaConnection {
}
};

} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace processors
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org

#endif //NIFI_MINIFI_CPP_KAFKACONNECTION_H
#endif // EXTENSIONS_LIBRDKAFKA_KAFKACONNECTION_H_
18 changes: 9 additions & 9 deletions extensions/librdkafka/KafkaTopic.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

#ifndef NIFI_MINIFI_CPP_KAFKATOPIC_H
#define NIFI_MINIFI_CPP_KAFKATOPIC_H
#ifndef EXTENSIONS_LIBRDKAFKA_KAFKATOPIC_H_
#define EXTENSIONS_LIBRDKAFKA_KAFKATOPIC_H_

#include "rdkafka.h"
#include "rdkafka.h" // NOLINT

#include "utils/gsl.h"

Expand Down Expand Up @@ -48,10 +48,10 @@ class KafkaTopic {
gsl::owner<rd_kafka_topic_t*> topic_reference_;
};

} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace processors
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org

#endif //NIFI_MINIFI_CPP_KAFKATOPIC_H
#endif // EXTENSIONS_LIBRDKAFKA_KAFKATOPIC_H_
10 changes: 5 additions & 5 deletions extensions/librdkafka/PublishKafka.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,8 @@ void PublishKafka::onTrigger(const std::shared_ptr<core::ProcessContext> &contex
});
}

} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
} // namespace processors
} // namespace minifi
} // namespace nifi
} // namespace apache
} // namespace org