Skip to content

sock_addr_validate: remove redundant expression#418

Merged
cperciva merged 1 commit intomasterfrom
fix-clang-tidy
Mar 11, 2025
Merged

sock_addr_validate: remove redundant expression#418
cperciva merged 1 commit intomasterfrom
fix-clang-tidy

Conversation

@gperciva
Copy link
Member

@gperciva gperciva commented Mar 8, 2025

No description provided.

@gperciva
Copy link
Member Author

gperciva commented Mar 8, 2025

Whoops, this slipped through the cracks.

I normally run clang-tidy for new features, but to save time I omit libcperciva/ files from the check because I figure those files will be checked when I run clang-tidy in that repository.

Then when I was importing this change to libcperciva, I didn't bother with clang-tidy because it was only importing a commit, not "new" code.

@cperciva
Copy link
Member

The original code was redundant but was easier to understand -- "check for a missing hostname" doesn't make sense by itself since local socket paths don't have hostnames. We can change the code if you want to keep clang-tidy happy but the comment should explain that local socket paths will pass the test since they start with /.

If we start with ':', then that character can't be '/'!

This should have been part of:
    2025-01-12 sock_util: add sock_addr_validate()
    856d33c

Reported by:	clang-tidy-19 misc-redundant-expression
@gperciva
Copy link
Member Author

Ok, revised comment. It feels a bit wordy, but I couldn't think of a shorter way without ambiguity.

In case you were wondering: I disable approximately 70 clang-tidy checks; the remainder are ones which I think could give useful warnings in some cases.

@cperciva cperciva merged commit 8d9fa96 into master Mar 11, 2025
2 checks passed
@gperciva gperciva deleted the fix-clang-tidy branch March 11, 2025 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants