GitHub Action
DesigniteJava Incremental Code Quality Analysis
The action identifies code smells in the newly added code and creates issues automatically describing the newly introduced smells.
-
Analyzes Java source code at each push event using DesigniteJava wrapped in DJAction. The supported smells types are architecture smells, design smells and implementation smells.
-
Identifies the introduced smells in the newly added code using the designite_util library.
-
Creates new GitHub issues automatically describing each smell instance; consolidates the same kind of smells in one issue
-
Personal access token: Create a new personal access token for your GitHub repository. You may do it by going to your GitHub account's
Settings
->Developer settings
page. Select thePersonal access token
tab and create a new token. Add this token to your repository's secrets. Go toSettings
within your repository page and selectSecrets and variables
->Actions
. Add a new secret by pasting the access token in theValue
field and giving a meaningful name (e.g.,PAT
). -
Workflow permission: Make sure that the repository's
Workflow permissions
(Settings
->Actions
->General
) is set to Read and write permissions. If not, the action won't be able to create the issues or download the artifacts. -
DesigniteJava key (optional): If you have a professional or academic license key for DesigniteJava, add the key to your GitHub repository secrets. Let us call it
D_KEY
. If your codebase is less than 50,000 lines of code, it won't impact you.
Create a GitHub Action workflow file in the repository. First, we need to analyze the latest commit using DesigniteJava; this can be achieved using the DJAction
action. The DJAction
action stores the analyzed code quality report in the Actions artifacts.
The second key step of this exercise is to use this action with the required inputs. An example of the file is provided below.
- name: Run Designite analysis for the latest commit
id: designite
uses: DesigniteTools/[email protected]
with:
PAT: ${{ secrets.PAT }}
- name: DesigniteJava incremental code quality analysis and issue creation
uses: DesigniteTools/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
designite-output-old: designite-output-${{ github.event.before }}
designite-output-new: designite-output-${{ github.sha }}
repo-name: ${{ github.repository }}
- Here's an example issue created by this action:
Consider checking out this example repository utilizing this action.