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

Generate comment with the name of the input IDL file #1925

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

knutpett
Copy link
Contributor

@knutpett knutpett commented Sep 13, 2022

Knowing which source IDL file was used to generated the code makes it easier to navigate in the code.

Summary by CodeRabbit

  • New Features
    • Introduced functionality that automatically adds a comment indicating the source file origin to generated code, improving traceability across various output elements.

Knowing which source IDL file was used to generated the code
makes it easier to navigate in the code.
@knutpett
Copy link
Contributor Author

@iguessthislldo

@knutpett
Copy link
Contributor Author

@jwillemsen: could you have a look at my PR? For later reference, how do I add reviewers to my PRs? Is it correct to tag/mention someone, or will eventually somebody look at the list of new PRs and pick them up?

@jwillemsen
Copy link
Member

I think only project members can add reviewers.

Open source support is really best effort, no guarantees when someone will pick it up, really depends on what people are working on. See https://github.com/DOCGroup/ACE_TAO/wiki/ACE-and-TAO-Commercial-support when you really want someone to have a look, at the end also we have to pay our bills. Merging a PR will trigger a lot of bills the next night, that is for example clearly visible on the power usage of our infrastructure :-(

@knutpett
Copy link
Contributor Author

My company have earlier paid OCI for support, for new features and/or bug fixes. And we will do that again if needed.

But for the "software gardening" PRs I've contributed just recently, do you still consider reviewing them as "support"? I understand it requires effort for you to review them. But I'm contributing improvements to the product, and my company is paying my salary doing this.

@jwillemsen
Copy link
Member

My time has to be payed by someone, I always try to review/respond as much as possible on github, but the time for that is very limited. I can't book time I spend here on the account of our customers unless I can proof to them that a specific PR has a concrete benefit for them and they give me permission to work on the PR/issue on their behalf.

@jwillemsen
Copy link
Member

Wouldn't it be better to place the file it generated from in the doxygen header in such a way doxygen also creates a link to the IDL file? The IDL filename should not include any path as the output of TAO_IDL should be independent of the location where the source IDL file is, else it is hard for people to compare the generated code between versions.

@knutpett
Copy link
Contributor Author

As an example: The file TAO/tao/IFR_Client/IFR_ExtendedS.h is generated from TAO/tao/IFR_Client/IFR_Extended.pidl. I want the generated code to include a reference to IFR_Extended.pidl. We could use the doxygen @file (or \file) tag like this:

// -*- C++ -*-
/**
* @file IFR_Extended.pidl
 * Code generated by the The ACE ORB (TAO) IDL Compiler v3.0.8
 * TAO and the TAO IDL Compiler have been developed by:
 *       Center for Distributed Object Computing
 *       Washington University
 *       St. Louis, MO
 *       USA
 * and
 *       Distributed Object Computing Laboratory
 *       University of California at Irvine
 *       Irvine, CA
 *       USA
 * and
 *       Institute for Software Integrated Systems
 *       Vanderbilt University
 *       Nashville, TN
 *       USA
 *       https://www.isis.vanderbilt.edu/
 *
 * Information about TAO is available at:
 *     https://www.dre.vanderbilt.edu/~schmidt/TAO.html
 **/

@jwillemsen
Copy link
Member

Isn't @file to document the name of the current file? See https://doxygen.nl/manual/commands.html#cmdfile.

@knutpett
Copy link
Contributor Author

Yes it is. But I don't want to refer to the current file, I want to refer to the source IDL file.

@vermaete
Copy link
Contributor

Could this info be under a configuration condition?
So, if not set no comments will be generated to trace and debug this info?
My, although small, issue with it is that the QA checks in Yocto will complain about an path to a temp place in the generated code.

And kind of the same for the '// TAO_IDL - Generated from' comments.

Br

@knutpett
Copy link
Contributor Author

Could this info be under a configuration condition? So, if not set no comments will be generated to trace and debug this info? My, although small, issue with it is that the QA checks in Yocto will complain about an path to a temp place in the generated code.

I'm not including the full path to the file, just the "basename", so in the example above it would just be "IFR_Extended.pidl". (This is different from the '// TAO_IDL - Generated from' comments.)

@mitza-oci
Copy link
Member

I built libTAO locally with the merge commit of this PR. For reference, the generated code looks like this:

// -*- C++ -*-
/**
 * Code generated by the The ACE ORB (TAO) IDL Compiler v3.1.1
 * TAO and the TAO IDL Compiler have been developed by:
[...]
 *
 * Information about TAO is available at:
 *     https://www.dre.vanderbilt.edu/~schmidt/TAO.html
 **/
// Generated from: BooleanSeq.pidl

Is there consensus to (or not to) merge these two comments and use the @file doxygen command?

@jwillemsen
Copy link
Member

I would prefer to have the Generate from part within the doxygen block so that it appears in the doxygen docu

Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Walkthrough

The pull request adds a new method, gen_generated_from_comment, to the TAO_CodeGen class. This method writes a comment to a provided output stream that includes the source IDL filename. The implementation in be_codegen.cpp is integrated by calling the method at the start of multiple code generation functions, while the corresponding declaration is added in be_codegen.h. These changes improve the traceability of the generated code by annotating it with its originating IDL file.

Changes

File(s) Change Summary
TAO/.../be_codegen.cpp, TAO/.../be_codegen.h Added new method gen_generated_from_comment in TAO_CodeGen. In the implementation file, the method outputs a comment with the source IDL file, and it is invoked at the start of several code generation functions. The header file receives the corresponding declaration.

Sequence Diagram(s)

sequenceDiagram
    participant CG as TAO_CodeGen
    participant OS as TAO_OutStream

    CG->>OS: gen_generated_from_comment()
    OS-->>CG: Write comment ("Generated from <filename>")
Loading

Poem

I’m a rabbit in a code-filled glen,
Hopping through functions again and again.
A comment now marks our source with pride,
Guiding the coder on a merry ride.
Happy hops in code and carrots to all!
🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6a1599 and 4722d36.

📒 Files selected for processing (2)
  • TAO/TAO_IDL/be/be_codegen.cpp (16 hunks)
  • TAO/TAO_IDL/be_include/be_codegen.h (1 hunks)
🔇 Additional comments (3)
TAO/TAO_IDL/be_include/be_codegen.h (1)

394-394: LGTM! Clean and well-placed method declaration.

The method declaration is clear, appropriately placed in the public section, and uses the correct parameter type for output generation.

TAO/TAO_IDL/be/be_codegen.cpp (2)

3833-3837: LGTM! Clean implementation.

The implementation is simple, focused, and uses the correct source for the IDL filename.


148-148: LGTM! Consistent usage pattern across all code generation functions.

The new method is correctly and consistently called at the start of each code generation function, ensuring that the source IDL file is documented in all generated files.

Also applies to: 373-373, 456-456, 583-583, 635-635, 696-696, 773-773, 1006-1006, 1107-1107, 1148-1148, 1228-1228, 1433-1433, 1503-1503, 1580-1580, 1635-1635

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

4 participants