Overview
Last updated
Last updated
The following is a quick overview of how to use iCR for Python. It is assumed that you have installed and launched iCR for Python from the package that you received from OpenRefactory (see Section 3 Getting Started). It is also assumed that you know the IP address of the host server where you installed iCR for Python.
Using that IP address, connect to the service using a standard browser of your choice.
iCR for Python consists of 3 major components:
The Navigator is the main component with which you interact;
The Analysis Engine analyzes source code and generates fixes;
The Reviewer helps you to review, approve/reject and apply the fixes. Using the Navigator, you will:
Direct the Analysis Engine to scan the source code of your Python project; and
Initiate the Reviewer(s) to examine the generated fixes and accept or reject them.
To understand how each of these steps is executed, let’s first look at how to select and analyze a project. The figure below outlines the steps taken to select the code to be analyzed and initiating the analysis.
Select the repository that you are using to manage your source code. This may be a Version-Control System (VCS) available on the cloud or as an in-house service. iCR for Python supports your choice of GitHub, GitLab and Bitbucket systems.
Navigator connects with the repository and fetches the source code to the server. The Navigator will use OAuth to authenticate with your VCS service. Once connected with the VCS, Navigator will present you with a view of all the available repositories associated with your User ID. You may then clone any repository you wish to examine, and you will have all of the branches available for analysis.
Pick a branch to analyze and simply click on the Analyze button in the Navigator.
Navigator will start the Analysis Engine as a background process. You may monitor the progress from the Navigator in a separate browser tab. For a long running analysis, you may choose to receive a notification and exit iCR. Only one analysis can be run at a time. Step 5. The Analysis Engine analyzes the source code and prepares the fixes. You may choose to have the Navigator send you an email notification when the analysis completes and the fixes are ready.
iCR for Python employs a suite of scalable deep analysis tools to provide a comprehensive analysis of your program’s flow with emphasis on tracking references across methods. From that analysis, iCR for Python then employs a broad family of what we call Fixers which are focused on common Python programming flaws and coding standards such as the PEP 8 Style Guide for Python Code . See Appendix A for a list of supported fixers in iCR for Python.
Once a project has been analyzed and fixes generated, they are available for review. The diagram below outlines the steps taken to perform a reviewing session.
Return to the Navigator when analysis is complete to review the fixes. Select any branch that has been analyzed and click on Review button within the Navigator. You may review past results even when the Analysis Engine is currently running on a project.
The Navigator starts the Reviewer component in a separate tab.
The Reviewer allows you to browse all of the fixes and gives you the opportunity to accept or reject various fixes. Any number of your developers can review and approve fixes concurrently. After approving fixes, you can Apply them to your project. If there are fixes that you are not clear about or you think are incorrect, you can let our developers know by filling out a quick feedback report for that particular fix.
The Reviewer creates a temporary branch in your repository with the potential fixes placed there as git commits. This gives you a standard way of choosing when you want to roll these fixes into your project branch(es).
The remainder of this guide will provide you with all the details needed to help you to run iCR for Python on your projects.