Page MenuHomePhabricator

[linter] Sanitize the headers include guard
ClosedPublic

Authored by Fabien on Jul 27 2022, 19:36.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABC355d6d48e429: [linter] Sanitize the headers include guard
Summary

Replace with an underscore any non alphanumerical character. This will ensure that paths like /src/foo-bar/baz.h doesn't generate an invalid include guard.

Test Plan

Create a directory in src with some non alphanum char, and a header.h file in that directory. Check the linter returns a sanitizer include guard.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Jul 27 2022, 19:36
sdulfari requested changes to this revision.Jul 28 2022, 02:46
sdulfari added a subscriber: sdulfari.
sdulfari added inline comments.
arcanist/linter/IncludeGuardLinter.php
66 ↗(On Diff #34539)

I'm unsure of the impact of not having underscore in the exclusion list, so I have to ask if it's worth adding?

This revision now requires changes to proceed.Jul 28 2022, 02:46
Fabien requested review of this revision.Jul 28 2022, 07:24
Fabien added inline comments.
arcanist/linter/IncludeGuardLinter.php
66 ↗(On Diff #34539)

That means that an underscore will get replaced by an underscore, so it's completely the same but with a simpler regex.

This revision is now accepted and ready to land.Jul 28 2022, 14:41
This revision was automatically updated to reflect the committed changes.