diff --git a/.github/workflows/cpplint.yml b/.github/workflows/cpplint.yml new file mode 100644 index 00000000..e100bf14 --- /dev/null +++ b/.github/workflows/cpplint.yml @@ -0,0 +1,13 @@ +# GitHub Action to run cpplint recursively on all pushes and pull requests +# https://github.com/cpplint/GitHub-Action-for-cpplint + +name: cpplint +on: [push, pull_request] +jobs: + cpplint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install cpplint + - run: cpplint --counting=detailed --filter=-build/namespaces,-legal,-readability,-runtime,-whitespace --recursive . diff --git a/linked-lists/c-or-cpp/doubly.cpp b/linked-lists/c-or-cpp/doubly.cpp index 1cf67434..ad8ba7a5 100644 --- a/linked-lists/c-or-cpp/doubly.cpp +++ b/linked-lists/c-or-cpp/doubly.cpp @@ -1,36 +1,36 @@ +#include #include -#include using namespace std; struct Node { -   int data; -   struct Node *prev; -   struct Node *next; +   int data; +   struct Node *prev; +   struct Node *next; }; struct Node* head = NULL; void insert(int newdata) { -   struct Node* newnode = (struct Node*) malloc(sizeof(struct Node)); -   newnode->data = newdata; -   newnode->prev = NULL; -   newnode->next = head; -   if(head != NULL) -   head->prev = newnode ; -   head = newnode; +   struct Node* newnode = (struct Node*) malloc(sizeof(struct Node)); +   newnode->data = newdata; +   newnode->prev = NULL; +   newnode->next = head; +   if(head != NULL) +   head->prev = newnode ; +   head = newnode; } void display() { -   struct Node* ptr; -   ptr = head; -   while(ptr != NULL) { -      cout<< ptr->data <<" "; -      ptr = ptr->next; -   } +   struct Node* ptr; +   ptr = head; +   while(ptr != NULL) { +      cout<< ptr->data <<" "; +      ptr = ptr->next; +   } } int main() { -   insert(3); -   insert(1); -   insert(7); -   insert(2); -   insert(9); -   cout<<"The doubly linked list is: "; -   display(); -   return 0; +   insert(3); +   insert(1); +   insert(7); +   insert(2); +   insert(9); +   cout<<"The doubly linked list is: "; +   display(); +   return 0; } diff --git a/multiplication/c-or-cpp/karatsuba.cpp b/multiplication/c-or-cpp/karatsuba.cpp index ecb8d0a5..b8871207 100644 --- a/multiplication/c-or-cpp/karatsuba.cpp +++ b/multiplication/c-or-cpp/karatsuba.cpp @@ -1,6 +1,6 @@ +#include #include #include -#include using namespace std; int equalize_strings(string &x, string &y) { diff --git a/strings/c-or-cpp/string-tokeniser.cpp b/strings/c-or-cpp/string-tokeniser.cpp index a92182fa..973335f6 100644 --- a/strings/c-or-cpp/string-tokeniser.cpp +++ b/strings/c-or-cpp/string-tokeniser.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include // NOLINT [build/c++11] using namespace std;