The Analysis page is the most important page in the P42 workflow. In the Analysis page, you can:
- Configure analysis and commit check settings,
- Understand the P42 approach for each suggestion category, and
- Review the suggestion details for each source file, and
- Open a pull request for accepted suggestions.
To view the Analysis page:
- Log in to P42.ai and click on Repositories.
- In the Repositories page, click to select a GitHub repository.
- In the Repository page, click on a type of analysis to view the Analysis page.
Here are the elements you can find in each Analysis page:
Link to Repository page
Shortcut to return to the Repository page.
This section provides a brief description of the analysis, and the type of refactoring or code modernization approach supported by P42.
If this setting is enabled, P42 identifies and includes suggestions for this type of analysis for the GitHub repository. You can choose to disable analysis if you do not want certain modernization methods for your repository. When disabled, this type analysis will not be performed, and results will not be available in the Repository page.
Commit checks setting
You will only see this setting if Analysis is enabled. If commit checks are enabled, P42 automatically analyzes and provides suggestions when there are pull requests, and when new commits are made to the repository. See Commit Checks for more information.
You can create a new commit with all the accepted suggestions from P42 and automatically open a pull request by clicking the Open Pull Request button. See Pull Request for more information.
This is where you will find the detailed analysis results for your repository. See Analysis Details for more information.
Various types of warnings related to the analysis. P42 generates warnings if the suggested changes could potentially affect the semantics of the source code, or if there were source files that could not be analyzed during runtime.
This section displays the total number of suggestions and lists all the files with at least one refactoring or modernization suggestion from P42. You should carefully review the suggestions for each file before opening a pull request.
Number of suggestions
Number of code refactoring or modernization suggestions based on the latest analysis of the repository.
💡 If you see the "Analysis timed out" status, this means the analysis runtime for the repository has exceeded ten minutes. You can try to resolve this error by excluding large files or folders (e.g. imported third-party libraries) from the analysis. See Repository Page - Path Exclusions for details on how to do this.
Not analyzed files
List of source code files that could not be analyzed by P42. This could happen if the analysis runtime ten minutes for the repository, or if the raw data diff size for the file has exceeded 65 kb. See Get Started - Limits and Boundaries for more information.
Click to show the detailed code refactoring and modernization suggestions for all source files.
Click to hide the detailed code refactoring and modernization suggestions for all source files.
Exclude suggestion button
Once you have reviewed the suggestions identified by P42, you can choose to accept a particular suggestion, or reject it clicking the exclude suggestion button next to a source file. The action to exclude the suggested changes for a source file becomes void if there are updated suggestions from P42, or if there are any changes (e.g. new commits) to the source file.
View source file button
Click the view source file button next to a source file to view the original content in GitHub.
Expand and Collapse button
Toggle the expand and collapse button next to a source file to show or hide the detailed code refactoring and modernization suggestions from P42 in a diff view.
The diff view for a source file is similar to what you would see when making a pull request in GitHub. Original source code is highlighted in red, and P42-suggested changes are highlighted in green. Once you have reviewed the suggested changes, you can decide whether to accept the P42 suggestions (e.g. do nothing), or exclude P42 suggestions for the given source file when you open a pull request.
Open Pull Request
Once you have reviewed all suggested changes for your repository, you
can open a pull request by clicking on the Open Pull Request button. This creates a new pull request containing all
the accepted P42 suggestions in a single commit.
If the pull request is created successfully, you will see a link to the GitHub pull request, and the number of refactoring or modernization suggestions that are included in the commit. You can navigate to GitHub to rename the default P42 pull request title and/or edit the pull request message as necessary. Once you are satisfied with all the committed changes, you can merge the pull request to the default branch of your repository.
Update Pull Request
You may need to update a pull request when:
- You exclude or re-include a suggestion from P42, or
- Any changes are made to a source file, and not all P42 suggestions are still valid.
If a pull request needs to be updated, you will see the Needs Update warning. This warning tells you that the currently-open pull request is out-of-sync with the latest suggestions from P42.
Once you have reviewed the new suggestions, click on the Update Pull Request button to commit the latest changes to the existing pull request. Proceed to review the latest commit in GitHub accordingly.