1C-Bitrix Code Audit: Diagnose Technical Debt and Plan Refactoring
Every change is a lottery
The project works, but you fix a feedback form — the cart breaks. A new developer spends a week understanding the structure; adding a simple page takes two days. The catalog loads in 5 seconds due to N+1 queries — customers leave. According to industry research, every second of load time costs 100,000 rubles in lost revenue. Our certified Bitrix specialists have over 10 years of experience and have audited 50+ projects. We guarantee a detailed report with actionable recommendations. Development speed drops, technical debt grows. We know how to fix it. Our code audit is an objective way to measure technical debt, document problems, and plan refactoring.
What problems are typical for Bitrix projects?
On a project with 3–5 developers, each writes in their own style. init.php often exceeds 2000 lines of handlers, half unused. SQL queries are scattered across templates. Infoblocks were created without structure — one block holds products, articles, and banners. Every fix takes half a day, and a change risks breaking neighboring functionality. In 90% of projects, we find N+1 queries that degrade performance. The audit systematically identifies bottlenecks and provides a concrete action plan with timelines. We don't just report — we show how to fix each issue and what the refactoring will achieve in numbers.
When is a code audit needed?
Signs that indicate an audit is necessary:
- Every release brings unexpected bugs — regressions in unrelated modules.
- Adding new functionality takes longer and longer (cyclomatic complexity increases).
- The team is afraid to refactor old code — no understanding of what will break.
- The project slows under load: pages take 3+ seconds to generate.
How Bitrix code audit differs from code review
Bitrix imposes its own patterns — components, templates, infoblocks, agents. Quality criteria are tied to them. A regular PHP audit doesn't account for API specifics: CIBlockElement, ORM, tagged caching, events. We check not just syntax, but compliance with platform best practices and SOLID principles.
What we check: three key areas
Infoblock architecture. Typical mistakes: one infoblock for heterogeneous entities (products and articles together); properties of type "String" instead of "Dictionary" — making filtering impossible; lack of composite indexes on b_iblock_element_property; storing data in PREVIEW_TEXT instead of separate fields. Proper design improves query performance by up to 70%.
Components and templates. Business logic in template.php instead of result_modifier.php — an antipattern. Direct SQL via $DB->Query() instead of ORM — reduces cohesion. Customization by modifying the kernel instead of extending class.php — problems with updates.
init.php. The main health indicator. On troubled projects — thousands of lines: handlers, functions, classes, SQL. On good ones — only an autoloader and event registration. The audit immediately reveals such "black holes".
How a code audit improves performance?
We use the performance monitor (perfmon) and enable $DB->ShowSQLStat = true. We count SQL queries per page. Normal: 30–80. Problematic: 300+ due to CIBlockElement::GetList() in a loop (N+1). We also profile PHP using Xdebug + Cachegrind. Our method identifies bottlenecks 3–5 times faster than manual testing.
Static analysis tools: phpstan/psalm — they find calls to non-existent methods. PHP_CodeSniffer — checks coding standards. We also measure coupling between components.
According to our statistics, after audit and remediation, performance improves by 40–60%. The audit costs from 50,000 rubles and typically pays for itself within 2 months due to reduced development time and increased revenue from faster page loads (saving up to 200,000 rubles per month).
How the audit works: step by step
- Code and database collection — we clone the repository and dump the database.
- Profiling — we run the performance monitor on typical pages.
- Static analysis — we run phpstan/psalm to find errors and violations.
- Manual audit — we check infoblocks, components, init.php, SQL.
- Report generation — a table of issues, priorities, recommendations.
Our case study: N+1 in an online store catalog
We managed an online store project where the catalog page took 5 seconds to generate. Analysis showed: in a loop over 50 products, 6 additional queries were made per product for properties — a total of 301 queries. After refactoring using CIBlockElement::GetList() with proper $arSelect, the query count dropped to 3, and time to 0.3 seconds — a 16x improvement. The audit is 3–5 times more effective than manual testing for identifying such bottlenecks.
What's included in the report
After the audit, you receive:
- A table of issues with file, line, severity, and recommendation.
- A prioritized resolution plan with estimated effort.
- Recommendations for improving architecture and performance.
- Code examples for fixing typical errors.
Sample report fragment
| Issue | File/Module | Severity | Recommendation |
|---|---|---|---|
| SQL in component template | /bitrix/templates/main/components/.../template.php:45 |
High | Move to result_modifier.php, use CIBlockElement::GetList() |
| N+1 when fetching properties | Component catalog.section (custom) |
High | Use GetNextElement() with PROPERTY_* in $arSelect |
| init.php 2000+ lines | /bitrix/php_interface/init.php |
Medium | Decompose into modules, load via autoloader |
| Error | Consequence | Solution |
|---|---|---|
CIBlockElement::GetList() in loop |
300+ SQL queries per page | One query with filter by ID |
| JSON in string property | Filtering impossible | Use separate properties or HL-block |
Direct $DB->Query() |
Migration difficulties | Rewrite using ORM |
How to order an audit?
Contact us for a preliminary assessment of your project. We'll provide a commercial proposal with timelines and cost. Order an audit and get a detailed refactoring plan with priorities and deadlines.
We recommend reviewing the infoblock API documentation for understanding best practices.

