Review and recommend project improvements#1
Conversation
…e patterns, Dockerfile
- Fix version mismatch: use env!("CARGO_PKG_VERSION") instead of hardcoded version
- Add ReDoS protection with regex size limits (10MB) for user-provided patterns
- Add shell completions support (--completions flag for bash/zsh/fish/powershell)
- Add exclude pattern support (--exclude flag for inverse matching)
- Create multi-stage Dockerfile for containerized deployment
- Add .dockerignore for optimized Docker builds
- Update tests for new fields and error messages
- Add exclude patterns documentation (--exclude / -e) - Add shell completions documentation (--completions) - Add Docker installation and usage instructions - Update changelog with v0.2.0 changes - Add examples for exclude patterns and shell completions
- Add should_exclude() check in process_line() for live monitoring - Add should_exclude() check in dry-run processing loop - Update CHANGELOG.md with new features for v0.2.0
- Add missing completions and exclude fields to benchmark Args struct - Add #![allow(deprecated)] for Command::cargo_bin in integration tests - Fix cargo fmt formatting in watcher.rs and integration.rs
There was a problem hiding this comment.
Pull request overview
This PR adds several significant features to the logwatcher tool including exclude patterns for filtering out unwanted log lines, shell completion generation support, Docker containerization, and security improvements with ReDoS protection. The version is also updated from 0.1.0 to 0.2.0 with the version string now correctly sourced from Cargo.toml.
Key changes:
- Added exclude pattern functionality (
--exclude/-e) with support for both literal and regex matching - Implemented shell completion generation for bash, zsh, fish, and PowerShell via
--completionsflag - Added Docker support with multi-stage Dockerfile for containerized deployment
- Enhanced security with ReDoS protection using regex size limits
- Fixed version reporting to use
env!("CARGO_PKG_VERSION")instead of hardcoded value
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cli.rs | Added completions and exclude CLI arguments, implemented parsing and completion generation |
| src/config.rs | Added exclude pattern compilation and matching logic, implemented ReDoS protection with size limits |
| src/main.rs | Added shell completion handling before main application flow |
| src/watcher.rs | Integrated exclude pattern checking in both file processing methods, updated test fixtures |
| src/matcher.rs | Updated test fixtures with new CLI fields |
| src/notifier.rs | Updated test fixtures with new CLI fields |
| src/highlighter.rs | Updated test fixtures with new CLI fields |
| tests/integration.rs | Updated version assertion to 0.2.0, updated error message to match new ReDoS error text |
| Cargo.toml | Added clap_complete dependency for shell completion support |
| Dockerfile | Added multi-stage Docker build with security best practices (non-root user, minimal runtime image) |
| .dockerignore | Optimized Docker build context by excluding unnecessary files |
| README.md | Documented new features with usage examples for exclude patterns, completions, and Docker |
| CHANGELOG.md | Added version 0.2.0 changelog entries documenting all new features and fixes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Cache lowercase exclude patterns at config init to avoid repeated allocations in should_exclude() (performance optimization) - Add lines_excluded counter to WatcherStats for better visibility into filtering effectiveness - Move lines_processed increment after exclusion check so stats accurately reflect only processed (non-excluded) lines - Add Zsh fpath setup note to README shell completions section
- Fix unnecessary_unwrap clippy lint (use if-let instead) - Update notify 6 -> 8 - Update crossterm 0.27 -> 0.29 - Keep criterion at 0.5 (0.8 has breaking API changes)
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
- Update Cargo.toml version - Update CHANGELOG.md with 0.2.1 release notes - Update integration test version check
Description
Brief description of changes
Type of Change
Testing
Checklist
Note
Adds
--excludeinverse matching and shell completions, introduces Docker support, enforces regex size limits, and updates deps/version to 0.2.0.--exclude/-ewith literal/regex support and case-insensitive optimization (Config::should_exclude).--completionsandArgs::generate_completions;--fileno longer required when generating completions.env!("CARGO_PKG_VERSION").lines_excludedinWatcherStatsand show in shutdown summary.size_limit/dfa_size_limit; adjust invalid regex error messaging.Dockerfileand.dockerignorefor containerized builds.notifyto8,crosstermto0.29; addclap_complete.0.2.0.README.mdandCHANGELOG.mdwith exclude patterns, completions, Docker usage, and security note.Argsfields.Written by Cursor Bugbot for commit 3734b91. This will update automatically on new commits. Configure here.