.. _Exporting the Tasks from Comments:

Exporting the Tasks from Comments
=================================

.. rst-class:: lead

Using the Verissimo **SVTB.25.9 Banned comments content** rule and a custom report template you can export the tasks from comments into a file.

The **SVTB.25.9** rule can be parameterized to report all the comments containing different task tags.

.. code-block:: xml
   :caption: A ruleset file containing just the SVTB.25.9 rule would look like this:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <ruleset version="2">
        <category name="Export Tasks">
            <rule id="SVTB.25.9" >            	
                 <property key="commentPatterns" value="FIXME .*,TODO .*,HINT .*,XXX .*"/>
            </rule>
        </category>
    </ruleset>
 
 
Running Verissimo with such a ruleset will result in the reported failures indicating the line, the file and the message of the tasks in the project:

.. code-block:: 

    *** LINT ERROR SVTB.25.9: Comment content <fixme_comment> matches the banned pattern 'FIXME .*'! at line: <line> in file: <file>
    *** LINT ERROR SVTB.25.9: Comment content <todo_comment> matches the banned pattern 'TODO .*'! at line: <line> in file: <file>


.. code-block:: 
    :caption: Using a custom report template you can export the results into CSV format:

    Description,File,Line
    <#list linter.getHits() as hit>
    <#assign messageLength = hit.getDetails()?length>
    <#assign startOfMessageLength = 17>
    <#assign maxNofCharactersOfPatterns = 8>
    <#if hit.getCheck().getId() == "SVTB.25.9">
    "${hit.getDetails()[startOfMessageLength..hit.getDetails()?last_index_of("'",messageLength - (maxNofCharactersOfPatterns + 4)) - 1]}",${hit.getFile()},${hit.getLine()}
    </#if>
    </#list>
 
To run verissimo.sh with such a custom report template simply add to -gen_custom_report /path/to/custom_report.csv.ftl to the command. The resulting CSV file will look like this:

.. figure:: ../../images/common/verissimo-export-tasks-table.png


 
