Another language's API: null or === in Python, .strip(), None or len() in JavaScript, null in Go
Calls and packages that do not exist: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as made-up-api.
What makes another language's API a bad practice?
The standard that calls it a bad practice: Sonar's quality profile for agent-written code targets "hallucinated APIs"; a call that does not exist fails the first time it runs.
What does lessloc do about another language's API?
lessloc catches it as made-up-api.
made-up-api(tier 1): Another language's API, such asnullin Python,len()in JavaScript orNonein Go, or an import that no manifest declares and the platform does not provide.
Examples
Caught as made-up-api:
python
def first(xs):
if len(xs) === 0:
return null
return xs[0]Written well:
python
def first(xs):
return xs[0] if xs else NoneCaught as made-up-api:
python
def test_load():
doc = load("[a]\nb = 1\n")
assert doc["a"] != nullWritten well:
python
def test_load():
doc = load("""\
[a]
smooth = true
""")
assert doc["a"]["smooth"] is TrueCaught as made-up-api:
js
export const clean = s => s.strip();Written well:
js
export const clean = s => s.trim();Related patterns
The other patterns in Calls and packages that do not exist:
- Imports of packages no manifest declares: lessloc catches it as
made-up-api: checked against every package.json, Python manifest, the standard library and the project's own modules.

