compuware test drive integrations - sonarlint drive... · next, you will bind this project to a...

38
1 Compuware Test Drive Integrations - SonarLint Revised: 4/2/2020 This tutorial will show how to integrate SonarLint within Topaz to perform “on-the-fly” as well as ad- hoc code analysis during development phase }

Upload: others

Post on 19-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

1

Compuware Test Drive

Integrations - SonarLint Revised: 4/2/2020

This tutorial will show how to integrate SonarLint within Topaz to perform “on-the-fly” as well as ad-

hoc code analysis during development phase }

Page 2: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

2

Contents

Getting Started ................................................................................................................................. 3

Instructions .................................................................................................................................. 3

Code Changes ................................................................................................................................... 9

Cleanup .......................................................................................................................................... 32

NEXT STEPS .................................................................................................................................... 38

Page 3: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

3

Getting Started

The goal of this Test Drive section is to introduce you to ISPW Projects and how they can be used to integrate with SonarLint within Topaz to perform “on-the-fly” as well as ad-hoc code analysis during development phase.

This test drive will take you through the following activities:

• Creating an ISPW Project

• Using filter in ISPW Project

• Creating an Assignment

• Binding ISPW Project to SonaQube project

• Checking-out tasks into active assignment

• Opening/editing the tasks for “on-the-fly” analysis

• Performing ad-hoc analysis on a task

Instructions

• This guide contains many screenshots to provide a visual reference

• Every action you must take is in BOLD

• Please note each place that you must enter your own specific ID or number

• You must complete each step before proceeding to the next to successfully follow the guide

NOTE: if you wish to rerun this Test Drive Script, simply restart the Test Drive script from page 32 (Cleanup section).

Page 4: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

4

The Compuware Test Drive Experience requires that users complete the Building Your Environment exercise before starting any tutorial script.

http://resources.compuware.com/hubfs/Test%20Drive/Building_Environment_with_Host_and_JES_Explorers_TW_Test_Drive.pdf

If at any point during your experience, your host connection times out, you may need to log back into the Test Drive host connection.

Note: The SonarLint eclipse plugin has already been installed into Topaz, which is a pre-requisite to integrating Topaz with SonarLint.

Page 5: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

5

To get started in the Topaz Workbench:

Open the Host Explorer perspective

Click on the arrow next to Hosts,

Right-click on Test Drive and select Login

Logon on with the user credentials that were provided to you for the Test Drive and click OK

Select ISPW from the Compuware menu

Page 6: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

6

During this Test Drive you will encounter terms specific to ISPW. Here is a glossary for your convenience

Page 7: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

7

TERM DESCRIPTION

Application Business Area

Stream Development Life-Cycle used by one or more Applications

Life-Cycle Transitional Code States (DEV, QA, PROD) in the Development Life-Cycle

Level Instance of a Code State (DEV, QA, PROD)

Component SCM managed object such as a COBOL source member.

Component Version An immutable version of a Component.

Task An instance of a unit of work. For example, a change to a Component.

Part A generated object such as a load module, or a Listing or a DBRM

Warehouse Storage location for inactive historical or overlaid Component Versions (source and parts).

Assignment Container A package of one or more, usually related, Tasks. A development container that is used to organize and manage development work.

Release Container A package of Tasks from one or more Assignment Containers. An operational container that is used to organize and manage operational releases.

Set Container A package of Tasks at an instance in time. A special ISPW container that is used internally to organize and manage work requests.

Add Task Make a statement of intent, often because of some impact analysis.

Checkout Task Copy source to development area

Edit Task Make a change to the source in the development area.

Page 8: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

8

Generate Task Execute Compile and Link processes.

Promote Task Move Task forward to the next Level in the Life-Cycle.

Regress Task Move Task backwards to the previous Level in the Life-Cycle.

Delete Task Remove a Task from the development area

Fallback Task Restore previous version of Task.

Deploy Task Implement Task in one or more Run Time environments.

Substitute your values in the screenshots

In this Test Drive the screen shots provided have used specific values that may differ from your assigned values. These were provided in your email notice.

While taking the Test Drive, you must substitute your assigned values!

Variable Your Assigned Values

Application Txxx*

Assignment Prefix Txxx*

* For the value of xxx, substitute the last three digits of your Test Drive username.

Page 9: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

9

Code Changes

Your development task in this Test Drive is to create an ISPW Project, scope components which you will be working on into it, bind the project to SonarQube server and start analyzing code using SonarLint as you work on these components.

First, select “ISPW” from Compuware menu to open ISPW Perspective.

Page 10: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

10

Then, you will filter on your assigned Application for its components to work on in an ISPW Project.

Change the Stream to CWEZ

Change the Application to your assigned application value (Txxx, where xxx is your unique number)

Set the Level to “PRD” and ensure the Level option is set to “Selected level only” or “All found in level and above” both settings will return the same results since there is nothing above PRD.

Click Apply (circled)

If you are prompted to login to host, Logon on with the user credentials that were provided to you for the Test Drive and Click OK.

Page 11: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

11

The ISPW Repository View lists all the Components for your application.

Page 12: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

12

Next, Right-click on Application (TXXX) and select “Create ISPW Project” to create an ISPW Project from the application

This will bring up the “New ISPW Project” dialog. It will automatically come up the ISPW Stream and Application pre-selected. You will be working on development path DEV3 in this demo.

Page 13: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

13

Select “Working Path” to “DEV3”.

Click “Next”.

This will bring “ISPW Project Filter” screen. Here, you can define the filter for the components you want to work in this project

Page 14: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

14

You will be working on COBOL components which start with CWXT prefix.

Check “COB” from Types field and Enter “CWXT*” into the Names field then Click “Add” button.

Click “Finish”.

Page 15: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

15

This will create a new ISPW Project which has the filtered components for you to start working on. It will categorize the components by the filtered types.

Page 16: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

16

Click on “Project” view and expand the “COB” folder.

Notice the 3 COBOL components scoped.

Page 17: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

17

Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW Project to inherit the same analysis rules as the remote project.

Right-click on the ISPW Project, select “SonarLint” and then select “Bind to SonarQube or SonarCloud…” menu item.

Page 18: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

18

A SonarQube server has already been defined to this Topaz instance and pre-selected.

Click “Next”

This will present “Bind to a SonarQube Project…” dialog.

Page 19: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

19

Start typing your assigned Test Drive username in the text field.

It will bring up a pre-defined SonarQube project “CWEXxxx_Pipeline”, where xxx is last 3 digits of your assigned Test Drive username.

Double-click on the project and click “Finish”.

Next, you will create a new ISPW Assignment container to start working on the components.

Page 20: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

20

Click on “ISPW Repository Explorer” view and click on “Add New Assignment” icon to bringup “Add New Assignment” dialog.

Page 21: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

21

Select your application details as shown below (where “xxx” is last 3 digits of your assigned application). Enter a description and click OK.

Page 22: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

22

Assignment successfully created dialog will pop up. Click OK.

Page 23: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

23

Next, we go back to the ISPW Project and check-out the components into this active assignment.

Click on “Projects” view, highlight the 3 COBOL components, right-click and select “ISPW➔Checkout to Active Assignment…” option.

Page 24: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

24

A message box appears indicating the components were checked-out. Click OK.

Click F5 to Refresh “Projects” view

Page 25: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

25

Select “ISPW Assignments” view tab.

You will notice the 3 COBOL components have been checked-out into this active assignment at DEV3 level.

Page 26: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

26

Double-click on any of the components (Ex. CWXTCOB) to edit. You’ll notice that “On-the-fly” analysis was performed by SonarLint on the program as it was opened/edited as indicated by the blue markings on the right-hand side of the editor window.

Click on any of the blue markings. It will bring up the line which contains the SonarLint analysis message. If you hover over the line, a message will show indicated the problem.

Page 27: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

27

Click on “Problems” view tab. It lists all messages/logs flagged by SonarLint.

Page 28: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

28

Page 29: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

29

Double-click on any message line in the bottom. It will highlight the corresponding problem line in the editor window.

Page 30: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

30

To perform ad-hoc analysis on a component(s), Right-click on a component (Ex. CWXTCOB) in the tree navigation view, select “SonarLint” then “Analyze” option (see below):

Page 31: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

31

The SonarLint analysis report is generated in the “SonarLint Report” view tab

Page 32: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

32

Cleanup

At this point you have

• Successfully created an ISPW Project

• Added tasks into active assignment from the project

• Bound it to a project on SonarQube server

• Performed “on-the-fly” and ad-hoc SonarLint analysis on project components

Now you are ready cleanup the project.

In the editor pane, right-click on any open file in the tabbed pane, select “Close” or “Close all” option. This will close all open editor windows.

Page 33: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

33

In the “ISPW Tasks” view, highlight all 3 tasks, right-click and select “Delete” option to delete them from the container. A container cannot be closed unless the tasks are either deleted or in Production level.

Click OK to confirm the deletion.

Page 34: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

34

Click on the “ISPW Containers” view tab. Right-click on the active assignment, select “Close” to close the assignment container.

Page 35: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

35

The “Modify Assignment” dialog pops up. Click OK.

Page 36: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

36

Click on the “Projects” view tab. Right-click the ISPW Project, select “Delete” option.

Page 37: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

37

A “Delete Resource” dialog pops up. Check the “Delete project contents from disk” checkbox. This will ensure all project artifacts are deleted from the local workspace.

Click OK. This will permanently delete the ISPW Project.

Page 38: Compuware Test Drive Integrations - SonarLint Drive... · Next, you will bind this project to a project defined in SonarQube server using SonarLint plugin. This will allow the ISPW

The Mainframe Software Partner for the Next 50 Years

38

Congratulations! You completed the Test Drive on integrating ISPW Projects with SonarLint in Topaz.

As a part of this exercise, you have been able to learn how to use ISPW Projects to integrate with SonarLint for doing “on-the-fly” as well as ad-hoc code analysis from Compuware Topaz

NEXT STEPS

Click on the link below to return to the Compuware Test Drive main page and choose your next road trip!

COMPUWARE TEST DRIVE