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

V3.2 features and deprecation #172

Merged
merged 7 commits into from
Dec 19, 2024
Merged

Conversation

DefinetlyNotAI
Copy link
Owner

@DefinetlyNotAI DefinetlyNotAI commented Dec 19, 2024

Pull Request Template

Prerequisites

  • I have searched for duplicate or closed issues.
  • I have read the contributing guidelines.
  • I have followed the instructions in the wiki about contributions.
  • I have updated the documentation accordingly, if required.
  • I have tested my code with the --dev flag, if required.

PR Type

  • Bug fix
  • Deprecation Change
  • New feature
  • Refactoring
  • Documentation
    update
  • ⚠️ Breaking change ⚠️

Description

This pull request includes several changes to deprecate outdated features, improve code organization, and update documentation. The most important changes include deprecating the extra and unzip-extra features, updating the VulnScan documentation, and removing the _extra.py file.

Deprecation of outdated features:

Documentation updates:

Code organization:

Removal of deprecated files:

  • CODE/_extra.py: Removed the _extra.py file as part of the deprecation process.

Motivation and Context

Removal of many deprecated functions, to reorganise Logicytics

Credit

N/A

Issues Fixed

N/A

Summary by CodeRabbit

  • New Features

    • Added a checkbox option for "Deprecation Change" in the pull request template.
    • Introduced a new static method to display the help menu in the Flag class.
  • Bug Fixes

    • Enhanced error handling for deprecated features and improved logging during script execution.
  • Documentation

    • Updated VulnScan documentation to include a warning about migration to a different repository.
    • Made textual and structural improvements in the README.md for clarity.
  • Chores

    • Removed deprecated files and tasks from the project.
    • Updated version number in the configuration file.

Removed the --extra flag, and gave a deprecation warning to it, will be removed later however, also added new feature to Flag.py that allows you to print the flag help menu whenever needed!

Signed-off-by: Shahm Najeeb <[email protected]>
Signed-off-by: Shahm Najeeb <[email protected]>
Also updated PULL_REQUEST_TEMPLATE.md

Signed-off-by: Shahm Najeeb <[email protected]>
@DefinetlyNotAI DefinetlyNotAI added request/Minor New feature or request, not important, may not do type/Code Related to the Code part labels Dec 19, 2024
@DefinetlyNotAI DefinetlyNotAI self-assigned this Dec 19, 2024
@pull-request-size pull-request-size bot added the size/XL Huge size pr label Dec 19, 2024
Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

Walkthrough

This pull request updates various files to enhance the handling of deprecated features across the project. Key changes include adding a "Deprecation Change" checkbox to the pull request template, removing outdated training scripts in VulnScan, modifying configuration files, and improving error handling in several scripts. The overall aim is to streamline the codebase and prepare for future enhancements.

Changes

File Change Summary
.github/PULL_REQUEST_TEMPLATE.md Added "Deprecation Change" checkbox to PR type section
CODE/Logicytics.py Updated deprecation warnings and error handling
CODE/VulnScan/README.md Added migration warning for repository
CODE/VulnScan/v2-deprecated/_train.py Completely removed training script
CODE/VulnScan/v3/_generate_data.py Removed SenseMacro deprecated feature
CODE/_extra.py Deleted entire script
CODE/config.ini Updated version to 3.2.0, removed deprecated files
CODE/logicytics/Flag.py Reintroduced deprecated flags, added help menu method
PLANS.md Removed tasks related to removing deprecated features

Possibly related PRs

  • V3.1.0 #158: Improvements in handling deprecated features and error logging.
  • Bluetooth details #160: New functionality for retrieving Bluetooth device details, which may relate to documentation enhancements.
  • Optimised _debug.py #166: Optimizations in logging that could connect to the main PR's focus on clarity.

Suggested labels

progress/Duplicate, type/Documentation, type/Development

Poem

Farewell to code that's old and worn,
Deprecated features, now we've been warned!
Cleaning up with a developer's might,
Streamlining systems, making everything right 🧹✨
A fresh new version takes its flight!


📜 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 10698a0 and 729e737.

📒 Files selected for processing (5)
  • CODE/Logicytics.py (5 hunks)
  • CODE/VulnScan/README.md (1 hunks)
  • CODE/VulnScan/v3/_generate_data.py (2 hunks)
  • CODE/logicytics/Flag.py (2 hunks)
  • README.md (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CODE/VulnScan/README.md
  • CODE/logicytics/Flag.py
🧰 Additional context used
🪛 LanguageTool
README.md

[typographical] ~187-~187: Consider adding two commas here.
Context: ...te on the script says otherwise, you can however contribute to the script itself.

[...

(HOWEVER_COMMA)


[style] ~190-~190: ‘future plans’ might be wordy. Consider a shorter alternative.
Context: ...tself.

[!TIP]
You can check out future plans here,
you can contribute...

(EN_WORDINESS_PREMIUM_FUTURE_PLANS)


[uncategorized] ~191-~191: Possible missing preposition found.
Context: ...here,

you can contribute these plans if you have no idea's on what to ...

(AI_EN_LECTOR_MISSING_PREPOSITION)

🪛 Markdownlint (0.37.0)
README.md

188-188: null
Blank line inside blockquote

(MD028, no-blanks-blockquote)


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.

@github-actions github-actions bot closed this Dec 19, 2024
@github-actions github-actions bot closed this Dec 19, 2024
Signed-off-by: Shahm Najeeb <[email protected]>
Repository owner deleted a comment from github-actions bot Dec 19, 2024
@DefinetlyNotAI
Copy link
Owner Author

😭😭

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🔭 Outside diff range comments (2)
CODE/VulnScan/v3/_generate_data.py (2)

Line range hint 192-208: Yo! These magic numbers are making my head spin! 🤔

Let's make the code easier to understand and maintain by moving these hardcoded values to constants at the top of the file.

+# File generation multipliers
+SENSE_MULTIPLIER = 5
+SENSE_NANO_MULTIPLIER = 0.5
+SENSE_MINI_MULTIPLIER = 1

     if CODE_NAME == 'Sense':
-        FILE_NUM = DEFAULT_FILE_NUM * 5
-        MIN_FILE_SIZE = DEFAULT_MIN_FILE_SIZE * 5
-        MAX_FILE_SIZE = DEFAULT_MAX_FILE_SIZE * 5
+        FILE_NUM = DEFAULT_FILE_NUM * SENSE_MULTIPLIER
+        MIN_FILE_SIZE = DEFAULT_MIN_FILE_SIZE * SENSE_MULTIPLIER
+        MAX_FILE_SIZE = DEFAULT_MAX_FILE_SIZE * SENSE_MULTIPLIER
     elif CODE_NAME == 'SenseNano':
-        FILE_NUM = 5
-        MIN_FILE_SIZE = int(DEFAULT_MIN_FILE_SIZE * 0.5)
-        MAX_FILE_SIZE = int(DEFAULT_MAX_FILE_SIZE * 0.5)
+        FILE_NUM = int(DEFAULT_FILE_NUM * SENSE_NANO_MULTIPLIER)
+        MIN_FILE_SIZE = int(DEFAULT_MIN_FILE_SIZE * SENSE_NANO_MULTIPLIER)
+        MAX_FILE_SIZE = int(DEFAULT_MAX_FILE_SIZE * SENSE_NANO_MULTIPLIER)
     elif CODE_NAME == 'SenseMini':
-        FILE_NUM = DEFAULT_FILE_NUM
-        MIN_FILE_SIZE = DEFAULT_MIN_FILE_SIZE
-        MAX_FILE_SIZE = DEFAULT_MAX_FILE_SIZE
+        FILE_NUM = int(DEFAULT_FILE_NUM * SENSE_MINI_MULTIPLIER)
+        MIN_FILE_SIZE = int(DEFAULT_MIN_FILE_SIZE * SENSE_MINI_MULTIPLIER)
+        MAX_FILE_SIZE = int(DEFAULT_MAX_FILE_SIZE * SENSE_MINI_MULTIPLIER)

Line range hint 336-342: Heads up! Let's make this logging more secure! 🔒

When logging file paths and names, we should be careful not to expose sensitive info in the logs.

-        log.debug(f"Zipping directory '{directory}' with name '{name}' under action '{ACTION}'")
+        # Avoid logging full paths that might contain sensitive information
+        safe_dir = os.path.basename(directory)
+        log.debug(f"Zipping directory '{safe_dir}' with name '{name}' under action '{ACTION}'")
🧹 Nitpick comments (7)
CODE/VulnScan/README.md (1)

3-7: The warning is helpful but could be clearer! 📢

The warning about moving VulnScan is super important, but let's make it pop more:

-> [!WARNING]
-> VulnScan will be moved to a different repository soon.
-> This part of the repository will be archived and the new repository will be linked here.
-> The `pkl` and `pth` files will stay here, linked properly for `vulnscan.py`,
-> VulnScan will NOT be moved to the other repository.
+> [!WARNING]
+> # VulnScan Migration Notice 🚨
+>
+> VulnScan is moving to a new home! Here's what you need to know:
+> - This repository section will be archived
+> - A link to the new repository will be added here
+> - The `pkl` and `pth` files will stay here (they'll work with `vulnscan.py`)
+> - VulnScan itself will NOT be moved to the other repository

Also, it might be helpful to add when this migration is happening! Could you add a timeline? 🗓️

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ... part of the repository will be archived and the new repository will be linked here....

(COMMA_COMPOUND_SENTENCE_2)

CODE/VulnScan/v3/_generate_data.py (1)

188-191: Hey! Nice deprecation warning, but let's make it more user-friendly! 🎯

The warning message is good, but we could make it more helpful by telling users what they should use instead.

-    if CODE_NAME == 'SenseMacro':
-        print(
-            "\033[91mDeprecationWarning: A call to the deprecated feature SenseMacro has been called, this has been removed due to instability issues, going with default settings (Model Sense).\033[0m")
-        CODE_NAME = 'Sense'
+    if CODE_NAME == 'SenseMacro':
+        print(
+            "\033[91mDeprecationWarning: SenseMacro has been removed due to instability issues. "
+            "Please use 'Sense' instead for better stability and performance. "
+            "Defaulting to 'Sense' settings for now.\033[0m")
+        CODE_NAME = 'Sense'
CODE/logicytics/Flag.py (2)

171-185: Cool addition of deprecated flags! But let's make them super clear! 🚫

The deprecated flags are marked well, but we could make them even more obvious to users.

         # Deprecated Flags - v3.3
         parser.add_argument(
             "--unzip-extra",
             action="store_true",
-            help="Unzip the extra directory zip File "
-                 f"{cls.colorify('- Use on your own device only -', 'y')}.",
+            help="[DEPRECATED] Unzip the extra directory zip File. "
+                 f"{cls.colorify('This flag will be removed in v3.3', 'r')}",
         )

         parser.add_argument(
             "--extra",
             action="store_true",
-            help="Open's the extra directory menu to use more tools. "
-                 f"{cls.colorify('- Still experimental -', 'y')} "
-                 f"{cls.colorify('- MUST have used --unzip-extra flag -', 'b')}.",
+            help="[DEPRECATED] Open's the extra directory menu. "
+                 f"{cls.colorify('This flag will be removed in v3.3', 'r')}",
         )

278-284: Nice help menu method! But let's make it more flexible! 🎨

The help menu method is good, but we could make it more reusable by allowing custom formatting.

     @staticmethod
-    def show_help_menu():
+    def show_help_menu(format_output: bool = False):
         """
         Displays the help menu for the Logicytics application.
+        
+        Args:
+            format_output (bool): If True, returns the help text instead of printing it
         """
         _, parser = Flag.__available_arguments()
-        parser.print_help()
+        if format_output:
+            return parser.format_help()
+        else:
+            parser.print_help()
CODE/Logicytics.py (3)

138-147: Let's make this deprecation warning pop! 💥

The warning is good, but we could make it more helpful by suggesting alternatives.

-        print("\033[91mDeprecationWarning: "
-              "A call to the deprecated feature `extra` has been called, "
-              "this feature has been removed as it doesn't follow "
-              "the required code standards or aim of Logicytics.\033[0m")
+        print("\033[91mDeprecationWarning: The `extra` feature has been removed! 🚫\n"
+              "Why? It didn't match our code quality standards.\n"
+              "What to use instead? Check out our new features with --help\033[0m")

179-186: Same here - let's make this warning more user-friendly! 🎯

Similar to the extra feature warning, we should make this more helpful.

-        print("\033[91mDeprecationWarning: "
-              "A call to the deprecated feature `unzip-extra` has been called, "
-              "this feature has been removed as it doesn't follow "
-              "the required code standards or aim of Logicytics.\033[0m")
+        print("\033[91mDeprecationWarning: The `unzip-extra` feature has been removed! 🚫\n"
+              "Why? It didn't match our code quality standards.\n"
+              "What to use instead? Check out our new features with --help\033[0m")

372-373: Hey! Let's track this TODO properly! 📝

Instead of leaving a comment about future implementation, let's create an issue to track it.

Would you like me to create a GitHub issue to track the webhook implementation? I can help draft the issue with requirements and implementation details!

🛑 Comments failed to post (1)
CODE/VulnScan/README.md (1)

3-8: 💡 Codebase verification

Hey, we need to talk about this migration plan - it's kinda confusing! 🤔

The README says VulnScan will be moved but also says it won't be moved, which is super contradicting! Plus, there's some important stuff we found:

  • The main vulnscan.py directly uses two key files:
    • VulnScan/Model SenseMini .3n3.pth
    • VulnScan/Vectorizer .3n3.pkl
  • These files are actually in the repo and other code depends on them too
  • The training and tools code that creates these files is also in the VulnScan folder

So like, we need to clear up what's actually moving and what's staying. RN the README is giving mixed signals - it's like telling us to go left and right at the same time! 😅

🔗 Analysis chain

Let's verify the migration plan

Since this is a big change, we should make sure all the pieces fit together:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any direct dependencies on VulnScan
rg -l "import.*VulnScan|from.*VulnScan" --type py

# Check for any references to pkl and pth files
rg -l "\.pkl|\.pth" --type py

Length of output: 234


Script:

#!/bin/bash
# Let's check what these files are actually doing with pkl/pth files
rg "\.pkl|\.pth" -C 2 CODE/vulnscan.py CODE/logicytics/FileManagement.py CODE/VulnScan/v3/_train.py CODE/VulnScan/tools/_vectorizer.py CODE/VulnScan/tools/_study_network.py

# Also check if there are any pkl/pth files in the repo
fd -e pkl -e pth

Length of output: 3616

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ... part of the repository will be archived and the new repository will be linked here....

(COMMA_COMPOUND_SENTENCE_2)

@github-actions github-actions bot closed this Dec 19, 2024
Repository owner deleted a comment from github-actions bot Dec 19, 2024
@DefinetlyNotAI
Copy link
Owner Author

@coderabbitai Where does the readme say about the migration? Which one?

Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

Tip

For best results, initiate chat on the files or code changes.

@DefinetlyNotAI: The mention of the migration appears in the VulnScan documentation at CODE/VulnScan/README.md. Specifically, a warning was added stating that VulnScan would be moved to a different repository, with the current one being archived. This includes details about leaving the .pkl and .pth files behind but removing the rest of VulnScan’s functionality.

If you need the exact text, check the updated “Warning” section in CODE/VulnScan/README.md.

Coderabbit suggestion

Signed-off-by: Shahm Najeeb <[email protected]>
Copy link

codeclimate bot commented Dec 19, 2024

Code Climate has analyzed commit 729e737 and detected 0 issues on this pull request.

View more on Code Climate.

Repository owner deleted a comment from coderabbitai bot Dec 19, 2024
@DefinetlyNotAI
Copy link
Owner Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions github-actions bot closed this Dec 19, 2024
Repository owner deleted a comment from github-actions bot Dec 19, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
CODE/VulnScan/v3/_generate_data.py (1)

Line range hint 219-224: Watch out! We should add some error handling here! 🛡️

When writing files with sensitive data, we should make sure to handle any potential errors and clean up properly if something goes wrong.

Here's a safer way to handle the file operations:

-    with open(filepath, 'w', encoding='utf-8') as f:
-        f.write(content)
+    try:
+        with open(filepath, 'w', encoding='utf-8') as f:
+            f.write(content)
+    except IOError as e:
+        logger.error(f"Failed to write file {filename}: {e}")
+        # Clean up any partially written file
+        if os.path.exists(filepath):
+            os.remove(filepath)
+        raise
🧹 Nitpick comments (5)
README.md (2)

41-44: Let's clean up these CUDA instructions! 📝

The CUDA installation instructions are a bit confusing. Let's fix those typos:

  • "NVidea" should be "NVIDIA"
  • "usage's" shouldn't have an apostrophe
  • Sentence structure needs work

Here's a clearer version:

-If the device has CUDA available (NVidea GPUs),
-
-Otherwise, run `pip3 install torch torchvision torchaudio` to use the CPU, ofcourse this is optional for normal
-usage's,
+If the device has CUDA available (NVIDIA GPUs), use the command above.
+Otherwise, run `pip3 install torch torchvision torchaudio` to use CPU.
+Note: This is only required if you plan to use the `vulnscan` feature.

186-187: Quick grammar fix needed! ✍️

The sentence structure could be clearer:

-Don't recreate the scripts/ideas below as then it's a waste of time for you,
-unless the Side-note on the script says otherwise, you can however contribute to the script itself.
+Don't recreate these scripts/ideas (it would be a waste of time),
+unless the Side-note says otherwise. You can, however, contribute to the script itself.
🧰 Tools
🪛 LanguageTool

[typographical] ~187-~187: Consider adding two commas here.
Context: ...te on the script says otherwise, you can however contribute to the script itself.

[...

(HOWEVER_COMMA)

CODE/VulnScan/v3/_generate_data.py (2)

188-194: Hey! Let's use Python's built-in warnings module instead of print! 🐍

The warning message is great, but using Python's warnings module would be more standard and give us some cool benefits like filtering and capturing warnings programmatically.

Here's how we can make it better:

+import warnings
+
-    if CODE_NAME == 'SenseMacro':
-        print(
-            "\033[91mDeprecationWarning: SenseMacro has been removed due to instability issues. "
-            "Please use 'Sense' instead for better stability and performance. "
-            "Defaulting to 'Sense' settings for now.\033[0m"
-        )
-        CODE_NAME = 'Sense'
+    if CODE_NAME == 'SenseMacro':
+        warnings.warn(
+            "SenseMacro has been removed due to instability issues. "
+            "Please use 'Sense' instead for better stability and performance. "
+            "Defaulting to 'Sense' settings for now.",
+            DeprecationWarning,
+            stacklevel=2
+        )
+        CODE_NAME = 'Sense'

Line range hint 226-228: Let's make this more Pythonic! 🐍

Instead of using an else clause to prevent imports, we can use the standard if __name__ == '__main__' pattern more effectively.

Here's a cleaner way:

-else:
-    raise ImportError("This training script is meant to be run directly "
-                      "and cannot be imported. Please execute it as a standalone script.")
+def main():
+    """Main function containing the script's primary logic"""
+    # Move all the main execution code here
+    pass
+
+if __name__ == '__main__':
+    main()
+else:
+    raise ImportError("This script is meant to be run directly")
CODE/Logicytics.py (1)

330-336: Let's make those file paths more reliable! 🛣️

Using backslashes directly in paths isn't great - they can cause problems on different operating systems. Let's use os.path.join instead!

Here's a more reliable way to handle paths:

     def zip_and_log(directory: str, name: str):
         log.debug(f"Zipping directory '{directory}' with name '{name}' under action '{ACTION}'")
         zip_values = FileManagement.Zip.and_hash(
-            directory,
+            os.path.normpath(directory),  # Normalize path separators
             name,
             ACTION if ACTION is not None else f"ERROR_NO_ACTION_SPECIFIED_{datetime.now().isoformat()}"
         )

     if ACTION == "modded":
-        zip_and_log("..\\MODS", "MODS")
+        zip_and_log(os.path.join("..", "MODS"), "MODS")
🛑 Comments failed to post (1)
CODE/Logicytics.py (1)

138-144: 🛠️ Refactor suggestion

Hey! We've got some copy-paste going on here! 🎭

These deprecation warnings are super similar. Let's make a helper function to avoid repeating ourselves!

Here's how we can clean this up:

+def show_deprecation_warning(feature_name: str):
+    """Display a standardized deprecation warning for removed features."""
+    print(f"\033[91mDeprecationWarning: The `{feature_name}` feature has been removed! 🚫\n"
+          "Why? It didn't match our code quality standards.\n"
+          "What to use instead? Check out our new features with --help\033[0m")
+    input("Press Enter to exit...")
+    exit(0)

-    if ACTION == "extra":
-        print("\033[91mDeprecationWarning: The `extra` feature has been removed! 🚫\n"
-              "Why? It didn't match our code quality standards.\n"
-              "What to use instead? Check out our new features with --help\033[0m")
-        input("Press Enter to exit...")
-        exit(0)
+    if ACTION == "extra":
+        show_deprecation_warning("extra")

-    if ACTION == "unzip_extra":
-        print("\033[91mDeprecationWarning: The `unzip_extra` feature has been removed! 🚫\n"
-              "Why? It didn't match our code quality standards.\n"
-              "What to use instead? Check out our new features with --help\033[0m")
-        input("Press Enter to exit...")
-        exit(0)
+    if ACTION == "unzip_extra":
+        show_deprecation_warning("unzip_extra")

Also applies to: 176-180

@DefinetlyNotAI DefinetlyNotAI merged commit 4cbbf2c into main Dec 19, 2024
12 of 13 checks passed
@DefinetlyNotAI DefinetlyNotAI deleted the v3.2-features-and-deprecation branch December 19, 2024 06:35
Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

✅ Actions performed

Comments resolved and changes approved.

@DefinetlyNotAI
Copy link
Owner Author

@coderabbitai generate docstrings

Copy link
Contributor

coderabbitai bot commented Dec 22, 2024

✅ Actions performed

Docstrings generation started.

Copy link
Contributor

coderabbitai bot commented Dec 22, 2024

Caution

An unexpected error occurred while opening a pull request: Not Found - https://docs.github.com/rest/git/refs#get-a-reference

@DefinetlyNotAI
Copy link
Owner Author

DefinetlyNotAI commented Dec 30, 2024

@coderabbitai generate docstrings

Copy link
Contributor

coderabbitai bot commented Dec 30, 2024

✅ Actions performed

Docstrings generation started.

Copy link
Contributor

coderabbitai bot commented Dec 30, 2024

Caution

An unexpected error occurred while opening a pull request: Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request/Minor New feature or request, not important, may not do size/XL Huge size pr type/Code Related to the Code part
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants