Code Formatting
Learn about important code quality traits and how to best utilize a coding style guide.
We'll cover the following...
Is clean code only about formatting and structuring the code? The short answer is no.
There are some coding standards like PEP-8 that state how the code should be written and formatted. In Python, PEP-8 is the most well-known standard, and it provides guidelines on how we should write our programs, in terms of the spacing, naming conventions, line lengths, and more.
However, clean code is something else that goes far beyond coding standards, formatting, linting tools, and other checks regarding the layout of the code. Clean code is about achieving quality software and building a system that is robust and maintainable. A piece of code or an entire software component can be 100% compliant with PEP-8 (or any other guideline) and still not satisfy these requirements.
Even though formatting is not our main goal, not paying attention to the code structure has some perils. For this reason, first we'll analyze the problems with a bad code structure and how to address them. After that, we'll see how to configure and use tools for Python projects to automatically check the most common problems.
To sum this up, we can say that clean code has nothing to do with things like PEP-8 or coding styles. It goes way beyond that, and it's something more meaningful to the maintainability of the code and the quality of the software. However, as we'll see, formatting code correctly is important to work efficiently.
Adhering to a coding style guide on projects
A coding guideline is the bare minimum a project should have to be considered ...