Loading...
Loading...
Verify code quality including naming conventions, organization, documentation, and general best practices. Use when asked to "verify quality", "check code quality", or "review code organization".
npx skill4agent add aurite-ai/agent-verifier verify-qualityNote: For full verification including security, patterns, and language-specific checks, tell the user to say "verify agent".
*.py*.ts*.js*.go*.rssrc/lib/app/agent/tools/utils/node_modules/.venv/venv/__pycache__/*.test.**.spec.**_test.go[HEURISTIC][H][HEURISTIC]| Issue | Examples |
|---|---|
| Single-letter variables (except loops) | |
| Unclear abbreviations | |
| Inconsistent casing | Mixing |
| Names that don't describe purpose | |
| Boolean names without is/has/can | |
# ✅ Clear, descriptive
user_profile = get_user_profile(user_id)
is_authenticated = check_authentication(token)
max_retry_attempts = 3
# ⚠️ Unclear
x = get_up(uid)
auth = check(t)
n = 3[HEURISTIC]| Issue | Description |
|---|---|
| Large files | > 500 lines for a single module |
| Large functions | > 50 lines for a single function |
| Deep nesting | > 4 levels of indentation |
| Mixed concerns | Business logic mixed with I/O in same function |
| God objects | Classes with > 10 public methods or > 20 attributes |
# ⚠️ Warning - Deep nesting
def process(data):
if condition1:
if condition2:
for item in items:
if condition3:
if condition4: # Too deep
...
# ⚠️ Warning - Mixed concerns
def save_user(user):
# Validation
if not user.email:
raise ValueError("...")
# Business logic
user.created_at = datetime.now()
# Database I/O
db.session.add(user)
db.session.commit()
# Email sending
send_welcome_email(user) # Multiple concerns[HEURISTIC]# ⚠️ Warning - Magic numbers
if retry_count > 3: # What does 3 mean?
...
time.sleep(60) # Why 60?
# ⚠️ Warning - Repeated strings
if status == "pending":
...
elif status == "pending": # Typo risk
...
# ✅ Good - Named constants
MAX_RETRIES = 3
RETRY_DELAY_SECONDS = 60
STATUS_PENDING = "pending"
if retry_count > MAX_RETRIES:
...
time.sleep(RETRY_DELAY_SECONDS)[HEURISTIC]| Missing | Where expected |
|---|---|
| Module docstring | Top of |
| Class docstring | After |
| Function docstring | After |
| README | Project root |
| Type hints | Public function parameters/returns |
# ⚠️ Warning - Missing docstrings
def calculate_score(user, items, weights):
total = 0
for item, weight in zip(items, weights):
total += item.value * weight
return total
# ✅ Good - Documented
def calculate_score(user: User, items: list[Item], weights: list[float]) -> float:
"""
Calculate weighted score for a user's items.
Args:
user: The user to calculate score for
items: List of items to score
weights: Weight multipliers for each item
Returns:
Total weighted score
"""
...[HEURISTIC]| Issue | Description |
|---|---|
| Bare except | |
| Silent failures | |
| Generic exceptions raised | |
| No error handling | Functions that can fail but don't handle errors |
# ⚠️ Warning - Bare except
try:
process_data()
except:
pass
# ⚠️ Warning - Generic exception
raise Exception("Something went wrong")
# ✅ Good - Specific handling
try:
process_data()
except ValueError as e:
logger.warning(f"Invalid data: {e}")
return default_value
except ConnectionError as e:
logger.error(f"Connection failed: {e}")
raise ServiceUnavailableError from e[HEURISTIC]# ⚠️ Warning - Duplication
def get_user_by_id(user_id):
response = requests.get(f"{BASE_URL}/users/{user_id}")
if response.status_code == 200:
return response.json()
return None
def get_order_by_id(order_id):
response = requests.get(f"{BASE_URL}/orders/{order_id}")
if response.status_code == 200:
return response.json()
return None
# ✅ Good - Abstracted
def get_resource(resource_type: str, resource_id: str):
response = requests.get(f"{BASE_URL}/{resource_type}/{resource_id}")
if response.status_code == 200:
return response.json()
return None[HEURISTIC]# ⚠️ Warning - Commented code should be removed
# def old_implementation():
# for item in items:
# process_item(item)
# return results
# ⚠️ Warning - Stale TODO
# TODO: Fix this before launch (added 2024-01-15)
# ✅ Acceptable - Brief explanatory comment
# Note: Using legacy API format for backwards compatibility# Code Quality Verification Report
**Project:** [name or path]
**Date:** [current date]
**Files analyzed:** [count]
## Summary
✅ X checks passed | ⚠️ Y warnings | ❌ Z issues
## Naming
- [x] Naming conventions consistent
- [ ] ⚠️ Unclear names at `[file:line]`
## Organization
- [x] Code well-organized
- [ ] ⚠️ Large function at `[file:line]` ([X] lines)
## Documentation
- [x] Key functions documented
- [ ] ⚠️ Missing docstring at `[file:line]`
## Error Handling
- [x] Errors properly handled
- [ ] ⚠️ Bare except at `[file:line]`
## Findings
> `[H]` = heuristic (all quality checks require judgment)
### ✅ Passing
- `[H]` Consistent naming conventions throughout
- `[H]` Functions are well-scoped and focused
### ⚠️ Warnings
- `[H]` [Check]: [description]
- **Location:** [file:line]
- **Impact:** [why this matters]
- **Suggestion:** [how to improve]
## Recommendations
1. [Priority recommendation]
2. [Additional improvements]