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

fix(core): Add missing ../ to fix relative header file includes. #627

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

Bill-hbrhbr
Copy link
Contributor

@Bill-hbrhbr Bill-hbrhbr commented Dec 8, 2024

Description

In the old structure of clp-core, individual modules like clp-s, glt and reducer are all under the same path as the rest of the clp-core source files, which is <project>/components/core/src.
After encapsulating the rest of the files into a single clp module, there are now four modules under <project>/components/core/src: clp, clp-s, glt and reducer.

If files inside the clp module need to refer to files in the other three modules, their #include paths will need to move up an extra level.
There are also other scenarios where the header files need updates, and they are all included in this PR.

Discovery

As I was working on porting utility libraries like string_utils and regex_utils to a new repo, I found out that removing these folders created compilation errors. Upon further investigation, these libraries' CMake files contain the following line:
target_include_directories(<utils_library_name> PUBLIC ../)
where ../ is the path <project_root>/components/core/src/clp

Without this line, string_utils and regex_utils cannot be found. But with this line, files (that are not meant to be libraries) under <project_root>/components/core/src/clp can be included without specifying the correct relative path.

After removing these library folders and fixing all string_utils and regex_utils include paths, the remaining compilation errors would all be due to the incorrect relative paths. This PR fixes all these incorrect includes.

Fixing these include paths won't affect anything for now, but it will simply PRs down the road when we are ready to move string_utils and regex_utils out of clp-core.

Validation performed

All compilations succeed after performing the operations described above, and unit tests have passed as usual.

Summary by CodeRabbit

  • New Features

    • Enhanced command-line argument parsing with additional options and improved error handling.
    • Streamlined error reporting for file reading operations.
  • Bug Fixes

    • Improved clarity of error messages for unknown and unspecified commands.
    • Enhanced validation for required command options.
  • Documentation

    • Updated help messages to provide clearer guidance on command usage.
  • Chores

    • Restructured include directives for better organization.

Copy link
Contributor

coderabbitai bot commented Dec 8, 2024

Walkthrough

The pull request introduces significant modifications across several files, primarily focusing on enhancing command-line argument parsing and improving error handling. Key changes include restructuring include paths for header files, refining the parsing logic in CommandLineArguments.cpp, and enhancing error handling in various methods. The updates also include better organization of command-line options and clearer error messages for user guidance. Overall, the changes aim to improve the robustness and clarity of the command-line interface without altering the fundamental functionalities of the affected components.

Changes

File Change Summary
components/core/src/clp/clo/CommandLineArguments.cpp Updated header inclusion paths; enhanced parse_arguments, parse_ir_extraction_arguments, and parse_search_arguments methods with new command options and error handling; improved help message visibility.
components/core/src/clp/clp/FileDecompressor.hpp Updated include paths for header files; no changes to class methods or functionality.
components/core/src/clp/clp/decompression.cpp Changed include path for constants.hpp; clarified decompression logic and error handling; refined handling of input parameters.
components/core/src/clp/clp/utils.cpp Updated include paths; enhanced error handling in read_input_paths and validate_paths_exist functions; no changes to core logic.
components/core/src/clp/clp/utils.hpp Updated include paths for header files; no changes to class or function signatures.
components/core/src/clp/ir/EncodedTextAst.cpp Updated include path for decoding_methods.hpp; no changes to method logic or error handling.
components/core/src/clp/ir/LogEvent.hpp Updated include path for time_types.hpp; no changes to class or method definitions.
components/core/src/clp_s/CommandLineArguments.cpp Updated include path for type_utils.hpp; enhanced parse_arguments method with improved error handling and command processing logic.

Possibly related PRs

Suggested reviewers

  • kirkrodrigues
  • gibber9809

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 60d85d0 and ace4d66.

📒 Files selected for processing (8)
  • components/core/src/clp/clo/CommandLineArguments.cpp (1 hunks)
  • components/core/src/clp/clp/FileDecompressor.hpp (1 hunks)
  • components/core/src/clp/clp/decompression.cpp (1 hunks)
  • components/core/src/clp/clp/utils.cpp (1 hunks)
  • components/core/src/clp/clp/utils.hpp (1 hunks)
  • components/core/src/clp/ir/EncodedTextAst.cpp (1 hunks)
  • components/core/src/clp/ir/LogEvent.hpp (1 hunks)
  • components/core/src/clp_s/CommandLineArguments.cpp (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • components/core/src/clp/ir/LogEvent.hpp
  • components/core/src/clp/ir/EncodedTextAst.cpp
  • components/core/src/clp/clp/utils.hpp
  • components/core/src/clp/clp/FileDecompressor.hpp
🧰 Additional context used
📓 Path-based instructions (4)
components/core/src/clp/clp/decompression.cpp (1)

Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

components/core/src/clp_s/CommandLineArguments.cpp (1)

Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

components/core/src/clp/clp/utils.cpp (1)

Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

components/core/src/clp/clo/CommandLineArguments.cpp (1)

Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

🔇 Additional comments (4)
components/core/src/clp/clo/CommandLineArguments.cpp (1)

11-11: Updated Include Directive

The include path has been updated to #include "../../reducer/types.hpp". Ensure that this path is correct according to the project's directory structure and does not introduce any compilation issues.

components/core/src/clp_s/CommandLineArguments.cpp (1)

9-9: Include Path Adjustment

The inclusion of #include "../clp/type_utils.hpp" adjusts the include path to reflect changes in the directory structure. Confirm that this path is correct and that the type_utils.hpp header is accessible during compilation.

components/core/src/clp/clp/utils.cpp (1)

12-13: Updated Include Directives

The include paths for Constants.hpp and TraceableException.hpp have been updated to #include "../streaming_archive/Constants.hpp" and #include "../TraceableException.hpp". Verify that these paths correctly reference the intended headers and align with the updated directory structure.

components/core/src/clp/clp/decompression.cpp (1)

10-10: Updated Include Directive

The include path has been changed to #include "../ir/constants.hpp". Ensure that this reflects the correct directory structure and that the constants.hpp header is accessible during compilation.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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.

Copy link
Member

@LinZhihao-723 LinZhihao-723 left a comment

Choose a reason for hiding this comment

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

For PR title, how about:

fix(core): Add missing `../` to fix relative header file includes.

Also, please remember to add a period at the end of the PR title :D

@Bill-hbrhbr Bill-hbrhbr changed the title chore(core): Fix include paths that use an older directory structure of clp-core fix(core): Add missing ../ to fix relative header file includes. Dec 19, 2024
@Bill-hbrhbr Bill-hbrhbr merged commit 594968a into y-scope:main Dec 19, 2024
27 checks passed
@Bill-hbrhbr Bill-hbrhbr deleted the fix-include-headers branch December 19, 2024 05:12
davidlion pushed a commit to Bill-hbrhbr/clp that referenced this pull request Dec 20, 2024
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.

2 participants