Build and test badges are old! Welcome new member in your badge family — Code quality badge

Tushar Sharma
3 min readJul 23, 2020

If you are a big fan of build and test badges posted on your GitHub or any other hosting platform then keep reading; I am going to show how you can add code quality badge within your repository.

Software engineers are using badges within their open-source repositories to explicitly show the state of the build, test as well as test coverage. It helps not only developers working on the repositories but also users and potential contributors to the open-source repository.

Let me introduce you to QScored — An open platform for code quality and ranking. The platform enables you to not only see various code quality aspects of thousands of analyzed open-source repositories but also allows you to upload your code quality analysis report and assign a relative code quality score and rank to your project.

Step 1: Create your free QScored account

If you don’t have an account yet, create an account on QScored.

Step 2: Analyze your project

You need to analyze source code of your software written in C# or Java using Designite or DesigniteJava (Enterprise) respectively. Both the tools provide options to generate an XML file containing analysis results. The analysis results contain detected smells (implementation, design, and architecture) as well as various metrics.

For the Designite GUI version, click on “Export analysis result” and select XML as the export file format. Make sure that you select the “Export to one file” option.

For the Designite console application, use the following command to do the same.

DesigniteConsole.exe "c:\path\to\solution\file.sln" −X "C:\output\analysisResults.xml"

Use the following command to analyze a Java project and generate code analysis results from the DesigniteJava application.

java -jar designitejava.jar -i "c:\path\to\java\project" −o "C:\output\folder\path" -f XML

Step 3: Upload the generated code quality report

Log in to QScored and go to the “My Projects” page from the menu. Upload the generated code quality report (XML) by clicking the “Upload a new project” button on the “My projects” page. It will lead you to an upload page where you can specify the project name, version, the path of the XML file as well as the repository link (optional). If you would like to keep your project private (nobody other than you will be able to see the quality aspects on the platform, not even the project identity) you need to keep “open access” flag unchecked; if you want to keep the project identity public, check the box. Upon clicking “Upload”, the project is uploaded and saved to the QScored database.

Similarly, you may upload a new quality analysis report for a new version of an existing project. You need to select “Upload a new version” option on the right side of your projects row.

Step 4: Request a badge link

Go to the “Settings” page from the menu and request a badge link for your project by clicking the “Request a badge link” button. You will get both quality rank and score badge links to your registered email address.

Step 5: Put the links in a web page

You may put the obtained links in your GitHub repository page or your personal websites.

For website, you can add the link to the src of an img tag.

<img src=“Qscored score badge link or rank badge link” alt=“QScored badge”>

For GitHub readme.md, use the links following markdown format.

![QScored Badge](QScored score badge link or rank badge link)

QScored ranks all the projects periodically (weekly for now) and hence it may take some days before you start seeing the quality rank and score.

Example of code quality badge

That’s it!! You are ready to show off your code quality skills to the world.

You may explore (or even aspire) to be in the quality chart showing top ten projects categorized by the size.

QScored’s quality chart

--

--

Tushar Sharma

Student of life; student for life. Researcher, developer, and (co-)author of 'Refactoring for Software Design Smells'. Asst. prof@DAL. http://www.tusharma.in