Skip to content
Revolutionize your code quality with mAI buddy

Revolutionize your code quality with mAI buddy

At Open Gate, we are committed to providing complete, tailor-made technology solutions for your business. Our innovative approach to custom software and dedicated cloud infrastructure has continuously redefined the possibilities in the technology sector. Today, we are excited to introduce our new experimental product: mAI buddy, a cutting-edge tool that integrates seamlessly with Git and ensures the quality, security and performance of your code.

As software developers, we understand the importance of timely and constructive feedback. Therefore, our product runs checks on every commit in real time, providing a detailed analysis of the code written. But how is this possible? It's simple: we have integrated the power of ChatGPT, a cutting-edge AI language model, into our system.

For each commit, our tool evaluates the code on three key parameters: security, style and performance. The AI assigns a score to each of these aspects, providing an overview of the quality of the code. In cases where the score is low, it provides further reasoning behind the lower rating. The detailed feedback is then forwarded to the developer, allowing them to understand their strengths and areas for improvement.

Let's See It in Action!

To better understand how our tool works, let's look at some examples.

Example 1: SQL Injection

Java
public List<AccountDTO>
  unsafeFindAccountsByCustomerId(String customerId)
  throws SQLException {
    String sql = "select "
      + "customer_id,acc_number,branch_id,balance "
      + "from Accounts where customer_id = '"
      + customerId
      + "'";
    Connection c = dataSource.getConnection();
    ResultSet rs = c.createStatement().executeQuery(sql);
    // ...
}

Tool Feedback

makefile
Security: 3
Style: 4
Performance: 2

The code is not secure because it is vulnerable to SQL injection attacks. It concatenates user input directly into the SQL query string without proper validation or parameterization. This can be mitigated by using prepared statements or parameterized queries. Furthermore, the code performs poorly as it executes the query synchronously without using optimization techniques such as connection pooling or query caching. The code also lacks a proper coding style as it does not follow best practices such as using meaningful variable names, proper indentation and comments to explain the logic of the code.

Example 2: No StringBuilder

Java
String str = "";
for (int i = 1; i <= 1000000; i++) {
  str += 'a';
}

Tool Feedback

makefile
Security: 8
Style: 7
Performance: 2

The code has a security score of 8 because there are no obvious security issues present. However, the code has a performance score of 2 because string concatenation inside a loop using the += operator is inefficient and can result in poor performance due to the creation of a new string object for each concatenation. This can be improved by using a StringBuilder to concatenate strings efficiently. The code has a style score of 7 because it follows basic coding conventions and is relatively easy to read and understand.

As you can see, the feedback provided by our tool is accurate and constructive, allowing developers to make the necessary changes and improve the quality of their code.

The main beneficiaries of this system are junior developers, who can now receive immediate, in-depth feedback on their code. Instead of waiting for periodic code reviews, they have the opportunity to refine their skills and their code with every commit they make. In addition, our tool helps to identify critical security bugs such as SQL injection, contributing to the overall security of your software.

By leveraging the capabilities of AI, Open Gate aims to revolutionize the way developers approach and improve their coding. The use of this technology not only guarantees a high standard of code, but also contributes to the team's constant professional growth.

It is with immense pride that we present this experimental product to you. Open Gate is excited to pave the way for harnessing artificial intelligence to improve code quality and developers' skills.

Follow us for further updates or contact us to start using mAI buddy: usher in this new era of technological innovation with us!