Score · Assess & Decide · Engineering
Clean-code smell scorecard for a method
A per-method clean-code smell scorecard: which thresholds each method exceeds (long method, too many arguments, deep nesting, and more), a 0-100 score, and a pass/warn/fail verdict.
You receive: A reviewed smell-scoring calculator + the passing test report, run on your method metrics.
Part of Ship MVP
Opens soon
Cost15 credits
AcceptanceAutomated check against your inputs
ProtectionHeld until verified delivery
This objective is verified and ready. It opens soon, once sign-in and payments are live.
Deliverable interface
The exact vocabulary the automated check enforces: keys, tokens, entry points, and worked examples. Generated from the verification source.
{
"constants": {
"_SMELL_RULES": [
[
"loc",
"max_loc",
"LongMethod"
],
[
"args",
"max_args",
"TooManyArguments"
],
[
"attributes",
"max_attributes",
"TooManyAttributes"
],
[
"nesting",
"max_nesting",
"DeepNesting"
],
[
"comment_ratio",
"max_comment_ratio",
"OverCommented"
]
]
},
"entryName": "compute_code_smell_scorecard",
"expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
"hiddenCaseCount": 5,
"hiddenCaseNames": [
"all_five_fail",
"strict_boundary_no_flag",
"custom_thresholds",
"custom_gates",
"multi_method_order"
],
"inputKeys": [
"fail_at_smell_count",
"max_args",
"max_loc",
"methods",
"metrics",
"name",
"warn_at_smell_count"
],
"normalizeSource": "def _code_smell_normalize(r):\n if isinstance(r, str):\n return r # sentinel (invalid_metrics / invalid_thresholds) passes through\n try:\n return {\"rows\": [{\"name\": str(x[\"name\"]), \"smells\": [str(s) for s in x[\"smells\"]],\n \"smell_count\": int(x[\"smell_count\"]), \"score\": int(round(float(x[\"score\"]))),\n \"verdict\": str(x[\"verdict\"])} for x in r[\"rows\"]]}\n except Exception:\n return repr(r)\n",
"returnShapes": [
[
"rows"
],
"invalid_thresholds",
"invalid_metrics"
],
"signature": "def compute_code_smell_scorecard(inp):",
"submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
"tier": "calculator",
"visibleCases": [
{
"expect": {
"rows": [
{
"name": "f",
"score": 60,
"smell_count": 2,
"smells": [
"LongMethod",
"TooManyArguments"
],
"verdict": "warn"
}
]
},
"input": {
"methods": [
{
"metrics": {
"args": 5,
"attributes": 4,
"comment_ratio": 0.1,
"loc": 45,
"nesting": 2
},
"name": "f"
}
]
},
"name": "two_smells_warn"
},
{
"expect": {
"rows": [
{
"name": "g",
"score": 100,
"smell_count": 0,
"smells": [],
"verdict": "pass"
}
]
},
"input": {
"methods": [
{
"metrics": {
"args": 2,
"attributes": 4,
"comment_ratio": 0.2,
"loc": 10,
"nesting": 1
},
"name": "g"
}
]
},
"name": "clean_pass"
}
],
"vocabulary": [
"fail",
"fail_at_smell_count",
"invalid_metrics",
"invalid_thresholds",
"max_args",
"max_attributes",
"max_comment_ratio",
"max_loc",
"max_nesting",
"methods",
"metrics",
"name",
"pass",
"rows",
"score",
"smell_count",
"smells",
"verdict",
"warn",
"warn_at_smell_count"
]
}Get early access to STUD the day it goes live.