📜 ⬆️ ⬇️

Improving the quality of the code with the help of automatic utilities

Quite a large number of people use github to store the source code of their projects. The ideology of fork / pull request makes it quite easy to perform code reviews. Code reviews to a large extent make it possible to raise the coding quality in a project. However, often the person performing the code review is forced to check the coding standards adopted in the project, and other obvious things not directly related to the problem solved in the pull request. Such coding errors can and should be detected automatically.

lint (likely to be bugs) programs are designed to find suspicious and intolerable parts of the code. Modern lint-programs are often examined including for compliance with the coding standard. Of course, each developer is obliged to install on his computer a utility to check the code and create pull requests only if the code is clean. However, problems of integration, misconfiguration, not attentiveness or just negligence lead to the fact that coding standards are violated. In the network there are a sufficient number of utilities that perform the verification code, they are all different in terms of settings and output formats. In a multi-lingual company, this leads to the fact that setting up a workplace is not a trivial task.

I bring to your attention a service for automatic code verification by well-known lint-utilities. Currently supported:


There are several ways to use this service. You can simply try and check any pull request, for this you need to insert a link into the appropriate field and click the Advice button.
')


After much deliberation, you will receive a generated report on all files from the pull request.



Owners of private repositories can also check their pull requests. To do this, create an access token and enter it into an additional form field. If you are concerned about a healthy form of paranoia, then there is still an opportunity to deploy this service locally, who are interested, please write in a personal.

Another way to use the service is to use plug-ins to browsers hrome or Firefox. After they are installed, a button will appear in the browser, when clicked, a check of the open pull request on the current page will be performed.

But, the best way to use it is to configure a Post-Receive Hook for your repository. In this case, after each update of the pull request, it will be checked, and on the request page itself there will be a small description about the quality of the code.

For example, good code:


And this is not very:


To configure the service to work with your repository, you need to create a WebHook URL unlint.org/github/hook:token unlint.org/github/hook:token . The parameter :token needed only for private repositories in order to provide access to the checking service. Anyone not very familiar with github api can use the form to generate curl request to create a WebHook URL.

IMPORTANT. You cannot use the form in the settings of your repository to create a WebHook URL because it creates an observer for your commits and not pull requests, you need to use github api to create a WebHook URL that monitors pull requests.

The use of this service allows you to facilitate the work of verifiers, and standardize the code in the company.

unlint.github.com
Project page github

Why is the service so slow
At the same time, no more than 3 files are checked, this is due to the low server performance. You can deploy unlint locally to solve these problems.

I found a bug / I need to add a check
You need to write to me or on github.

I need other standards
You can deploy unlint locally and configure any checks.

Is it safe to use token to access private repository?
No, it is not safe, because data is transmitted over an unencrypted channel.

How to deploy locally
All sources are available in the project repository, so the service can be installed locally. Detailed documentation yet, please contact lichku help.

Source: https://habr.com/ru/post/169521/


All Articles