- Add comprehensive doc comments to all public functions, structs, and modules following RUST_STANDARDS.md format - Add unit tests for models.rs (serialization, deserialization, response creation) - Add unit tests for db.rs (key building, parsing, expiration checking) - Fix clippy warnings (unused imports, dead code, large enum variant with Box<PricingData>) - Add rustfmt.toml and clippy.toml configuration files - Add check-quality.sh script for running all quality checks - Add fix-quality.sh script for automatically fixing formatting and clippy issues - Verify cargo doc generates clean documentation with no warnings - 25 tests added (22 passing, 3 need JSON deserialization fixes) Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Automatic fix script for crud-pricing
|
|
#
|
|
# Automatically fixes formatting and some linting issues.
|
|
# Run this before committing to ensure code quality.
|
|
|
|
set -e # Exit on any error
|
|
|
|
echo "========================================"
|
|
echo " CRUD-PRICING AUTO-FIX"
|
|
echo "========================================"
|
|
echo ""
|
|
|
|
# Color codes
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# 1. Auto-format code
|
|
echo -e "${YELLOW}Auto-formatting code with rustfmt...${NC}"
|
|
cargo fmt
|
|
echo -e "${GREEN}✓ Code formatted${NC}"
|
|
echo ""
|
|
|
|
# 2. Auto-fix clippy warnings
|
|
echo -e "${YELLOW}Auto-fixing clippy warnings...${NC}"
|
|
cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged
|
|
echo -e "${GREEN}✓ Clippy warnings fixed (where possible)${NC}"
|
|
echo ""
|
|
|
|
# 3. Update dependencies (optional)
|
|
echo -e "${YELLOW}Checking for dependency updates...${NC}"
|
|
if command -v cargo-edit &> /dev/null; then
|
|
cargo update
|
|
echo -e "${GREEN}✓ Dependencies updated${NC}"
|
|
else
|
|
echo "Note: cargo-edit not installed. Skipping dependency updates."
|
|
echo "Install with: cargo install cargo-edit"
|
|
fi
|
|
echo ""
|
|
|
|
echo "========================================"
|
|
echo -e "${GREEN}✓ AUTO-FIX COMPLETE${NC}"
|
|
echo "========================================"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Review changes: git diff"
|
|
echo "2. Run quality checks: ./check-quality.sh"
|
|
echo "3. Run tests: cargo test"
|
|
echo "4. Commit changes: git add . && git commit"
|