LogicLoop Logo
LogicLoop
LogicLoop / devops-practices / Build a CI Pipeline: Automated Code Quality Checks for Developers
devops-practices June 2, 2025 5 min read

How to Build a Continuous Integration Pipeline with Automated Code Quality Checks

Marcus Chen

Marcus Chen

Performance Engineer

Build a CI Pipeline: Automated Code Quality Checks for Developers

Continuous Integration (CI) has become an essential practice in modern software development. It allows teams to detect issues early, maintain high code quality, and streamline the development process. In this comprehensive guide, we'll explore why CI pipelines are crucial for software development teams and how to implement one that automatically checks your code quality and suggests fixes.

Why You Need a CI Pipeline

In a typical software development team using trunk-based development or feature branch workflows, maintaining code quality is paramount. Without proper checks in place, issues can cascade, causing delays and technical debt.

Consider this scenario: You're working on a feature that requires multiple commits. After completing the feature, you create a merge request only to discover numerous issues with your code. These could range from code duplications to outdated libraries or security vulnerabilities. Now you must spend additional hours or even days fixing these problems.

This is where a CI pipeline becomes invaluable. By running automated tests on every commit, you can identify and fix issues immediately rather than accumulating them until the merge request stage.

Comprehensive testing ensures your code is ready for integration and deployment
Comprehensive testing ensures your code is ready for integration and deployment

Types of Tests in a CI Pipeline

A robust CI pipeline includes various types of tests to ensure code quality and functionality:

  • Unit and integration tests that verify code logic with different inputs and parameters
  • Security tests that scan dependencies for vulnerabilities and check for hardcoded secrets
  • Code quality tests that identify bad practices, duplications, and maintainability issues

In this guide, we'll focus on implementing code quality tests using Qodana, a powerful tool that can analyze code across multiple programming languages.

Feature Branch Workflow vs. Trunk-Based Development

While trunk-based development is often considered ideal for DevOps-driven projects, many teams use a feature branch workflow. This approach allows developers to work on features in dedicated branches without affecting the main codebase.

The key advantage of running tests on feature branches is that it prevents problematic code from reaching the main branch. If tests fail after merging to main, it can block other developers' work until issues are resolved.

By shifting tests left—running them earlier in the development process—we can catch issues sooner and minimize disruption.

The Concept of Shifting Left

"Shifting left" refers to moving testing and quality checks earlier in the development process. The earlier we catch issues, the less expensive they are to fix.

  1. IDE inspections (earliest): Modern IDEs like IntelliJ offer built-in code inspections that highlight issues as you type
  2. Feature branch CI pipeline: Automated tests run on every commit to feature branches
  3. Merge request pipeline: Tests run when a feature is ready to be merged
  4. Main branch pipeline: Final verification after merging

The earlier in this sequence we catch issues, the faster and cheaper they are to fix. This is why CI pipelines on feature branches are so valuable, especially for junior developers who can learn from immediate feedback.

Building a CI Pipeline with GitHub Actions and Qodana

Let's implement a CI pipeline that uses GitHub Actions as our CI server and Qodana for code quality analysis. This setup requires just two simple steps:

  1. Create a GitHub workflow file for the CI pipeline
  2. Create a Qodana configuration file (qodana.yml)

Qodana, developed by JetBrains, uses the same inspection mechanisms built into their IDEs. It can identify code issues and even suggest automatic fixes, which can be applied through merge requests.

Qodana configuration with inspection profiles for comprehensive code analysis
Qodana configuration with inspection profiles for comprehensive code analysis

Setting Up Qodana Configuration

If you're using IntelliJ IDEA, you can generate a qodana.yml file by going to Tools > Qodana > Try Run Qodana Locally. This creates a configuration file with default settings that you can customize.

YAML
# qodana.yml example
version: "1.0"
profile:
  name: qodana.recommended
exclude:
  - name: All
    paths:
      - .idea
      - .github
      - build
      - node_modules
1
2
3
4
5
6
7
8
9
10
11

The profile section specifies which set of inspections to use. You can choose from predefined profiles or create custom ones based on your project's needs.

Creating the GitHub Workflow

Next, we need to create a GitHub workflow file to run Qodana on our code. This file should be placed in the .github/workflows directory.

YAML
# .github/workflows/code-quality.yml
name: Code Quality

on:
  push:
    branches: [ main, feature/* ]
  pull_request:
    branches: [ main ]

jobs:
  qodana:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          args: --save-report
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

This workflow runs on pushes to the main branch and any feature branches, as well as on pull requests to main. It uses the official Qodana GitHub Action to scan your code and generate a report.

Qodana cloud integration allows teams to track code quality metrics and share results
Qodana cloud integration allows teams to track code quality metrics and share results

Advanced Qodana Features

Qodana offers several advanced features that can enhance your CI pipeline:

  • Automatic code fixes: Qodana can create pull requests with suggested fixes for detected issues
  • Quality gates: Define thresholds for acceptable code quality, failing the build if not met
  • Baseline: Compare current code quality against a baseline to track improvements
  • Cloud integration: Store and visualize reports in Qodana Cloud for better team collaboration

To enable automatic fix suggestions, add the following to your workflow:

YAML
- name: 'Qodana Scan with Auto-fixes'
  uses: JetBrains/[email protected]
  with:
    args: --apply-fixes
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1
2
3
4
5
6

Benefits for Development Teams

Implementing a CI pipeline with automated code quality checks offers numerous benefits:

  • Early detection of issues reduces the cost and time to fix them
  • Consistent code quality across the team, regardless of individual practices
  • Learning opportunity for junior developers who receive immediate feedback
  • Reduced manual code review burden, as common issues are caught automatically
  • Prevention of broken builds in the main branch, keeping it in a releasable state
  • Improved overall software quality and maintainability

Conclusion

Continuous Integration pipelines with automated code quality checks are essential for modern software development teams. By shifting testing left and implementing tools like Qodana with GitHub Actions, teams can catch issues early, maintain high code standards, and streamline the development process.

Whether you're using trunk-based development or a feature branch workflow, these practices will help ensure your codebase remains clean, maintainable, and ready for deployment at all times. Start implementing these practices today to see immediate improvements in your development workflow and code quality.

Let's Watch!

Build a CI Pipeline: Automated Code Quality Checks for Developers

Ready to enhance your neural network?

Access our quantum knowledge cores and upgrade your programming abilities.

Initialize Training Sequence
L
LogicLoop

High-quality programming content and resources for developers of all skill levels. Our platform offers comprehensive tutorials, practical code examples, and interactive learning paths designed to help you master modern development concepts.

© 2025 LogicLoop. All rights reserved.