objc:S1854 false positive, used variable labelled as unused since recent update

Make sure to read this post before raising a thread here:

Then tell us:

  • What language is this for? - Objective C
  • Which rule? S1854 Value stored during it’s initialization is never read.
  • Why do you believe it’s a false-positive/false-negative? Because we are using/reading it in the next 2 lines.
  • Are you using
    • SonarQube Server / Community Build - which version? 9.9.2
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
-(NSArray*)fooData
{
    NSArray* fud = [self fieldProperties];
*Value stored to 'fud' during its initialization is never read*
    NSMutableArray* foo = [[NSMutableArray alloc]init];
    [fp addObject: @"foo"];
    [fp addObject:fud];
    return foo;
}

Hi @colmcd! Long time no see.

Objective C is not my strongest language. Could you please send us a reproducer file to investigate this whenever we have some time?

To generate the reproducer file:

  • Search in the analysis log for the full path of the source file for which you want to create a reproducer (for instance, a file that contains a false-positive). You will have to use exactly this name (same case, / or \…)
  • Add the reproducer option to the scanner configuration:
    sonar.cfamily.reproducer=“Full path to the .source file”
  • Re-run the scanner to generate a file named sonar-cfamily-reproducer.zip in the project folder.
  • Please share this file. If you think this file contains private information, let us know, and we’ll send you a private message that will allow you to send it privately.

Thank you for your report, we could look into the case once we have the reproducer.