From a377e05676fb89908170527426b467af683279eb Mon Sep 17 00:00:00 2001
From: penenadpi <penenadpi@gmail.com>
Date: Thu, 25 Aug 2022 06:50:12 -0400
Subject: [PATCH] Extending js support

---
 src/iac_scan_runner/compatibility.py   |  8 +++++++-
 src/iac_scan_runner/results_summary.py | 14 +++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/iac_scan_runner/compatibility.py b/src/iac_scan_runner/compatibility.py
index 8b52aec..e035232 100644
--- a/src/iac_scan_runner/compatibility.py
+++ b/src/iac_scan_runner/compatibility.py
@@ -44,6 +44,7 @@ class Compatibility:
         scanned_yaml = []
         scanned_java = []
         scanned_html = []
+        scanned_js = []
 
         # TODO: List of supported file types should be extended
         # TODO: Remove hardcoded check names
@@ -75,13 +76,18 @@ class Compatibility:
                         types.append("html")
                         scanned_html.append(filename)
 
+                    if f.find(".js") > -1:
+                        types.append("js")
+                        scanned_js.append(filename)
+                        
             self.scanned_files["terraform"] = str(scanned_terraform)
             self.scanned_files["python"] = str(scanned_py)
             self.scanned_files["shell"] = str(scanned_shell)
             self.scanned_files["yaml"] = str(scanned_yaml)
             self.scanned_files["java"] = str(scanned_java)
             self.scanned_files["html"] = str(scanned_html)
-            
+            self.scanned_files["js"] = str(scanned_js)
+                        
             types = set(types)
             print(types)
                         
diff --git a/src/iac_scan_runner/results_summary.py b/src/iac_scan_runner/results_summary.py
index 56378cb..998d687 100644
--- a/src/iac_scan_runner/results_summary.py
+++ b/src/iac_scan_runner/results_summary.py
@@ -87,13 +87,21 @@ class ResultsSummary:
                 return "Problems"                
 
         if check == "es-lint":
-            if outcome == "":
-                self.outcomes[check]["status"] = "Passed"
+            if outcome.find("wrong")>-1:
+                self.outcomes[check]["status"] = "Problems"
                 return "Passed"
             else:
-                self.outcomes[check]["status"] = "Problems"
+                self.outcomes[check]["status"] = "Passed"
                 return "Problems"      
 
+        if check == "ts-lint":
+            if outcome.find("wrong")>-1:
+                self.outcomes[check]["status"] = "Prolems"
+                return "Passed"
+            else:
+                self.outcomes[check]["status"] = "Passed"
+                return "Problems"  
+
     def summarize_no_files(self, check: str):
         """
         Sets the outcome of the selected check to "no files" case
-- 
GitLab