Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Failed to figure out the correct repository path  #193

@xiumingzhang

Description

@xiumingzhang

First of all, thanks for the amazing linter.

Background

I'm using cpplint as a neomake maker in my nvim, but the same behavior is observed when I use cpplint directly as a command line tool.

My file tree looks like this:

/Users/x/
|    .git/
|    repo/
|    |    project/
|    |    |    .git/
|    |    |    src/

Problem

When I work on /Users/x/repo/project/src/mylib.h, cpplint tells me to use REPO_PROJECT_SRC_MYLIB_H_ for my header guard, so cpplint apparently thinks my repository is /Users/x/ (where the first .git/ lies), but the correct repository should be /Users/x/repo/project/ (where the second .git/ lies).

Unsurprisingly, the problem is gone when I append --repository=/Users/x/repo/project, but this would require me to feed in different --repository flags when working on different repositories. What's worse is that in my case where cpplint is used as a nvim plugin, I will have to edit my "nvimrc" (init.vim) every time I switch repository. This definitely sounds wrong, or at least suboptimal.

Expected Behavior

When no --repository flag is supplied, cpplint should figure out the correct repository path , i.e., /Users/x/repo/project, "by searching for a path that contains .git, .hg, or .svn.", according to cpplint -h.

I'm also interested in any workaround that separately figures out the repository path (using some other unix tools) and then sets --repository for cpplint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions