-
-
Notifications
You must be signed in to change notification settings - Fork 254
Allow to register "special file" alert banners #1861
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
Conversation
|
Warning Rate limit exceeded@Boy132 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 57 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactors the handling of special files from a hard-coded check for Changes
Pre-merge checks✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/Models/File.php (1)
61-68: Consider guarding against overwriting default special files.The method allows plugins to register files that could overwrite the default
.pelicanignoreentry whengetSpecialFiles()merges the arrays. This may be intentional for flexibility, but could lead to unexpected behavior if plugins unintentionally use reserved filenames.Consider adding a check to prevent overwriting built-in special files, or document this behavior:
public static function registerSpecialFile(string $fileName, string|Closure $bannerTitle, string|Closure|null $bannerBody = null, ?Closure $nameCheck = null): void { + // Optional: Warn or prevent overwriting default special files + $defaults = ['.pelicanignore']; + if (in_array($fileName, $defaults)) { + throw new \InvalidArgumentException("Cannot override default special file: {$fileName}"); + } + static::$customSpecialFiles[$fileName] = [ 'title' => $bannerTitle, 'body' => $bannerBody, 'check' => $nameCheck ?? fn (string $path) => str($path)->endsWith($fileName), ]; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/Filament/Server/Resources/Files/Pages/EditFiles.php(2 hunks)app/Models/File.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Filament/Server/Resources/Files/Pages/EditFiles.php (2)
app/Models/File.php (2)
File(30-241)getSpecialFiles(70-81)app/Livewire/AlertBanner.php (2)
AlertBanner(14-100)closable(72-77)
🔇 Additional comments (3)
app/Filament/Server/Resources/Files/Pages/EditFiles.php (1)
10-10: LGTM!The new imports are necessary for the refactored special file handling.
Also applies to: 16-16
app/Models/File.php (2)
8-8: LGTM!The Closure import is required for the new type hints in the special file registration methods.
58-59: LGTM!The static property correctly stores custom special files with a clear docblock describing its structure.
Isn't really doing anything on it's own, but allows plugins to register their own alert banners for "special files".