In many small and mid-sized companies, there is no code review, so it is easy to have “irreplaceable” programmers.

A lot of so-called big boys can solve problems, but very few people can read his code. If you try to analyze the code, you will find that it is arbitrary: global variables are pushed too far, functions are too arbitrary, code logic is chaotic, functions are nested and recursive everywhere, chain calls are too many, no comments at all, and so on.

However, because the code is effective but difficult to understand, it is easy to be regarded as a “big bull”. With years of work experience, he can quickly analyze and solve problems and save various fields, and soon he became the best problem solver in the team. Should 1: no matter black cat white cat, can catch mice is a good cat. However, such a “good cat” is not good for the long-term development of the team, the complaints will become increasingly heavy, but their boss can only love and hate.

To such a situation, it can only be solved slowly, mainly from the following aspects:

The management level

Let others share the work of Daniel, and in order to avoid “abandoned”, reward Daniel appropriately, such as salary increase, new business arrangement, promotion and so on. Also control the code habits and quality of new successors.

The technical level

Introduction of code scanning tools, centralized code management, the use of tools to code writing standards, potential vulnerabilities for a comprehensive check.

Coordination level

Introduce code review mechanisms. Through multiple code review, to avoid one person’s code become a black box in the project.

The technical and collaborative aspects are easy to talk about, but if you don’t use tools, they are basically empty words that can’t be implemented, and if tools are difficult to use, it can have a big impact on the efficiency of execution.

Let’s use Gitee Enterprise edition as an example to show you how to use tools to check code specifications for code reviews.

Code scanning

Select “Gitee Scan” in the enterprise repository where code Scan is required

Create a new code scan and select branches, paths, and languages to scan (multiple options)

After scanning, click “View” to enter the scanning report

The scan report has pinpointed the problem to the line of code

Code reviews

In the Pull Request of the enterprise repository, you can clearly see the files and changes involved in a PR

Administrators can comment on the submitted code

After the code review passes, you can merge the commit

Code review is a rigorous and long-term development management system that everyone will support, but if it is implemented too rigorously, it can become formalistic. Tools are only auxiliary, while system is the core. Only by making full use of the convenience brought by tools and avoiding system from becoming the burden of programmers’ daily work can we truly improve the code quality of the team and ensure the stable development of the company’s business.

I’m Janny from Gitee. If you think this article is valuable to you, please scan the QR code and add my enterprise wechat to discuss it. If you’re interested in how Gitee can help with code review, you can also contact me for a promo code.