DEV Community

Hamdi Kaptan
Hamdi Kaptan

Posted on

Things to Check Before Pushing Your Code

In this article, I will talk about what you need to check before pushing your code. The scope of the article is checks about your code and the factors that will facilitate the work of those who will review or make edits later ; not about your code performance. Lets get started

1- Naming

Make sure that any variable, function, class name, loop variables do not contain special characters of your mother language.

The names of variables, functions, class names, loop variables has to accurately reflect their purpose and neither be short nor too long.

Other than loop variables, single letter (i, j, k, l) variable names should not be used. In fact, since the variables of the loop serve a purpose, they should get proper naming for their purpose.

2- Readability

Although the lines of comments seem unnecessary in the instant of the software development, it makes it easier to read and modify the codes. Making a description of what the rough draft does for the class, the function or a variable or even a loop does not hurt for the program developer,
it will also provide an advantage for those who will code review the program.

Editing the code in accordance with the standards for more readable code of the software language.
(PEP8, Python) (Swiftlint, Swift) etc.

Logging is very important to know what your code is doing while working. Attention should be paid to the degrees of logging. 

3- Adding, Commiting, Pushing

The place of the code you write in version control systems is very important. The first thing to note is that we are in the right branch. If there is, we should make sure that the epic branches belong to the correct branches.

In your commit, you only need to add the files that you want to affect the entire source code.
Your commit message should be such that it can give an idea of ​​the whole work.

It is very critical that the code you write can be understood by your teammates and who will edit your code later.

Top comments (2)

bilbeyt profile image
Tolga Bilbey

I am agreeing your thoughts about comments, but it is important that you are not over commenting. It should be meaningful. Another thing to mention is git-hooks that can check for any styling problems in the code before pushing.

mirat profile image

Naming convention depends on the programming language that you're working on.

The first priority is the language of programming language. For example, If you're developing with Qalb you have to select your variable and function names from Arabic. :)

By the way if the code repo is not new and you see that there are names outside programming languages language you have two options:

  1. Force yourself and people to refactor whole repo for correct naming.
  2. Continue with existing naming.