Cpplint style problem

How exactly am I supposed to fix the problem “include directory when naming header file” which makes some yellow lines under my #include “stuff” ?

If it’s just yellow lines, ignore them.
The VSCode extension uses very strict settings for style checking, while the test is more permissive.

You only need to fix problems that are reported by the test.

2 Likes

okay, but I do pass the tests on my VM but not on the Server, so I thought this might be the problem

do you have any other ideas about why I do pass the tests on my machine but not on the server?

Your server test results are still from an old commit.
Please wait until you get test results for today’s commits and ask again if they still don’t pass.

1 Like

actually I do have the same problem, I pass it locally but not on the server.

Sounds like a problem for the OH. The next one is tomorrow, 12:00 (sane time), at 0.15 E1.3

If I had just time to go :stuck_out_tongue:
I think I can guess what is the problem, I used the quick fix some times so the error was more or less just “removed” by commenting // NOLINT

but there is one thing I can’t really figure out: I am using scanf to figure out the guesses and it says “scanf without field width limits can crash with huge inputs”, so how do I put a field width limit on scanf?

You will notice that any lint suppressions will cause the style tests to fail as we want you to read and understand the linter warnings.

If the warning is simply in VSCode (and not make check) like the one for #include "dict.h", ignore it:

First, you have to understand the problem:
You give scanf a memory block to write text into. But if scanf writes all text it gets into the block, it might overflow the bounds leading to undefined behavior which is bad.
The more detailed explanation with solution attempts here:

  • one solution is adding a width modifier %42s for instance.
  • another is the (non-universal) memory allocation modifier.
  • you could use fgets.
  • you could read the input char by char
  • there are many other solutions
3 Likes