Run Copy Paste Metrics Calculation is a sub task that is done when taking a snapshot of an application.
During the Copy Paste Metrics Calculation sub task, the code is analyzed for two distinct measurements:
- the ratio between the number of duplicated, copy/pasted artifacts and the total number of artifacts.
- the commented code and the associated code/comment ratio in the code
It is divided into sub-steps :
- First, the process generates in the LISA folder a file called NaturalMetricsInput.txt, based on the dataset.castvector files formerly generated by the Metric Assistant during the "Run metrics calculation" step. Those files are the raw results of the Metric Assistant. There is one such file per execution unit.
- Then, the NaturalMetricsRunner generates formats the data in NaturalMetricsInput.txt into a file called NaturalMetrics.datatransfer. This file is in XML format so that it can be passed to the XmlToDB tool in the next step
- XmlToDB saves the results into the Knowledge Base, based on file NaturalMetrics.datatransfer
Below is the screen shot which shows the location of the task while running the snapshot.
Official documentation link: CAST AIP 8.0.x Documentation > CAST AIP 8.0.x Documentation > Cookbooks > Platform Administration > Objects - Links - Metrics - Quality Rules > Metrics and Quality Rules Documentation > Metrics and Quality Rules - details > QRL - Metrics and Quality Rules listed in alphabetical order >Avoid Too Many Copy Pasted Artifacts and Avoid triggers, functions and procedures with a very low comment/code ratio
The Loglines generated by this task is shown below
CAST-MS<ID>.log.txt
The CAST MS log file contains information about all the task and sub task occurring during the Take Snapshot. Regarding the Run Copy Paste metrics calculation , the only information we have is when the sub task started, when it finished and if it has failed.
Run Copy Paste metrics calculation
INF: 2016-08-26 13:41:11: starting Task Run Copy Paste metrics calculation for SilverLight_App
Analyse Copy Paste Code
INF: 2016-08-26 13:41:11: starting Task Analyze Copy Paste code
INF: 2016-08-26 13:41:11: C:\Program Files\CAST\8.0/NaturalMetricsRunner.exe -batch C:\CASTMS\LargeStorage\LTSA/NaturalMetricsInput.txt -out C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\NaturalMetrics.datatransfer
INF: 2016-08-26 13:41:11: Loading (1/1): C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\Scr14962\dataset.castvector 42vectors
INF: 2016-08-26 13:41:11: Loaded 42 vectors
INF: 2016-08-26 13:41:11: Detecting copy/paste
INF: 2016-08-26 13:41:11: Detecting commented code
INF: 2016-08-26 13:41:11: Info : The metric "Number of Commented Code lines" has been disabled for all C# objects due to insufficient source code or comments for the learning process.
INF: 2016-08-26 13:41:11: Success
INF: 2016-08-26 13:41:11: Task message: No Task message
INF: 2016-08-26 13:41:11: No associated log file
INF: 2016-08-26 13:41:11: ending Task Analyze Copy Paste code
Save results to data base
INF: 2016-08-26 13:41:11: starting Task Save results to database
INF: 2016-08-26 13:41:11: C:\Program Files\CAST\8.0/XMLTODB.exe /f:C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\NaturalMetrics.datatransfer /c:C:\Program Files\CAST\8.0\InstallScripts\Common\APPW\table_appw.xml /scp:naturalmetrics /src:xml /st:sql /cs:LIBPQ:LOCALHOST:2280,postgres /u:operator /p:****** /db:cast_80_sup_local /no_bcp
INF: 2016-08-26 13:41:12: Transferring XML -> DB without using bulk copy: this may take a while...
INF: 2016-08-26 13:41:12: XMLtoDB: Opening a connection to <connection_string> 'LIBPQ:LOCALHOST:2280,postgres' with login 'operator'...successful connection.
INF: 2016-08-26 13:41:12: [13:41:12] Table # 1 'OBJECTS_SIMILARITIES': starting transfer...
INF: 2016-08-26 13:41:12: [13:41:12] table # 1 'OBJECTS_SIMILARITIES': now transferred ( 1 rows transferred in 00h 00m 00s 000ms ).
INF: 2016-08-26 13:41:12: [13:41:12] Whole transfer duration is 00h 00m 00s 000ms (for 1 rows).
INF: 2016-08-26 13:41:12: XMLtoDB: Successful transfer (XML -> DB).
INF: 2016-08-26 13:41:12: Task message: No Task message
INF: 2016-08-26 13:41:12: No associated log file
INF: 2016-08-26 13:41:12: ending Task Save results to database
INF: 2016-08-26 13:41:12: Task message: No Task message
INF: 2016-08-26 13:41:12: No associated log file
INF: 2016-08-26 13:41:12: ending Task Run Copy Paste metrics calculation for SilverLight_App
Analyse Copy Paste Code
INF: 2016-08-26 13:41:11: starting Task Analyze Copy Paste code
INF: 2016-08-26 13:41:11: C:\Program Files\CAST\8.0/NaturalMetricsRunner.exe -batch C:\CASTMS\LargeStorage\LTSA/NaturalMetricsInput.txt -out C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\NaturalMetrics.datatransfer
INF: 2016-08-26 13:41:11: Loading (1/1): C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\Scr14962\dataset.castvector 42vectors
INF: 2016-08-26 13:41:11: Loaded 42 vectors
INF: 2016-08-26 13:41:11: Detecting copy/paste
INF: 2016-08-26 13:41:11: Detecting commented code
INF: 2016-08-26 13:41:11: Info : The metric "Number of Commented Code lines" has been disabled for all C# objects due to insufficient source code or comments for the learning process.
INF: 2016-08-26 13:41:11: Success
INF: 2016-08-26 13:41:11: Task message: No Task message
INF: 2016-08-26 13:41:11: No associated log file
INF: 2016-08-26 13:41:11: ending Task Analyze Copy Paste code
Save results to data base
INF: 2016-08-26 13:41:11: starting Task Save results to database
INF: 2016-08-26 13:41:11: C:\Program Files\CAST\8.0/XMLTODB.exe /f:C:\CASTMS\LargeStorage\LISA\c51f4ae599884aecbcaebd919a89f71f\NaturalMetrics.datatransfer /c:C:\Program Files\CAST\8.0\InstallScripts\Common\APPW\table_appw.xml /scp:naturalmetrics /src:xml /st:sql /cs:LIBPQ:LOCALHOST:2280,postgres /u:operator /p:****** /db:cast_80_sup_local /no_bcp
INF: 2016-08-26 13:41:12: Transferring XML -> DB without using bulk copy: this may take a while...
INF: 2016-08-26 13:41:12: XMLtoDB: Opening a connection to <connection_string> 'LIBPQ:LOCALHOST:2280,postgres' with login 'operator'...successful connection.
INF: 2016-08-26 13:41:12: [13:41:12] Table # 1 'OBJECTS_SIMILARITIES': starting transfer...
INF: 2016-08-26 13:41:12: [13:41:12] table # 1 'OBJECTS_SIMILARITIES': now transferred ( 1 rows transferred in 00h 00m 00s 000ms ).
INF: 2016-08-26 13:41:12: [13:41:12] Whole transfer duration is 00h 00m 00s 000ms (for 1 rows).
INF: 2016-08-26 13:41:12: XMLtoDB: Successful transfer (XML -> DB).
INF: 2016-08-26 13:41:12: Task message: No Task message
INF: 2016-08-26 13:41:12: No associated log file
INF: 2016-08-26 13:41:12: ending Task Save results to database