Code duplication is not being analyzed for Objective-C
Closed this issue · 2 comments
Hi,
I am trying to setup sonar-objective-c, and I am unable to get the code duplication work. Env details:
OS - 10.10.5
Xcode - 6.4
SonarQube - 5.1.2
Sonar-runner - 2.4
sonar-objective-c - 0.4.0
Oclint version: 0.8.1
I ran the following:
- run-sonar.sh
- sonar-runner
I was testing the following code duplication (both methods in the same class):
-(void)copy{
int a = 20;
int b = 30;
int total = a + b;
NSLog(@"Total is %i",total);
}
-(void)copyDuplicate{
int a = 20;
int b = 30;
int total = a + b;
NSLog(@"Total is %i",total);
}
But getting 0 Duplication (no duplication) in Sonar Report. I checked the rules in Sonar for objective-C plugin but it didn't exist for 0.4 (could it be the reason?)
Any clue why its not detecting the duplication?
Hello,
thanks for your report.
There are some minimum values for a duplicate to be identified as such in SonarQube, I think your code simply doesn't reach it.
See http://docs.sonarqube.org/display/HOME/Duplications for more explanations and parametrization.
You are absolutely right Cyril! Got it working now :)
Many thanks for the help