File tree Expand file tree Collapse file tree
src/pysonar_scanner/configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,5 +111,9 @@ def __convert_arrays_to_string(property) -> str:
111111
112112 @staticmethod
113113 def __kebab_to_camel_case (key : str ) -> str :
114- parts = key .split ("-" )
115- return parts [0 ] + "" .join (word .capitalize () for word in parts [1 :])
114+ if "-" in key :
115+ parts = key .split ("-" )
116+ result = parts [0 ] + "" .join (word .capitalize () for word in parts [1 :])
117+ logging .debug (f"Converting kebab-case property '{ key } ' to camelCase: '{ result } '" )
118+ return result
119+ return key
Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ def test_load_toml_file_kebab_case(self):
6565 self .assertEqual (properties .sonar_properties .get ("sonar.projectKey" ), "my-project" )
6666 self .assertEqual (properties .sonar_properties .get ("sonar.projectName" ), "My Project" )
6767
68- def test_load_toml_file_kebab_case_unknown_properties (self ):
68+ @patch ("pysonar_scanner.configuration.pyproject_toml.logging" )
69+ def test_load_toml_file_kebab_case_unknown_properties (self , mock_logging ):
6970 self .fs .create_file (
7071 "pyproject.toml" ,
7172 contents = """
@@ -81,6 +82,16 @@ def test_load_toml_file_kebab_case_unknown_properties(self):
8182 self .assertEqual (properties .sonar_properties .get ("sonar.someUnknownProperty" ), "some-value" )
8283 self .assertEqual (properties .sonar_properties .get ("sonar.nestedProperty.someNestedKey" ), "nested-value" )
8384
85+ mock_logging .debug .assert_any_call (
86+ "Converting kebab-case property 'sonar.coverage-report-paths' to camelCase: 'sonar.coverageReportPaths'"
87+ )
88+ mock_logging .debug .assert_any_call (
89+ "Converting kebab-case property 'sonar.some-unknown-property' to camelCase: 'sonar.someUnknownProperty'"
90+ )
91+ mock_logging .debug .assert_any_call (
92+ "Converting kebab-case property 'sonar.nested-property.some-nested-key' to camelCase: 'sonar.nestedProperty.someNestedKey'"
93+ )
94+
8495 def test_load_toml_file_without_sonar_section (self ):
8596 self .fs .create_file (
8697 "pyproject.toml" ,
You can’t perform that action at this time.
0 commit comments