Преглед на файлове

added documentation for report tool

stefan преди 1 година
родител
ревизия
d0863f016c
променени са 3 файла, в които са добавени 35 реда и са изтрити 2 реда
  1. 29 1
      docs/docs/04-u-workflow.md
  2. 3 1
      metrixpp/ext/std/tools/report.py
  3. 3 0
      setup.py

+ 29 - 1
docs/docs/04-u-workflow.md

@@ -503,4 +503,32 @@ Files with csv format can be opened by applications, like Microsoft Office Excel
 
 ![Distribution graph](./../src/img/piechart.png)
 
-It is not recommended to use the export tool to implement custom post-analysis Metrix++ extensions. The main reason is that granted backward compatibility support for csv columns is not granted. Another main reason is that exporting is relatively slow process. It is recommended to use Metrix++ extensions API instead.
+It is not recommended to use the export tool to implement custom post-analysis Metrix++ extensions. The main reason is that granted backward compatibility support for csv columns is not granted. Another main reason is that exporting is relatively slow process. It is recommended to use Metrix++ extensions API instead.
+
+### Exporting reports
+The Metrix++ 'report' tool can be used to report the current data of all files
+and metrics which have been collected so far.
+
+```
+> python "/path/to/metrix++.py" report --db-file=boost_1_54_0/metrixpp.db --format=doxygen --output-dir=/path/to/generated/output
+```
+
+This can be used to integrate metrics in automatically generated reports.
+Currently the 'report' tool can generate data to be integrated in doxygen
+documentation. The tool creates a 'metrixpp.dox' file in the output directory.
+
+
+The doxygen format requires pytablewriter to be installed.
+```
+> pip install pytablewriter
+```
+
+Besides the doxygen format the report can be used to create simple text 'txt' or
+json 'json' reports to be integrated in logs or other tools.
+
+
+If no output directory is given the result is printed to stdout.
+
+The 'report' tool accepts the same options as the [limit](#apply-thresholds)
+tool. The violated thresholds are added to the report as warnings.
+

+ 3 - 1
metrixpp/ext/std/tools/report.py

@@ -9,7 +9,6 @@ import logging
 import io
 import os
 import json
-import pytablewriter
 
 from metrixpp.mpp import api
 from metrixpp.mpp import utils
@@ -122,6 +121,9 @@ class Plugin(api.Plugin, api.IConfigurable, api.IRunable):
         return report_text
 
     def create_doxygen_report(self, paths, overview_data, data):
+
+        import pytablewriter
+
         result_text = ""
         result_text += "/* this file is autogenerated by metrix++ - changes will be overwritten */\n"
         result_text += "/*!\n"

+ 3 - 0
setup.py

@@ -13,6 +13,9 @@ setuptools.setup(
     long_description_content_type="text/markdown",
     url="https://github.com/metrixplusplus/metrixplusplus",
     packages=setuptools.find_packages(exclude=["metrixpp.tests"]),
+    install_requires=[
+        'pytablewriter'
+    ],
     package_data={
         'metrixpp.mpp': ['*.ini'],
         'metrixpp.ext.std': ['*.ini'],