Skip to content

Include paths with '.' and '..' aliases should not be allowed #432

@Mercotui

Description

@Mercotui

Hey,
I just noticed that this code passes cpplint 2.0.2:

#include "../foo/bar.h"

I would expect this to be disallowed, as stated here:

All of a project's header files should be listed as descendants of the project's source directory without use of UNIX directory aliases . (the current directory) or .. (the parent directory).

Full test setup:

I have the file foo/bar.cpp with contents:

// Copyright 2026 Acme Corp
#include "../include/foo/bar.h"

#include "../private/./test.h"

and the header foo/bar.h which is just an empty file, which needs to exist for the linter to run CheckHeaderFileIncluded.

I then run cpplint:

$ cpplint.py foo/bar.cpp
Done processing foo/bar.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions