Count Lines of Code
code.count_loc
Overview
When you supply source files, we count physical, blank, comment, code, and mixed lines per file using a lexical pass that respects string literals. Language is detected from the path extension unless you set it explicitly. We do not parse semantics, execute code, or walk a filesystem — do not use this for complexity metrics or AST analysis.
Naive line counters misclassify comments inside strings. We use the same lexical rules every time so your ratios stay trustworthy.
Reliability
STRICT and deterministic for identical inputs. Domain errors (not retryable; reduce input — unchanged retry will not succeed): LOC_FILE_LIMIT_EXCEEDED (more than 1,000 files — send fewer files); LOC_TOTAL_LIMIT_EXCEEDED (per-file or combined character limits exceeded — shrink file contents). Unsupported languages return in-band warnings, not failures.
Context footprint
Returns per-file rows, byLanguage aggregates, totals, and warnings. A successful call costs 1 execution credit.
When to use it
When you can supply file contents or file refs and need deterministic LOC breakdowns.
When you need semantic analysis, complexity, or filesystem discovery.
Scope
Non-goals
- Does not parse or execute code
- Does not compute complexity metrics
- Does not walk a filesystem
- Does not infer language from file content prose
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 1.9 MiB | Skill and platform maximum |
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| files | array | Yes | From 1 through 1,000 closed source-file specifications, each with path and exactly one content source. |
| options | object | No | Reserved options object; omit it — currently unused unconstrained RFC 8259 JSON items. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| files | array | Yes | From 0 through 1,000 retained file-count results in input order. |
| byLanguage | object | Yes | Purpose-bound map from supported language names to closed count objects. |
| totals | object | Yes | Closed physical, blank, comment, code, and mixed line counts. |
| warnings | array | Yes | From 0 through 1,000 skipped-file warnings, each a closed code and safe message. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"code.count_loc","input":{"files":[{"path":"a.py","content":"# c\nx=1\n"}]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("code.count_loc", {"files":[{"content":"// c\nclass A {}\n","path":"Main.java"}]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| LOC_FILE_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| LOC_TOTAL_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not parse or execute code
- Does not compute complexity metrics
- Does not walk a filesystem
- Does not infer language from file content prose
- Cyclomatic complexity
- Semantic or AST-based analysis
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "code.count_loc",
"input": {
"files": [
{
"content": "// c\nclass A {}\n",
"path": "Main.java"
}
]
}
}Examples
Single Java file with one comment line
{
"files": [
{
"content": "// c\nclass A {}\n",
"path": "Main.java"
}
]
}{
"totals": {
"physical": 2,
"blank": 0,
"comment": 1,
"code": 1,
"mixed": 0
},
"warnings": [],
"byLanguage": {
"java": {
"physical": 2,
"blank": 0,
"comment": 1,
"code": 1,
"mixed": 0
}
},
"files": [
{
"physical": 2,
"blank": 0,
"comment": 1,
"code": 1,
"mixed": 0,
"path": "Main.java",
"language": "java",
"confidence": "extension",
"supported": true,
"bytes": 16
}
]
}Unknown extension returns a warning without counts
{
"files": [
{
"content": "hello\n",
"path": "notes.xyz"
}
]
}{
"totals": {
"physical": 0,
"blank": 0,
"comment": 0,
"code": 0,
"mixed": 0
},
"byLanguage": {},
"files": [
{
"path": "notes.xyz",
"supported": false,
"language": "unknown",
"bytes": 6
}
],
"warnings": [
{
"code": "LOC_LANGUAGE_UNSUPPORTED",
"message": "Unsupported/unknown language for notes.xyz",
"severity": "warning"
}
]
}Recommended use cases
- Report code versus comment ratios in CI
- Measure supplied source size by language
- Aggregate LOC across a bounded file batch
Avoid for
- Cyclomatic complexity
- Semantic or AST-based analysis
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.