Analysis Page

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:

  1. Log in to P42.ai and click on Repositories.
  2. In the Repositories page, click to select a GitHub repository.
  3. In the Repository page, click on a type of analysis to view the Analysis page.

Elements

Here are the elements you can find in each Analysis page:
Analysis page for Using Arrow Functions

  1. Link to Repository page
    Shortcut to return to the Repository page.

  2. Analysis summary
    This section provides a brief description of the analysis, and the type of refactoring or code modernization approach supported by P42.

  3. Analysis setting
    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.

  4. 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.

  5. Pull request
    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.

  6. Analysis details
    This is where you will find the detailed analysis results for your repository. See Analysis Details for more information.

  7. Warnings
    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.

Analysis Details

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.

Analysis Details

  1. 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.

  2. 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.

  3. Expand All
    Click to show the detailed code refactoring and modernization suggestions for all source files.

  4. Collapse All
    Click to hide the detailed code refactoring and modernization suggestions for all source files.

  5. Source files
    List of JavaScript / TypeScript source files with at least one suggestion resulting from the P42 analysis.

  6. Exclude suggestion button Click to exclude the suggestion from P42 for the source file
    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.

  7. View source file button Click to view the full source file in GitHub
    Click the view source file button next to a source file to view the original content in GitHub.

  8. Expand and Collapse button Click to expand and view the details of the P42 suggestions for the source file Click to collapse and hide the details of the P42 suggestions for the source file
    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.

  9. 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.

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.
Open Pull Request button in the Analysis page

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. Update an outdated pull request

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.

Quick Navigation