Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Commit

Permalink
chore: add lgtm PR analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Jan 18, 2019
1 parent 3ad948e commit 1047be2
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extraction:
cpp:
prepare:
packages:
- libwebsockets-dev
- libuv1-dev
python:
python_setup:
version: 3
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
> A library for easy HTTP and websockets messaging in C++ applications.
[![Travis CI](https://img.shields.io/travis/BlueBrain/Rockets/master.svg?style=flat-square)](https://travis-ci.org/BlueBrain/Rockets)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/BlueBrain/Rockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlueBrain/Rockets/context:cpp)


# Table of Contents
Expand Down
1 change: 1 addition & 0 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
> A small client for [Rockets](../README.md) using [JSON RPC](https://www.jsonrpc.org) as communication contract over a [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
[![Travis CI](https://img.shields.io/travis/BlueBrain/Rockets/master.svg?style=flat-square)](https://travis-ci.org/BlueBrain/Rockets)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/BlueBrain/Rockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlueBrain/Rockets/context:javascript)


# Table of Contents
Expand Down
1 change: 1 addition & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![Latest version](https://img.shields.io/pypi/v/rockets.svg)](https://pypi.org/project/rockets/)
[![Python versions](https://img.shields.io/pypi/pyversions/rockets.svg)](https://pypi.org/project/rockets/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/BlueBrain/Rockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/BlueBrain/Rockets/context:python)


# Table of Contents
Expand Down
2 changes: 1 addition & 1 deletion rockets/http/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ std::future<Response> Client::request(const std::string& uri,
const Method method, std::string body)
{
auto promise = std::make_shared<std::promise<Response>>();
auto callback = [promise](Response response) {
auto callback = [promise](Response&& response) {
promise->set_value(std::move(response));
};
auto errorCallback = [promise](std::string e) {
Expand Down
4 changes: 3 additions & 1 deletion rockets/jsonrpc/asyncReceiverImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "receiverImpl.h"
#include "utils.h"

Expand Down Expand Up @@ -50,7 +52,7 @@ class AsyncReceiverImpl : public ReceiverImpl
}

const auto& func = _methods[method];
func(request, [respond, requestID](const Response rep) {
func(request, [respond, requestID](const Response& rep) {
// No reply for valid "notifications" (requests without an "id")
if (requestID.is_null())
respond(json());
Expand Down
2 changes: 2 additions & 0 deletions rockets/jsonrpc/cancellableReceiverImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "asyncReceiverImpl.h"
#include "helpers.h"
#include "utils.h"
Expand Down
2 changes: 1 addition & 1 deletion rockets/jsonrpc/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void HttpCommunicator::sendText(std::string message)
// http::Client (which aborts pending requests, calling the error callback).
const auto& cb = callback;
client.request(url, http::Method::POST, std::move(message),
[cb](http::Response response) {
[cb](http::Response&& response) {
if (cb)
cb(ws::Request{std::move(response.body)});
},
Expand Down
2 changes: 2 additions & 0 deletions rockets/jsonrpc/receiverImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "requestProcessor.h"
#include "utils.h"

Expand Down
2 changes: 1 addition & 1 deletion rockets/jsonrpc/requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ClientRequest<Response> Requester::request(const std::string& method,
const std::string& params)
{
auto promise = std::make_shared<std::promise<Response>>();
auto callback = [promise](Response response) {
auto callback = [promise](Response&& response) {
promise->set_value(std::move(response));
};
return {request(method, params, callback), promise->get_future(),
Expand Down
4 changes: 2 additions & 2 deletions rockets/jsonrpc/requester.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Requester : public Notifier
const Params& params)
{
auto promise = std::make_shared<std::promise<RetVal>>();
auto callback = [promise](Response response) {
auto callback = [promise](const Response& response) {
if (response.isError())
promise->set_exception(
std::make_exception_ptr(response_error(response.error)));
Expand Down Expand Up @@ -114,7 +114,7 @@ class Requester : public Notifier
ClientRequest<RetVal> request(const std::string& method)
{
auto promise = std::make_shared<std::promise<RetVal>>();
auto callback = [promise](Response response) {
auto callback = [promise](const Response& response) {
if (response.isError())
promise->set_exception(
std::make_exception_ptr(response_error(response.error)));
Expand Down

0 comments on commit 1047be2

Please sign in to comment.