From 4dea2f1eb66dca48052d2a7d616d2efaecac78cd Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 1 Sep 2025 17:51:25 +0200 Subject: [PATCH] Fix some Elvis reports --- elvis.config | 1 + src/mod_http_api.erl | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/elvis.config b/elvis.config index fb0f8b973..4ac4df9e1 100644 --- a/elvis.config +++ b/elvis.config @@ -16,6 +16,7 @@ {elvis_style, function_naming_convention, disable}, {elvis_style, god_modules, #{limit => 300}}, {elvis_style, invalid_dynamic_call, disable}, + {elvis_style, macro_names, disable}, {elvis_style, max_function_arity, disable}, % #{max_arity => 15}}, {elvis_style, nesting_level, disable}, {elvis_style, no_author, disable}, diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl index 68d5c4181..4d7e86777 100644 --- a/src/mod_http_api.erl +++ b/src/mod_http_api.erl @@ -145,12 +145,12 @@ process([Call | _], #request{method = 'POST', data = Data, ip = IPPort} = Req) - %% TODO We need to refactor to remove redundant error return formatting throw:{error, unknown_command} -> json_format({404, 44, <<"Command not found.">>}); - _:{error,{_,invalid_json}} = _Err -> - ?DEBUG("Bad Request: ~p", [_Err]), + _:{error,{_,invalid_json}} = Err -> + ?DEBUG("Bad Request: ~p", [Err]), badrequest_response(<<"Invalid JSON input">>); - ?EX_RULE(_Class, _Error, Stack) -> + ?EX_RULE(_Class, Error, Stack) -> StackTrace = ?EX_STACK(Stack), - ?DEBUG("Bad Request: ~p ~p", [_Error, StackTrace]), + ?DEBUG("Bad Request: ~p ~p", [Error, StackTrace]), badrequest_response() end; process([Call | _], #request{method = 'GET', q = Data, ip = {IP, _}} = Req) -> @@ -166,9 +166,9 @@ process([Call | _], #request{method = 'GET', q = Data, ip = {IP, _}} = Req) -> %% TODO We need to refactor to remove redundant error return formatting throw:{error, unknown_command} -> json_format({404, 44, <<"Command not found.">>}); - ?EX_RULE(_, _Error, Stack) -> + ?EX_RULE(_, Error, Stack) -> StackTrace = ?EX_STACK(Stack), - ?DEBUG("Bad Request: ~p ~p", [_Error, StackTrace]), + ?DEBUG("Bad Request: ~p ~p", [Error, StackTrace]), badrequest_response() end; process([_Call], #request{method = 'OPTIONS', data = <<>>}) ->