fix codacy issues II

This commit is contained in:
pantor
2020-08-08 13:41:16 +02:00
parent e29a04cbca
commit 73c04e6995
5 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ struct InjaError : public std::runtime_error {
SourceLocation location;
explicit InjaError(const std::string &type, const std::string &message)
: std::runtime_error("[inja.exception." + type + "] " + message), type(type), message(message) {}
: std::runtime_error("[inja.exception." + type + "] " + message), type(type), message(message), location({0, 0}) {}
explicit InjaError(const std::string &type, const std::string &message, SourceLocation location)
: std::runtime_error("[inja.exception." + type + "] (at " + std::to_string(location.line) + ":" +
+3 -3
View File
@@ -37,8 +37,8 @@ class Lexer {
const LexerConfig &config;
State state {State::Text};
MinusState minus_state {MinusState::Number};
State state;
MinusState minus_state;
nonstd::string_view m_in;
size_t tok_start;
size_t pos;
@@ -268,7 +268,7 @@ class Lexer {
}
public:
explicit Lexer(const LexerConfig &config) : config(config) {}
explicit Lexer(const LexerConfig &config) : config(config), state(State::Text), minus_state(MinusState::Number) {}
SourceLocation current_position() const {
return get_source_location(m_in, tok_start);
+1 -1
View File
@@ -56,7 +56,7 @@ inline SourceLocation get_source_location(nonstd::string_view content, size_t po
size_t search_start = 0;
while (search_start <= sliced.size()) {
search_start = sliced.find("\n", search_start) + 1;
if (search_start <= 0) {
if (search_start == 0) {
break;
}
count_lines += 1;