GithubHelp home page GithubHelp logo

cppstyle's Introduction

cppstyle

A style checker for C/C++ based on clang Edit

Usage

Local

First, you need a proper version of libclang and it's python bindings.

  • Arch: yaourt -S python-clang
  • Ubuntu Xenial: apt-get install python-pip python-clang-3.8 libclang-3.8-dev

Then just install it using pip:

pip install cppstyle

Run it!

cppstyle --config /path/to/.cppstyle -i /path/to/[YourCFile]

Docker

Run it!

docker run -v /path/to/code:/code gfelbing/cppstyle cppstyle --config /code/.cppstyle -i /code/[YourCFile]

Configuration

cppstyle is configured using a yaml file. By default, it uses the .cppstyle in your current directory.

You can specify another path using the --config option.

For a full example, see .cppstyle in this repository. Every configuration is optional, a missing configuration means no checks on it.

cppstyle's People

Stargazers

 avatar

Watchers

James Cloos avatar Georg Welzel avatar

Forkers

hugh13245

cppstyle's Issues

Wrong result for header file

Hi,

I have a class in my source file, and its name is falsely reported as violating variable naming rule, the log is like:

    [Line 29, Col 0]: Variable 'XxxYyyZzz' does not match '^([a-z0-9]+)([A-Z0-9][a-z0-9]*)*$'

And following is part of my .cppstyle:

naming:
    classes: ^([A-Z][a-z0-9]*)+$
    variables: ^([a-z0-9]+)([A-Z0-9][a-z0-9]*)*$

By checking the function to_node in parser.py, it seems the kind of my class is CursorKind.VAR_DECL so it will return a Variable object.

Have you met this problem before? Thanks.

order - access_specifier_required false alarm for inherited class

For the following cpp file:

class Dummy {
};

class Foo : public Dummy {
    protected:
    public:
    private:
        class Bar {
            string without_specifier;
        }
}

It gives the following issues:

Class 'Foo' should have an access specifier at first.
Class 'Bar' should have an access specifier at first.

But actually the class Foo have access specifiers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.