-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
cpplint does not lint C++ files with the .C
suffix
#3128
Comments
Interesting report! I clearly see that something isn't going quite right. |
Could you tell us what version of Megalinter it is running, and is it locally, or on CI (if so, is it GitHub Actions?). Is it using a flavor, if yes, which one? If you are locally, on what platform are you on? Is your file system case-sensitive? I know for example that on windows, NTFS is not case-sensitive, but case-preserving. This case of having a file with the same name, except the case of the extension would probably not work on windows. There was some changes recently where we are starting to have a c and a cpp flavor in order to have more linters in that category, and having clang-format. But these aren't out yet. It might also help us to know if the same thing happens with the beta versions too (that are the main branch) |
Hi @echoix , thanks for your quick feedback. |
To try to discriminate between a problem with file handling or extension handling, a useful case to check would be
|
Maybe try the beta flavor to make sure it isn't something fixed in another version :s |
The name does not seem to matter. I created the |
Will try. |
Ok thanks a lot! I won't investigate tonight, but it's pretty descriptive! |
With files CPP_CPPLINT_FILE_EXTENSIONS: [".A", ".b", ".c", ".C", ".h", ".cxx", ".cpp"] I get the following:
Again, locally cpplint works as expected, when provided with the That makes me suspect that the following is happening:
|
@vkucera your analysis seems right ! :)
We can adapt MegaLinter to such behavior, probably by defining a python class to override some methods, but it is quite uncommon compared to many other linters ;) |
@nvuillam , if you can confirm that MegaLinter indeed does not call the |
If you can do this when CPP_CPPLINT_ARGUMENTS = "--extensions=" + ",".join(e[1:] for e in CPP_CPPLINT_FILE_EXTENSIONS) Of course provided that the potential |
@vkucera why not just listing the extensions from the list of files sent as arguments and dynamically create --extensions= argument ? ^^ |
Which is equivalent to creating the |
@vkucera probably but in case there are other constraints (FILTER_REGEX_EXCLUDE, etc....) , that way we'll be sure to send only the file extensions related to the list of files, not more extensions that are not matching files in the repo :) PR on the way |
… --extensions parameter Fixes #3128 Co-authored-by: Vít Kučera <26327373+vkucera@users.noreply.github.com>
… --extensions parameter (#3149) * cpplint: Dynamically add the list of extensions from list of files in --extensions parameter Fixes #3128 Co-authored-by: Vít Kučera <26327373+vkucera@users.noreply.github.com> * [MegaLinter] Apply linters fixes * Fix way to get extension * remove dot * [MegaLinter] Apply linters fixes * Bug fix --------- Co-authored-by: nvuillam <nvuillam@users.noreply.github.com> Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com> Co-authored-by: nvuillam <nicolas.vuillamy@cloudity.com>
Describe the bug
Adding
".C"
inCPP_CPPLINT_FILE_EXTENSIONS
in.mega-linter.yml
does not make cpplint lint C++ files with the.C
suffix.Adding
".c"
works as expected.To Reproduce
Steps to reproduce the behavior:
".C", ".c",
inCPP_CPPLINT_FILE_EXTENSIONS
in.mega-linter.yml
testCpplint.C
andtestCpplint.c
with some C++ code.Expected behavior
Both files should be linted with the same errors reported.
Additional context
Adding only one suffix at a time
Include
.C
No output is produced which is inconsistent with the case where both suffixes are added.
Include
.c
Running cpplint directly
Executing
cpplint
locally on both files produces expected identical output.$ cpplint --extensions=C,c,c++,cc,cpp,cu,cuh,cxx,h,h++,hh,hpp,hxx testCpplint.C testCpplint.C:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] Done processing testCpplint.C Total errors found: 1
$ cpplint --extensions=C,c,c++,cc,cpp,cu,cuh,cxx,h,h++,hh,hpp,hxx testCpplint.c testCpplint.c:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] Done processing testCpplint.c Total errors found: 1
The text was updated successfully, but these errors were encountered: