Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: add more linters for using absl:: over std:: #13043

Merged
merged 10 commits into from
Sep 11, 2020

Conversation

rebello95
Copy link
Contributor

@rebello95 rebello95 commented Sep 10, 2020

Follow up to #13040. Some of these examples are based on absl docs and C++ docs.

These linters are here to prevent additional breakages of Envoy Mobile on iOS due to usages of std:: types/functions that are not supported on iOS 11. More discussion in #12341.

Risk Level: Low
Testing: In PR

Signed-off-by: Michael Rebello [email protected]

@mk46
Copy link
Contributor

mk46 commented Sep 10, 2020

Sorry, format check fails and run ci/run_envoy_docker.sh 'ci/do_ci.sh fix_format' to fix it.

@htuch htuch self-assigned this Sep 10, 2020
@htuch
Copy link
Member

htuch commented Sep 10, 2020

LGTM modulo format fix.

Signed-off-by: Michael Rebello <[email protected]>
@rebello95
Copy link
Contributor Author

Thanks. Running the docker command didn't work for me but I fixed locally and pushed

Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add the entire (commonly used) API for variants, which unfortunately for this purpose are free functions, not members, so they all need a linter entry:

std::holds_alternative
std::get
std::monostate
std::get_if

@mattklein123
Copy link
Member

Also, while you are in here did we ever add a linter for string_view? We need that also.

@rebello95 rebello95 changed the title lint: add linter for preferring absl::visit over std::visit lint: add more linters for using absl:: over std:: Sep 10, 2020
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
@rebello95
Copy link
Contributor Author

Done, added additional linters / test cases.

ggreenway
ggreenway previously approved these changes Sep 10, 2020
Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@rebello95
Copy link
Contributor Author

Hm, looks like there are a lot of usages of std::get in the codebase today, which is why the linter is failing. Are you sure we need that one @ggreenway?

@ggreenway
Copy link
Contributor

Hm, looks like there are a lot of usages of std::get in the codebase today, which is why the linter is failing. Are you sure we need that one @ggreenway?

Huh, std::get is used for both tuples and variants. We want to lint for only the uses with variant, not tuple, probably. But that's well into the realm of needing clang-tidy. So for now, I'd say remove the std::get one.

Signed-off-by: Michael Rebello <[email protected]>
@rebello95
Copy link
Contributor Author

Sounds good, removed.

@rebello95
Copy link
Contributor Author

@mattklein123
Copy link
Member

I thought we had decided somehow that string_view doesn't work on Envoy Mobile? I'm confused. cc @junr03 @goaway

@junr03
Copy link
Member

junr03 commented Sep 11, 2020

@rebello95 looks like those uses are all in extensions code we don't include/compile into Envoy Mobile. Hence why they are in the codebase here but causes no trouble to Envoy Mobile.

But yes, the decision was to not use std::string_view, so the linter change here to prohibit it is great, thanks!

@rebello95
Copy link
Contributor Author

Thanks for confirming @junr03! I pushed a change to fix the violations from the main branch.

mattklein123
mattklein123 previously approved these changes Sep 11, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

Signed-off-by: Michael Rebello <[email protected]>
@rebello95
Copy link
Contributor Author

Coverage failure looks unrelated

@mattklein123
Copy link
Member

I think coverage on main branch is broken somehow due to recent limit changes. I will merge this and we can sort it out there.

@mattklein123 mattklein123 merged commit 48d739b into envoyproxy:master Sep 11, 2020
@rebello95 rebello95 deleted the std-visit-linter branch September 11, 2020 23:09
@rebello95
Copy link
Contributor Author

Thanks!

lhluo pushed a commit to lhluo/envoy that referenced this pull request Sep 11, 2020
…code

* upstream/master:
  lint: add more linters for using absl:: over std:: (envoyproxy#13043)
  udpa: filesystem list collection support for inline entries. (envoyproxy#13028)
  filter: http: jwt: implement matching for HTTP CONNECT (envoyproxy#13064)
  [fuzz] split http filter logic into a fuzzing class (envoyproxy#13016)
  xds: allow empty delta update (envoyproxy#12699)
  CacheFilter: parses the allowed_vary_headers from the cache config. (envoyproxy#12928)
  router: extend HTTP CONNECT route matching criteria (envoyproxy#13056)
  docs: clarify use of Extended CONNECT for h/2 (envoyproxy#13051)
  build: shellcheck tools/ (envoyproxy#13007)
  [fuzz] Refactored Health Checker Impl Tests (envoyproxy#13017)

Signed-off-by: Lihao Luo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants