Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--root Parameter not working in Windows #22

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 2 comments
Open

--root Parameter not working in Windows #22

GoogleCodeExporter opened this issue Mar 24, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run `cpplint --root=include file.h`. The file.h is inside the directory 
`include\project`.

What is the expected output? What do you see instead?

Expected: cpplint performing its checks.
Instead:

    Traceback (most recent call last):
      File "C:\dev\cpplint\cpplint.py", line 4753, in <module>
        main()
      File "C:\dev\cpplint\cpplint.py", line 4746, in main
        ProcessFile(filename, _cpplint_state.verbose_level)
      File "C:\dev\cpplint\cpplint.py", line 4631, in ProcessFile
        extra_check_functions)
      File "C:\dev\cpplint\cpplint.py", line 4556, in ProcessFileData
        CheckForHeaderGuard(filename, lines, error)
      File "C:\dev\cpplint\cpplint.py", line 1409, in CheckForHeaderGuard
        cppvar = GetHeaderGuardCPPVariable(filename)
      File "C:\dev\cpplint\cpplint.py", line 1393, in GetHeaderGuardCPPVariable
        file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
      File "C:\dev\portable-python-2.7.5.1\App\lib\re.py", line 151, in sub
        return _compile(pattern, flags).sub(repl, string, count)
      File "C:\dev\portable-python-2.7.5.1\App\lib\re.py", line 242, in _compile
        raise error, v # invalid expression
    sre_constants.error: bogus escape (end of line)

What version of the product are you using? On what operating system?

Microsoft Windows 7 64 Bit [6.3.9600]
Python 2.7.5
cpplint.py from trunk

Please provide any additional information below.

By adding a backslash to the end of the --root value, the error doesn't occur, 
but the correct include guards aren't detected by cpplint.

Example: `cpplint --root=include\ file.h`

I expect the following output:

    file.h:8:  #ifndef header guard has wrong style, please use: PROJECT_FILE_H_  [build/header_guard] [5]
    ball.h:101:  #endif line should be "#endif  // PROJECT_FILE_H_"  [build/header_guard] [5]
    Done processing file.h
    Total errors found: 2

But instead, the following is generated:

    file.h:8:  #ifndef header guard has wrong style, please use: INCLUDE_PROJECT_FILE_H_  [build/header_guard] [5]
    ball.h:101:  #endif line should be "#endif  // INCLUDE_PROJECT_FILE_H_"  [build/header_guard] [5]
    Done processing file.h
    Total errors found: 2

Original issue reported on code.google.com by [email protected] on 12 Mar 2014 at 5:09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant