style: test determinism and doxygen additions to guide.#870
style: test determinism and doxygen additions to guide.#870mattklein123 merged 3 commits intoenvoyproxy:masterfrom
Conversation
* Document that tests should be deterministic and relevant mocks. * Rule against Doxygen in internal docs. I actually don't mind either way, this is a strawman that we can discuss during PR review.
|
@dnoe @mattklein123 feel free to opine on the Doxygen+internal comments point, I actually don't mind that much either way, as long as we have a consistent convention that we document. |
STYLE.md
Outdated
| how to best handle this. | ||
| * API-level comments should follow normal Doxygen conventions. Use `@param` to describe | ||
| parameters, `@return <return-type>` for return values. | ||
| parameters, `@return <return-type>` for return values. Internal comments for |
There was a problem hiding this comment.
I'll register my mild opposition to this here. It seems if we are going through the work to document internal methods and member variables then we might as well follow the Doxygen style. This is largely an academic point for member variables but for methods doxygen provides a structured way of documenting arguments and return semantics that is just as relevant for private methods. The default Doxygen config can be set up to ignore private docs, but for someone new to the code base being able to run Doxygen with the call graph feature and all private documentation enabled seems a good way to create browsable overview documentation (I've used this in past projects, but admittedly we had more extensive documentation of private data and methods from the beginning).
There was a problem hiding this comment.
I don't have a strong opinion here. I guess I would say that in a perfect world, all methods, etc. would have doxygen comments. Realistically though, it's hard enough to get people doing it for public methods and class comments, and I think in most cases people will just not comment on private methods/members instead of going through the whole doxygen dance. So, giving into the reality of human nature I would tend to agree with @htuch. But happy to get some more opinions.
There was a problem hiding this comment.
I don't necessarily think it should be mandatory to have doxygen comments for internal members/methods, just that if you're going to write such a comment it shouldn't be deliberately formatted to be ignored by Doxygen.
There was a problem hiding this comment.
It does increase the activation energy to comment by forcing people to document every arg/return. I might want to add a quick:
// foo does bar
int foo(char arg);
comment, I don't necessarily want to add full docs for return/args, but the documentation is better than nothing.
There was a problem hiding this comment.
I think I'd still prefer that we just relax the requirement for "going full doxygen" for private docs rather than mandating that private member/method have comments that Doxygen must ignore. Even in your example "foo does bar" is a perfectly reasonable comment for Doxygen to pick up as an internal method, extensive return type documentation isn't mandatory. In other words: Suggest but not require that private members/methods have a doxygen style comment, and make no hard mandates about all doxygen metadata being populated.
But, I like documenting things pretty extensively as part of my mental code writing process so that's my bias...
There was a problem hiding this comment.
Yeah I can't say that I really have a strong opinion what to codify here. I will let the two of you sort it out. :)
There was a problem hiding this comment.
OK. We've agreed that comment style for internal docs doesn't matter, but there should be some thought put into making the comment useful (e.g. talking about constraints on arguments etc.) when they are put there.
@dnoe will own adding proper Doxygen support to the build or stop using Doxygen in his internal comments ;)
|
LGTM. Doxygen also supports another C++ style, at least two consecutive lines of comments that begin with /// If we wanted to switch to that at some point a script could convert existing Doxygen javadoc style (/**) comments. Or process comments in either format, but I like consistency. I'm planning to push a PR over the next few days with an updated Doxygen file and the changes required to run it in CI. |
`//bazel:envoy_mobile_repositories.bzl::envoy_mobile_repositories()` Initializes all the `http_archive`, `http_file`, `http_jar` required by envoy mobile `//bazel:envoy_mobile_swift_bazel_support.bzl::swift_support()` Initializes the `@rules_foreign_cc//:workspace_definitions.bzl::rules_foreign_cc_dependencies()` and installs `build_bazel_apple_support` _after_ all the upstream envoy initializations `//bazel:envoy_mobile_dependencies.bzl::envoy_mobile_dependencies()` Initializes the dependencies from dependent repositories `//bazel:envoy_mobile_toolchains.bzl::envoy_mobile_toolchains()` Initializes toolchains required Signed-off-by: Alan Chiu <achiu@lyft.com> For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md) Description: bazel: lift dependencies out of WORKSPACE Risk Level: low Testing: CI Docs Changes: n/a Release Notes: n/a [Optional Fixes #Issue] [Optional Deprecated:] Signed-off-by: JP Simard <jp@jpsim.com>
`//bazel:envoy_mobile_repositories.bzl::envoy_mobile_repositories()` Initializes all the `http_archive`, `http_file`, `http_jar` required by envoy mobile `//bazel:envoy_mobile_swift_bazel_support.bzl::swift_support()` Initializes the `@rules_foreign_cc//:workspace_definitions.bzl::rules_foreign_cc_dependencies()` and installs `build_bazel_apple_support` _after_ all the upstream envoy initializations `//bazel:envoy_mobile_dependencies.bzl::envoy_mobile_dependencies()` Initializes the dependencies from dependent repositories `//bazel:envoy_mobile_toolchains.bzl::envoy_mobile_toolchains()` Initializes toolchains required Signed-off-by: Alan Chiu <achiu@lyft.com> For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md) Description: bazel: lift dependencies out of WORKSPACE Risk Level: low Testing: CI Docs Changes: n/a Release Notes: n/a [Optional Fixes #Issue] [Optional Deprecated:] Signed-off-by: JP Simard <jp@jpsim.com>
OSX and windows have issues with memalign. So test against tc_memalign instead. This should fix _memalign linker-time part of issue envoyproxy#870.
Weirdly, some OSX compiler does allow -fsized-deallocation, yet barks on any attempt to actually use it at compile time (!). So lets detect this as well in configure and opt out as necessary. Should fix issue envoyproxy#870.
Document that tests should be deterministic and relevant mocks.
Rule against Doxygen in internal docs. I actually don't mind either way, this is a strawman that we can discuss during PR review.