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

Capivara #305

Open
wants to merge 9 commits into
base: capybarra
Choose a base branch
from
Open

Conversation

cristiancmoises
Copy link

Removed Redundant Checks: Changed checks for empty strings to checks for NOT which is more idiomatic in CMake.

Directly Using CMake Variables: Removed unnecessary variable assignments when they were not modified.

Improved Comments: Enhanced comments

Used CMAKE_COMMAND for add_custom_command: Used CMAKE_COMMAND to ensure the command is properly resolved.

Consistent Quoting: Used consistent quoting for variable expansions to prevent issues with paths containing spaces.

Removed Redundant Checks: Changed checks for empty strings to checks for NOT which is more idiomatic in CMake.

    Directly Using CMake Variables: Removed unnecessary variable assignments when they were not modified.

    Improved Comments: Enhanced comments 

    Used CMAKE_COMMAND for add_custom_command: Used CMAKE_COMMAND to ensure the command is properly resolved.

    Consistent Quoting: Used consistent quoting for variable expansions to prevent issues with paths containing spaces.

Signed-off-by: Cristian Cezar Moisés <[email protected]>
Error Handling: Added set -e to exit the script if any command fails.

Echo Statements: Included echo statements for better visibility and user feedback during the installation process.

Variable Usage: Used variables for CMake version and filename to make future updates easier.

PPA Updates: Added -y to the add-apt-repository commands to automatically confirm and prevent interruptions.

Cleanup: Consolidated cleanup steps for clarity.

Symbolic Links: Added || true to the symbolic link commands to avoid errors if the links already exist.


Signed-off-by: Cristian Cezar Moisés <[email protected]>
Changed to std::exit: This is to ensure it's clear where the function comes from.

Improved Logging: Added context to the log message to clarify the error.

Removed Redundant Comments: Cleaned up the code by removing comments that state the obvious.

Signed-off-by: Cristian Cezar Moisés <[email protected]>
Variable Naming: Changed mInstalled to isInstalled for clarity, following a common naming convention.

Error Handling: Introduced a HandleFatalError method to encapsulate error handling logic for better code organization.

Success and Failure Indicators: Changed return values in Execute to true/false instead of Success/Failure for clarity.

Comments: Added comments to clarify the purpose of different sections of the code, aiding future maintainers.

Consistency: Ensured consistent use of formatting and spacing throughout the code.


Signed-off-by: Cristian Cezar Moisés <[email protected]>
Documentation Clarity: Improved the documentation comments for better clarity and consistency.

Member Variable Documentation: Added comments for member variables to explain their purpose.

Namespace Closing: Added the closing namespace for snowball for completeness.

General Formatting: Ensured consistent formatting and spacing for readability.

Code Comments: Clarified the purpose of each function and added return value descriptions where necessary.


Signed-off-by: Cristian Cezar Moisés <[email protected]>
Error Handling: Switched from a custom error handling function to standard exceptions (std::invalid_argument and std::runtime_error). This improves interoperability with standard C++ code.

Const Correctness: Used const char* in GetHomeDirectory for better clarity. The ReadFile function now uses const fs::path& to avoid unnecessary copies.

Structured Logging: The error messages now use standard exceptions, which can be caught and logged more effectively at higher levels in the application.

Refactoring Macros: The SN_CREATE_WORKSPACE macro has been replaced with a function CreateWorkspaceDirectory, which is safer and more flexible.

Namespace Usage: Used namespace fs for clearer references to filesystem functions, reducing the risk of naming conflicts and improving readability.


Signed-off-by: Cristian Cezar Moisés <[email protected]>
Error Handling: Introduced std::bad_cast for better error reporting when an invalid cast is attempted.

Const-Correctness: Ensured that both Cast functions are defined with const and non-const overloads.

Type Checking: Revised the CheckType method to immediately throw an exception if the type check fails, providing feedback when casting fails.

Destructor: Made the destructor virtual to ensure that derived classes are properly destructed when deleted through a base pointer.

Documentation: Improved comments for clarity and added parameter descriptions to the function documentation.

Is Function: Simplified the implementation of the Is function to directly return the result of the type trait check.


Signed-off-by: Cristian Cezar Moisés <[email protected]>
Helper Function: The TestTokenSequence function handles the repetitive logic of checking token sequences, making the tests easier to read and maintain.

Assertions: Using ASSERT_EQ ensures that if a critical check fails, the test will stop executing, preventing misleading results.

Comments: Each test case has comments to clarify its purpose, aiding future developers in understanding the intent behind each test.


Signed-off-by: Cristian Cezar Moisés <[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.

1 participant