Skip to content

Commit 4c32a72

Browse files
authored
Merge pull request #10 from RedTanny/gconfig
read lang filter from sheets
2 parents c458947 + 7eb8a73 commit 4c32a72

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/analysis.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,29 @@ def _dataframe_to_test_entries(self, df: pd.DataFrame, language: str) -> List[Di
399399
)
400400

401401
return tests
402-
402+
def get_google_test_configuration(self) -> Dict:
403+
"""
404+
Get Google test configuration.
405+
406+
Returns:
407+
Dictionary containing Google test configuration
408+
"""
409+
dict_config = {}
410+
sheet_name = "AutoTesting_Config"
411+
headers, data_rows = self._read_sheet_data(
412+
self.gsheets_config.input_sheet_id,
413+
sheet_name)
414+
415+
if not headers or not data_rows:
416+
logger.info(f"No configuration found in sheet '{sheet_name}', skipping")
417+
return dict_config
418+
419+
for key,value in data_rows:
420+
dict_config[key] = value
421+
logger.info(f"Google test configuration: {dict_config}")
422+
423+
return dict_config
424+
403425
def generate_scan_json_from_sheets(self) -> None:
404426
"""
405427
Generate scan.json file from Google Sheets data.

src/vulnerability_main_automation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ def main():
194194
try:
195195
data_loader = GoogleSheetsDataLoader(config)
196196
data_loader.generate_scan_json_from_sheets()
197+
config_override = data_loader.get_google_test_configuration()
198+
if "language" in config_override:
199+
logger.info("Override Language filter: %s with value %s from Google Sheets", config.language, config_override["language"])
200+
config.language = config_override["language"]
197201
logger.info("Successfully generated scan.json from Google Sheets")
198202
except Exception as e:
199203
logger.error(f"Failed to generate scan.json from Google Sheets: {e}", exc_info=True)

0 commit comments

Comments
 (0)