Repository: ericsson/codechecker
Issue: html report generation fails

**Describe the bug**

The command `CodeChecker parse -e html -o ./reports_html report_out/` fails with the error:
`[ERROR 2020-11-11 16:56] - Unknown export format: html`

**CodeChecker version**
CodeChecker analyzer version:
```
---------------------------------------------------------------
Kind                 | Version                                 
---------------------------------------------------------------
Base package version | 6.15.0                                  
Package build date   | 2020-11-11T16:53                        
Git commit ID (hash) | 802cadbccf58fcf04aa0ebf7095b647bdc425ec0
Git tag information  | 6.15                                    
---------------------------------------------------------------

CodeChecker web version:
------------------------------------------------------------------------
Kind                          | Version                                 
------------------------------------------------------------------------
Base package version          | 6.15.0                                  
Package build date            | 2020-11-11T16:53                        
Git commit ID (hash)          | 802cadbccf58fcf04aa0ebf7095b647bdc425ec0
Git tag information           | 6.15                                    
Server supported API (Thrift) | 6.35                                    
Client API (Thrift)           | 6.35                                    
------------------------------------------------------------------------

```
**To Reproduce**

Run the command `CodeChecker parse -e html` with the appropriate folders as arguments

**Expected behaviour**

The html report would be generated.

**Desktop (please complete the following information)**
 - linux


Changed files:
analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py, analyzer/codechecker_analyzer/cmd/parse.py

diff --git a/analyzer/codechecker_analyzer/cmd/parse.py b/analyzer/codechecker_analyzer/cmd/parse.py
index 35087903..4e427f83 100644
--- a/analyzer/codechecker_analyzer/cmd/parse.py
+++ b/analyzer/codechecker_analyzer/cmd/parse.py
@@ -707,23 +707,29 @@ def main(args):
             LOG.error(f"Unknown export format: {export}")
             return
 
-        try:
-            res = parse_convert_reports(args.input,
-                                        export,
-                                        context.severity_map,
-                                        trim_path_prefixes)
-            if 'output_path' in args:
-                output_path = os.path.abspath(args.output_path)
-                reports_json = os.path.join(output_path, 'reports.json')
-                with open(reports_json,
-                          mode='w',
-                          encoding='utf-8', errors="ignore") as output_f:
-                    output_f.write(json.dumps(res))
-
-            return print(json.dumps(res))
-        except Exception as ex:
-            LOG.error(ex)
-            return
+        # The HTML part will be handled separately below.
+        if export != 'html':
+            try:
+                res = parse_convert_reports(args.input,
+                                            export,
+                                            context.severity_map,
+                                            trim_path_prefixes)
+                if 'output_path' in args:
+                    output_path = os.path.abspath(args.output_path)
+
+                    if not os.path.exists(output_path):
+                        os.mkdir(output_path)
+
+                    reports_json = os.path.join(output_path, 'reports.json')
+                    with open(reports_json,
+                              mode='w',
+                              encoding='utf-8', errors="ignore") as output_f:
+                        output_f.write(json.dumps(res))
+
+                return print(json.dumps(res))
+            except Exception as ex:
+                LOG.error(ex)
+                sys.exit(1)
 
     def trim_path_prefixes_handler(source_file):
         """
diff --git a/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py b/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py
index debb452b..4060d509 100644
--- a/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py
+++ b/analyzer/tests/functional/analyze_and_parse/test_analyze_and_parse.py
@@ -346,3 +346,21 @@ class AnalyzeParseTestCase(
         out, _ = call_command(extract_cmd, cwd=self.test_dir, env=self.env)
 
         self.assertTrue("Invalid plist file" in out)
+
+    def test_html_output_for_macros(self):
+        """ Test parse HTML output for macros. """
+        test_project_macros = os.path.join(self.test_workspaces['NORMAL'],
+                                           "test_files", "macros")
+
+        output_path = os.path.join(test_project_macros, 'html')
+        extract_cmd = ['CodeChecker', 'parse',
+                       '-e', 'html',
+                       '-o', output_path,
+                       test_project_macros]
+
+        out, err = call_command(extract_cmd, cwd=self.test_dir, env=self.env)
+        self.assertFalse(err)
+
+        self.assertTrue('Html file was generated' in out)
+        self.assertTrue('Summary' in out)
+        self.assertTrue('Statistics' in out)