Beyond Bugs: The Hidden Impact of Code Quality ( part 2 )??

Beyond Bugs: The Hidden Impact of Code Quality ( part 2 )??

Introduction?

As we mentioned in the last part about the importance of code quality and standards, today we will discuss tools to help measure it and visualize detailed reports about your code. Finally, we will learn some tips on how to improve our code. Let’s Start ??

??Table of content?

  • Tools to measure Code Quality.
  • Tips for Improving Code Quality.
  • Conclusion.

Tools Used to Measure Code Quality ??

In a world overflowing with data, numbers often speak louder than words. That’s why some tools can analyze your code for you, using proven methods and techniques to offer suggestions for edits and improvements.?

These tools also provide visualized reports and charts about your code.

They can integrate with version control systems like GitHub to access repositories directly or operate locally on your machine.

  • Sonarqube?

It’s an open-source quality management tool that detects various types of issues such as bugs, vulnerabilities, code smells, and security hotspots

It comes with built-in quality profiles designed for each supported language.?

SonarQube includes a feature called SonarLint, and you can add it to your code to analyze it locally. You can integrate SonarLint as a plugin within your IDE for real-time feedback.

How does it work?

Sonar Qube has some rules that are based on code quality standards. When you configure your project and download the sonar scanner, it starts to analyze your code, and then it takes roles from the Sonarqube server.

?Roles are based on software quality and clean code attributes that measure how your code is quality.

It applies for these roles in the scanned code, then it generates reports and shows them in your dashboard like this?

Here, he passed the code, but there are some issues that he needs to fix.

It produces details of each issue, where is it in your code and how to fix it.

Additionally, the CI/CD Pipeline can accommodate its implementation. If you are unfamiliar with what it is, that’s alright - you can utilize it independently.

To be honest, not all issues are true all the time, you just will read it and see what needs to be fixed.

You can install it on Windows, Linux,macOS, or with Docker, see the full documentation here https://docs.sonarsource.com/sonarqube/latest/

This excellent resource for understanding it?

https://youtube.com/playlist?list=PLDhScTEBdP8ym3PaMkkTVuaaVHV2ktI0j&si=6Sg8nAukTWyXWbk2

  • code climate?

It’s like Sonarqube but doesn’t offer detailed reports and doesn’t support all languages, you can see it from here?

https://codeclimate.com/

  • CodeScene:?

This tool builds on the open-source project Code Maat to analyze every file and every commit in the repo and identify hotspots and churns.

?It generates visualized metrics, making it easier to decide where to focus on your quality improvement efforts.?

You can install the code scene IDE extension.

The dashboard generates visual reports about code health and identifies areas that require improvement.











It also provides an analysis summary for the repo number of commits, authors, code health, etc…..


You will find more data if you discover it, not all features are free, but you still can try some of them.?

Discover from here:?

https://codescene.com/

  • SNYK?

It’s a security platform that focuses on helping developers find and fix vulnerabilities in their code, dependencies, containers, and infrastructure as code (IaC).

It scans code and makes reports of weak parts and how to fix it?

You can log in to the dashboard from here:?

????????https://snyk.io/

When you run it in the terminal, it will be like this:

As we say, it checks for code dependencies and containers but don’t make a full check for the security of the code, you should still review it manually.

?See full documentation and how to set up?

https://docs.snyk.io/

We don’t rely on these tools as a main source. You should make a code review manual continuously for your project and enhance the code as you can.

Tips to improve ??

  • ??Dev tools are wonderful for debugging your code and improving it continuously. It helps to see how the code takes from memory, CPU, and performance of your app.

  • Following the best practice in the language you write, it’s a set of methods and techniques that produce optimal results for your code.

You can learn more about this from here?????

https://www.indeed.com/career-advice/career-development/what-are-best-practices

  • Try to remove unnecessary libraries, packages, or images that aren’t used.

  • Ensure that you implement error handling and logging in your code.

  • Use images as SVG as possible to reduce the size of the app or the loading time of images.

  • Create CI/CD (continuous integration Continuous delivery) pipelines to ensure that we test every push or edit in a feature before starting a new feature.?

  • Cache your data that is frequently accessed from memory as much as possible to improve performance.?

  • Loading data asynchronously means loading it in the background without blocking the user interface, so it will enhance the end-user experience.?

  • Always read the code and refactor it as you can.

  • Don’t forget to document your code to express itself.?

  • Use version control as GitHub to collaborate with the team to make code reviews and track changes in the code over time, it makes it easy to return to any change if there are any errors or bugs.
  • Use a linter. It helps in code formatting by checking code syntax errors, style violations, and possible bugs for static analysis. You can use a language linter or write your lines (rules).?

I recommend reading this book. You will find more details and you will enjoy it :?

https://people.engr.tamu.edu/slupoli/notes/ProgrammingStudio/supplements/Code%20Complete%202nd.pdf

Conclusion ?

The responsibility of measuring code quality is standing for each developer in the project from the team lead, developer, and tester.

This will come from practice and experience. You can go to open-source projects, try to contribute to them, and see how can you maintain the code quality.?

Try to learn OOP, and SOLID Principles and read the clean code book. This will help you to enhance your code quality.

Remember, being a good software engineer isn’t just about delivering products, it’s about delivering high-quality software that stands the test of time.

This test Cases template sheet, you can use it in your project :?

https://docs.google.com/spreadsheets/d/11nAISjsWE7yVCiL-ihEp4rQ42-7-LeX9TsK03ofO4Z8/edit?usp=sharing

That's it! Start to check your Code Quality! Connect with me on LinkedIn and GitHub for more articles and insights. If you have questions, contact me.

https://linktr.ee/rowan_ibrahim

Remember, "Later Equals Never." ??

Aseel Aleuony

Computer Vision Enthusiast | IT Student | Exploring AI & Machine Learning

2 个月

???? ???????

要查看或添加评论,请登录

社区洞察

其他会员也浏览了