How to Use the Module
Learn how to use the Alphanumeric CNPJ module
Prerequisites
Before you start, follow the instructions below to create and configure a Personal Access Token (PAT) in GitHub and connect it to StackSpot.
1. Create a Personal Access Token (PAT) in GitHub
Follow these steps:
1. Access your organization’s GitHub;
2. Click your avatar and select 'Settings';
3. Now click on 'Developer settings';
4. Click on 'Personal access tokens' and then 'Tokens (classic)';
5. Click the 'Generate new token' > 'New token (classic)' button;
6. In 'Note', add a name for the token and set an expiration date;
7. Select the repo and workflow scopes;
8. Click 'Generate token'.
The token will only be shown once. Copy and store it in a safe place; you will use it in StackSpot.
If your organization uses SSO, click the 'Configure SSO' button to authorize the token.
2. Connect the PAT to StackSpot
1. In the StackSpot Portal, go to the 'Account' menu;
2. In 'My Profile', click the 'External Connections' button;
3. Click the 'Connect' button (or, if already connected, click 'Disconnect' and then 'Connect' again);
4. Fill in the following fields:
- GitHub Username
- Personal Token
5. Click the 'Connect' button.
3. You must have read and write access on the GitHub repositories.
How to use the Alphanumeric CNPJ module in Code Shift
See below how to use the Alphanumeric CNPJ module. Follow the steps to import repositories and run the analysis and fix flow:
Step 1. Import repositories
Import a single repository
1. Go to the StackSpot EDP Portal and log in;
2. Select 'Code Shift';
3. Click the 'Import Repository' button;
4. Choose the 'Single repository' option;
5. Fill in the following fields:
- Tags to associate: select tags that represent the repository;
- Repository URL: e.g.,
https://github.com/your-org/your-repo; - Default branch: e.g., main or develop;
6. Click the 'Import' button.
Import multiple repositories via CSV
You can import several repositories using a CSV file. See how below:
1. In Code Shift, click the 'Import Repository' button;
2. Under Select how you want to import your repository: select the 'CSV file' option and click 'Select a file';
3. Create a CSV file with your repository information;
- See below for a template on how to create this file:
url,branch
https://github.com/customer-org/demo-cnpj-java,main
4. Select tags to associate: create tags to group your repositories;
Tags help you organize and group imported repositories. For example, if your team works with Pix, use tags like team.pix or pix/team2. This makes visualization and filtering easier in reports.
Before creating a new tag, check if there are already tags created by your organization. If you don't find a suitable one, create new tags to group repositories as needed.
5. Click the 'Import' button.
You don't have to scan first and then fix, as shown in the example below. These steps are just a demonstration of how it works. You can choose to scan only, or to scan and fix.
Step 2. Run the first Scan
1. In the repository list, click the 'View details' button on the desired repository;
2. On the reports page, click the 'Run' button;
3. On the first run, connect to GitHub:
- Enter your GitHub username;
- Paste the personal token you created earlier;
- Click the 'Save' button;
4. Select the 'Alphanumeric CNPJ' module;
5. In 'Mode', choose the 'Scan' option;
6. In 'Synonyms list', add or remove CNPJ-related keywords used in your repository;
-
The synonyms list is a field of the module itself. For CNPJ, the module already provides a pre-filled list with related terms such as: CNPJ, digitodocto, documento, numerodocumento, digitodocumento, nrodocto, numerodocto, numdocto, numdocumento, nrodocumento, filialdocto, filialdocumento, CGC.
-
You can add or remove other terms according to your project context. Example: codcliente
-
This list is important because it defines the terms the module will look for during scanning.
7. In 'Programming languages': Select All.
8. Click the 'Confirm' button to start execution.
Step 3. Monitor status and analyze the Report
1. Go to the 'Status' tab to monitor execution progress;
2. After the process finishes, click the 'Report link' button to access the report;
3. You will be able to view the following data:
- Files analyzed;
- Number of issues detected per file.
4. For details of each issue, click the 'View file information' button to be directed to the corresponding line in the repository.
Step 4. Fix the issues found (Scan and Fix)
1. On the desired repository, click the 'View details' button;
2. Click the 'Run' button again;
3. Select the 'Alphanumeric CNPJ' module;
4. In 'Mode', choose the 'Scan and Fix' option;
5. Fill out the following fields: os seguintes campos:
- Sinônimos: você pode adicionar mais itens à lista de sinônimos, ou mantê-la como está.
- Programming Language: adicione 'All' para indicar todas as linguagens. Se preferir, você pode escolher uma linguagem de programação específica.
- Branch de destino: Enter the target branch (example: fix/cnpj); (exemplo: fix/cnpj);
6. Click the 'Confirm' button;
7. StackSpot AI will apply the fixes automatically. Monitor progress in the 'Status' tab;
8. At the end, a Pull Request will be created with the fixes;
9. Review the changes and merge the Pull Request into the appropriate branch.
For more information about the scan, see the full execution report by clicking on Report link.
Edit a repository
Follow the steps below to edit a repository’s information:
Step 1. Choose the repository you want to update and click the 'View details' button;
Step 2. Click the 'Settings' button;
Step 3. Click the 'Edit' button;
Update the repository URL, default branch, or add tags as needed;
Step 4. Click the 'Save' button to apply the changes.
Delete a repository
To delete a registered repository, follow the steps below:
You can only access this option if you have permission to delete the repository.
Step 1. Choose the repository you want to remove and click the 'View details' button;
Step 2. Click the 'Settings' button;
Step 3. Click the 'Delete repository' button.
Once you delete a repository, this action cannot be undone.