codeql-action icon indicating copy to clipboard operation
codeql-action copied to clipboard

Improve metrics output

Open Marcono1234 opened this issue 3 years ago • 2 comments

Version

CodeQL CLI: 2.8.5 CodeQL action: 1.1.8 (according to CODEQL_ACTION_VERSION environment variable)

Description

Currently (at least for Java projects) the metrics table printed at the end of github/codeql-action/analyze contains the same metric name multiple times, e.g.:

|                          Metric                          | Value |
+----------------------------------------------------------+-------+
| Total lines of code in the database                      |  9668 |
| External libraries                                       |  1458 |
| External libraries                                       |    28 |
| External libraries                                       |     9 |
| External libraries                                       |     7 |
| External libraries                                       |     6 |
| External libraries                                       |     1 |
| Supported sinks in external libraries                    |     7 |
| Supported sinks in external libraries                    |     6 |
| Supported sinks in external libraries                    |     4 |
| Supported sinks in external libraries                    |     2 |
| Supported sinks in external libraries                    |     1 |
| Supported sinks in external libraries                    |     1 |
| Supported sinks in external libraries                    |     1 |
| Supported sinks in external libraries                    |     1 |
| Supported flow steps in external libraries               |    82 |
| Supported flow steps in external libraries               |    42 |
| Supported flow steps in external libraries               |    36 |
| Supported flow steps in external libraries               |    30 |
| Supported flow steps in external libraries               |    25 |
...

(workflow run)

The issue might be that these queries have multiple result columns, but the table here only seems to contain the usages count, discarding the other columns. Maybe the underlying issue is therefore caused by CodeQL CLI or by the Java queries.

Additionally it might be good to add an empty line in front of "Analysis produced the following metric data:" (to separate it more clearly from the previous table). And also the "Counted a baseline of ..." sentence seems to be printed twice (workflow run).

Marcono1234 avatar Apr 18 '22 13:04 Marcono1234

We are aware of this and are working on a fix. Thanks for reporting.

aeisenberg avatar Apr 19 '22 21:04 aeisenberg

It looks like with CodeQL CLI 2.9.2 there are no telemetry query results displayed and no duplication for the metrics anymore (as indicated by the changelog). Thanks a lot!

But the message "Counted a baseline of" is still displayed twice, and unfortunately there is no empty line in front of "Analysis produced the following metric data" to separate it from the previous table.

Marcono1234 avatar May 16 '22 19:05 Marcono1234