Review code quality, security, and maintainability before committing. Use when reviewing code changes, checking code quality, performing security review, or validating changes before commit.
Review code quality, security, and maintainability before committing changes to Linus Dashboard.
Senior code reviewer ensuring quality, security, and maintainability.
Context Required:
Readability:
Structure:
Type Safety:
Any without justificationexcept)asyncio.gather() for parallel opshass.data[DOMAIN][entry_id]entry.async_on_unload()# See what changed
git status
# View diff
git diff
# Check specific files
git diff path/to/file.py
For each changed file:
# TypeScript
npm run build
npm run type-check
npm run lint:check
# Run smoke tests
npm run test:smoke
Format:
File: path/to/file.py
ā
Good:
- Clear function names
- Proper type hints
- Good error handling
ā ļø Issues:
1. Line 42: Missing docstring
2. Line 78: Blocking I/O in async function
3. Line 103: Exception too broad
š” Suggestions:
- Consider caching this result
- Extract this logic to separate function
Async/Await:
# ā Bad - blocking I/O
async def fetch_data():
response = requests.get(url) # Blocks event loop
# ā
Good - async I/O
async def fetch_data():
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.json()
Error Handling:
# ā Bad - bare except
try:
do_something()
except:
pass
# ā
Good - specific exception
try:
do_something()
except ValueError as err:
_LOGGER.error("Invalid value: %s", err)
raise
Type Hints:
# ā Bad - no types
def process_data(data):
return data.get("value")
# ā
Good - with types
def process_data(data: dict[str, Any]) -> str | None:
"""Process data and return value."""
return data.get("value")
Type Safety:
// ā Bad - any type
function process(data: any): any {
return data.value;
}
// ā
Good - proper types
function process(data: DataType): string | undefined {
return data.value;
}
Null Safety:
// ā Bad - no null check
const value = entity.state.toUpperCase();
// ā
Good - null check
const value = entity.state?.toUpperCase() ?? "unknown";
Before approving:
Code Quality:
Functionality:
Maintainability:
Security:
APPROVE - Code meets all standards REQUEST CHANGES - Issues must be fixed COMMENT - Suggestions for improvement
# Check what changed
git diff
# Check specific file
git diff path/to/file
# See commit history
git log --oneline -10
# Run quality checks
npm run lint:check
npm run type-check
npm run build
# Run tests
npm run test:smoke