- SonarQube Server: Data Center Edition v10.6 (92116)
- how is SonarQube deployed: Not sure
I ran into an interesting bug in which a method with 8 parameters does not raise the Functions should not have too many parameters (typescript:S107) issue, when running a PR scan. A full scan will definitely raise the issue.
It took me a while to reproduce this, since it requires a very particular scenario:
target branch:
const foo = async (val1: string, val2: string, val3: string,
val4: string, val5: string, val6: string,
): Promise<void> =>
console.log('params: ', val1, val2, val3, val4, val5, val6, val7, val8);
pr branch:
const foo = async (val1: string, val2: string, val3: string,
val4: string, val5: string, val6: string,
val7: string, val8: string,
): Promise<void> =>
console.log('params: ', val1, val2, val3, val4, val5, val6, val7, val8);
So basically we’re adding params 7 and 8 (and in doing so violating typescript:S107), but the issue is not raised in the PR scan.
Adding the new params in an already existing line causes the issue to be raised as expected:
const foo = async (val1: string, val2: string, val3: string, val4: string, val5: string, val6: string, val7: string, val8: string): Promise<void> =>
console.log('params: ', val1, val2, val3, val4, val5, val6, val7, val8);