Logo Time4Digital Logo Time4Digital
  • Web Agency
  • Services
    Overview of all services
    Web development and software development
    Support for your website & web application
    Innovative & sustainable website agency
    Onlinemarketing & Search Engine Optimisation
    Content Management Systems
    E-Commerce Solutions
    Local SEO agency
  • Portfolio
  • Websites
  • Team
  • Insights
  • Book
    appointment
  • Free
    SEO Check
  • English
  • Deutsch
  • French

AI Quality Gate

Written on 21.11.2024 16:36 by jt

A software solution should alway be in flux, that's why this blog is all about the topic Quality Gate and AI. The question of maintenance, continous development and operation is top priority. Through various approaches (team organisation and company-mindset, to name a few), people try to keep the delivery cycle as short as possible. Such dynamics only work when a high degree of automation an transparency is available. An important part of this is the Quality Gate.

The meaning of Quality Gate

At the quality gate, the approval of the next project steps is clearly determined in advance based on quality criteria. How can the quality of code be assessed in this context? In general, a lot of "Clean Code" techniques revolve around the following question: How to write code in a team of developers that keeps the training period of new members to a minimum? Aside from static code analysis (complexity, bug heuristic, and so on) - Keyword Sonarqube) comes to mind, code review is a viable solution.

Who is responsible for quality control?

Code review enabled the transfer of know-how from senior developers to new team members.

More often than not, this takes a lot of time. As such, software architects should primarily take care of this task.

Let's get to the topic of deployment pipelines. Those tend to look as follows:

  1. Write & commit code
  2. Trigger build (Unit tests, acceptance tests, integration tests, an so on)
  3. Quality Gate (Clean code standards, security, licencing, an so on)

The code review only takes place after these steps.

Code Review & Quality Gate

The role of AI

Let's try out a Code Completion interface by OpenAI, that can support code quality checkes. Our example project has 2 different methods, one in Typescript and one in Java. The Typescript-function does a simple addition:

function add(x, y) {   return x + y;}

The Java-class is garbled nonsense, with untelligible naming conventions:

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class SomeClass {

    static boolean sA(final String s) {
       
        String bKram = s;
        String sFe = fo(bKram);
        return bKram.equals(sFe);
    }

    static String fo(String bKram) {
        List<String> faef = Stream.of(bKram).map(c-> c).collect(Collectors.toList());
        StringBuilder dram = new StringBuilder(bKram).reverse();
       
        if(Objects.nonNull(faef)) {
            return dram.toString();
        }
       return null;
    }

Let's give this a shot:

const question = "Can you write Unit Test for this Code : ";

We'll use the createCompletion API by OpenAI

const completion = await openai.createCompletion({
        model: "text-davinci-003",
        prompt: question + fileContents,
        temperature: 0,
        max_tokens: 3600,
    });

Here we are:

@Test
public void testSA() {
    String s = "test";
    assertTrue(SomeClass.sA(s));
}

@Test
public void testFo() {
    String s = "test";
    assertEquals("tset", SomeClass.fo(s));
}

We're still not quite sure what the class is supposed to do, but the functionality has been squeezed out in seconds.

The same can be done for our Typescript-function:

describe('add function', () => {
  it('should add two numbers', () => {
    expect(add(1, 2)).toEqual(3);
  });
});

Handing the Java-function over to ChatGPT, the AI was quick to find out that the unintelligible function actually checks whether or not the parameter is a palindrome. As such, the AI did comprehend the goal of the function:

KI und Ihr Nutzen für Quality Gate

AI Quality Gate

Let's get back to topic and analyze the use of AI for Quality Gate. Can AI be used to generate unit tests for new code?
Concise methods with little side effects are very likely interpretable and testable by AI.
Conversely, this means that AI can act as a filter to highlight areas that are relevant for code review.
By adding AI to our pipeline, it will look as follows:

  1. Write & commit code
  2. Trigger build (Unit tests, acceptance tests, integration tests and so on)
  3. AI code review
  4. Quality Gate (Clean code standarts, security licences, and so on.)

AI in Deployment Pipelines

This way, AI can be integrated into deployment pipelines as well as be applied to security aspects with regard to the written code increasing the stability, maintainability and the quality of the delivered software. The most important result achieved by the use of AI in regard of Quality Gate however is the productivity increase during the development cycle.

  • Facebook
  • LinkedIn
  • WhatsApp
  • E-mail
  • Twitter
time4digital S.à r.l.

2C, op der Gare
L-6850 Manternach

Phone: + 352 29 20 21

About us

Our core expertise is the development, construction and manufacture of system solutions that are tailored to the customer´s particular requirements.

Contact us!
Legal
  • Imprint
  • Data protection
  • Cookie Consent

    Change privacy settings
Gehe zu
  • Home
  • About us
  • Services
  • Portfolio
  • Our Team
  • Contact

© time4digital S.à r.l.

Our website uses cookies.

These cookies are essential for the functionality of the website.

Protects from cross-site request forgery attacks.

Provider: Time4Digital
Retention period: This cookie will only remain for the current browser session.

Stores the current PHP session.

Provider: Time4Digital
Retention period: This cookie will only remain for the current browser session.

These cookies are optional and do not affect the functionality of the website.

This cookie name is associated with Google Universal Analytics - a major update to Google's more commonly used analytics service. This cookie is used to distinguish unique users by assigning a randomly generated number as a customer identifier. It is included in every page request on a website and is used to calculate visitor, session and campaign data for the website's analytics reports.

Provider: Google
Retention period: 1 year 1 month

This cookie is used by Google Analytics to maintain the session status.

Provider: Google
Retention period: 1 year 1 month