GitHub Action to lint C and C++ code (#156)

* GitHub Action to lint C and C++ code

GitHub Action to run cpplint recursively on all pushes and pull requests https://github.com/cpplint/GitHub-Action-for-cpplint

* Update cpplint.yml

* Update cpplint.yml

* Update cpplint.yml

* Fix import order

Found C system header after C++ system header. Should be: doubly.h, c system, c++ system, other.  [build/include_order] [4]

* Fix import order

* Update string-tokeniser.cpp
pull/168/head
Christian Clauss 2021-04-11 19:48:29 +02:00 committed by GitHub
parent 0459f08eeb
commit d7860a161e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 27 deletions

13
.github/workflows/cpplint.yml vendored 100644
View File

@ -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 .

View File

@ -1,36 +1,36 @@
#include <bits/stdc++.h>
#include <iostream> #include <iostream>
#include<bits/stdc++.h>
using namespace std; using namespace std;
struct Node { struct Node {
   int data;    int data;
   struct Node *prev;    struct Node *prev;
   struct Node *next;    struct Node *next;
}; };
struct Node* head = NULL; struct Node* head = NULL;
void insert(int newdata) { void insert(int newdata) {
   struct Node* newnode = (struct Node*) malloc(sizeof(struct Node));    struct Node* newnode = (struct Node*) malloc(sizeof(struct Node));
   newnode->data = newdata;    newnode->data = newdata;
   newnode->prev = NULL;    newnode->prev = NULL;
   newnode->next = head;    newnode->next = head;
   if(head != NULL)    if(head != NULL)
   head->prev = newnode ;    head->prev = newnode ;
   head = newnode;    head = newnode;
} }
void display() { void display() {
   struct Node* ptr;    struct Node* ptr;
   ptr = head;    ptr = head;
   while(ptr != NULL) {    while(ptr != NULL) {
      cout<< ptr->data <<" ";       cout<< ptr->data <<" ";
      ptr = ptr->next;       ptr = ptr->next;
   }    }
} }
int main() { int main() {
   insert(3);    insert(3);
   insert(1);    insert(1);
   insert(7);    insert(7);
   insert(2);    insert(2);
   insert(9);    insert(9);
   cout<<"The doubly linked list is: ";    cout<<"The doubly linked list is: ";
   display();    display();
   return 0;    return 0;
} }

View File

@ -1,6 +1,6 @@
#include <math.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <math.h>
using namespace std; using namespace std;
int equalize_strings(string &x, string &y) { int equalize_strings(string &x, string &y) {

View File

@ -1,6 +1,6 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <chrono> #include <chrono> // NOLINT [build/c++11]
using namespace std; using namespace std;