Skip to content

Suggestion: Have the CI warn about or remove unused includes. #3474

Open

Description

@jachymb

Inspired by my recent PR #3470 which does a sweeping cleanup of redundant includes.

I think the CI in theory should be able to handle this automatically and either straight up remove the redundant includes at least give the submitter some sort of warning. Clang has some of this functionality and is already in use.

This may be tricky in some cases however, for example there are files where the only thing the include is necessary for is a namespace and of course there are the bulk include header files whose sole purpose is to have redundant includes. So this may need some more nuance configuration which I'm not sure how to do exactly. See #3470 for some more details.

Another idea: It would be nice to have the includes sorted alphabetically, but there are some cases where it's actually order dependent, especially when including libraries outside math, so again this can't be done in the most straightforward way and perhaps needs some grouping of includes.

Activity

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

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