3838
3939def scan ():
4040 app_logging .setup ()
41-
41+ app_logging . get_logger (). info ( "Starting Pysonar, the Sonar scanner CLI for Python" )
4242 config = ConfigurationLoader .load ()
4343 set_logging_options (config )
44+ app_logging .get_logger ().debug (f"Loaded configuration: { config } " )
4445
4546 api = build_api (config )
4647 check_version (api )
4748 update_config_with_api_urls (config , api .base_urls )
49+ app_logging .get_logger ().debug (f"Configuration after update from API URL: { config } " )
4850
4951 cache_manager = cache .get_cache (config )
5052 scanner = create_scanner_engine (api , cache_manager , config )
5153
54+ app_logging .get_logger ().info ("Starting the analysis..." )
5255 return scanner .run (config )
5356
5457
@@ -62,10 +65,13 @@ def build_api(config: dict[str, any]) -> SonarQubeApi:
6265 return SonarQubeApi (base_urls , token )
6366
6467
65- def check_version (api ):
68+ def check_version (api : SonarQubeApi ):
69+ app_logging .get_logger ().info ("Checking SonarQube version..." )
6670 if api .is_sonar_qube_cloud ():
71+ app_logging .get_logger ().info ("Analysis will be run on SonarQube Cloud" )
6772 return
6873 version = api .get_analysis_version ()
74+ app_logging .get_logger ().info ("Analysis will be run on SonarQube version %s" , version )
6975 if not version .does_support_bootstrapping ():
7076 raise SQTooOldException (
7177 f"Only SonarQube versions >= { MIN_SUPPORTED_SQ_VERSION } are supported, but got { version } "
@@ -81,8 +87,10 @@ def update_config_with_api_urls(config, base_urls: BaseUrls):
8187
8288
8389def create_scanner_engine (api , cache_manager , config ):
90+ app_logging .get_logger ().info ("Creating the scanner engine..." )
8491 jre_path = create_jre (api , cache_manager , config )
8592 config [SONAR_SCANNER_JAVA_EXE_PATH ] = str (jre_path .path )
93+ app_logging .get_logger ().debug (f"JRE path: { jre_path .path } " )
8694 scanner_engine_path = ScannerEngineProvisioner (api , cache_manager ).provision ()
8795 scanner = ScannerEngine (jre_path , scanner_engine_path )
8896 return scanner
0 commit comments