Skip to content

Commit

Permalink
Fix S2259 FP: SE engine doesn't take into account element existence c…
Browse files Browse the repository at this point in the history
…ollection methods (#9505)
  • Loading branch information
mary-georgiou-sonarsource authored Jul 5, 2024
1 parent 09a749a commit 138deb7
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 503 deletions.
36 changes: 0 additions & 36 deletions analyzers/its/expected/Ember-MM/S2259-Ember Media Manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,11 @@
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgErrorViewer.vb#L64",
"Location": "Line 64 Position 65-72"
},
{
"Id": "S2259",
"Message": "\u0027Me.tLangList.FirstOrDefault(Function(l) l.ShortLang = Master.eSettings.TVDBLanguage)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgSettings.vb#L2499",
"Location": "Line 2499 Position 40-124"
},
{
"Id": "S2259",
"Message": "\u0027Me.SettingsPanels.FirstOrDefault(Function(p) p.Name = tvSettings.SelectedNode.Name)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgSettings.vb#L4315",
"Location": "Line 4315 Position 24-107"
},
{
"Id": "S2259",
"Message": "\u0027Me.tLangList.FirstOrDefault(Function(l) l.ShortLang = Master.eSettings.TVDBLanguage)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgSettings.vb#L836",
"Location": "Line 836 Position 36-120"
},
{
"Id": "S2259",
"Message": "\u0027MyTVShowRegExProfiles.Profiles.FirstOrDefault(Function(y) y.Name = lstProfiles.SelectedItems(0).Text)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgTVRegExProfiles.vb#L13",
"Location": "Line 13 Position 36-137"
},
{
"Id": "S2259",
"Message": "\u0027Me.tLangList.FirstOrDefault(Function(l) l.ShortLang = Master.eSettings.TVDBLanguage)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgWizard.vb#L175",
"Location": "Line 175 Position 27-111"
},
{
"Id": "S2259",
"Message": "\u0027tLangList.FirstOrDefault(Function(l) l.LongLang = Me.cbTVLanguage.Text)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgWizard.vb#L371",
"Location": "Line 371 Position 26-97"
},
{
"Id": "S2259",
"Message": "\u0027Me.tLangList.FirstOrDefault(Function(l) l.ShortLang = Master.eSettings.TVDBLanguage)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Ember%20Media%20Manager/dlgWizard.vb#L444",
"Location": "Line 444 Position 27-111"
}
]
}
6 changes: 0 additions & 6 deletions analyzers/its/expected/Ember-MM/S2259-EmberAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/EmberAPI/clsAdvancedSettings.vb#L215",
"Location": "Line 215 Position 25-120"
},
{
"Id": "S2259",
"Message": "\u0027cs\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/EmberAPI/clsAdvancedSettings.vb#L231",
"Location": "Line 231 Position 21-23"
},
{
"Id": "S2259",
"Message": "\u0027_AdvancedSettings.FirstOrDefault(Function(f) f.Name = key AndAlso f.Section = Assembly)\u0027 is Nothing on at least one execution path.",
Expand Down
126 changes: 0 additions & 126 deletions analyzers/its/expected/Ember-MM/S2259-generic.EmberCore.NMT.json
Original file line number Diff line number Diff line change
@@ -1,113 +1,5 @@
{
"Issues": [
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movieindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1498",
"Location": "Line 1498 Position 168-253"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movieindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1498",
"Location": "Line 1498 Position 71-156"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1561",
"Location": "Line 1561 Position 165-247"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1561",
"Location": "Line 1561 Position 71-153"
},
{
"Id": "S2259",
"Message": "\u0027r.values.FirstOrDefault(Function(y) y.value = v)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L166",
"Location": "Line 166 Position 97-145"
},
{
"Id": "S2259",
"Message": "\u0027conf.Params.FirstOrDefault(Function(y) y.name = dgvSettings.Rows(e.RowIndex).Cells(0).Value.ToString)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1695",
"Location": "Line 1695 Position 29-130"
},
{
"Id": "S2259",
"Message": "\u0027conf.Properties.FirstOrDefault(Function(y) y.name = dgvProperties.Rows(e.RowIndex).Tag.ToString)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L1706",
"Location": "Line 1706 Position 29-125"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movieindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L298",
"Location": "Line 298 Position 61-146"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movie\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L299",
"Location": "Line 299 Position 68-148"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movieindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L339",
"Location": "Line 339 Position 64-149"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022movie\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L341",
"Location": "Line 341 Position 85-165"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L380",
"Location": "Line 380 Position 61-143"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvshow\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L381",
"Location": "Line 381 Position 72-153"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvseason\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L382",
"Location": "Line 382 Position 74-157"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvepisode\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L383",
"Location": "Line 383 Position 70-154"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvindex\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L413",
"Location": "Line 413 Position 64-146"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvshow\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L427",
"Location": "Line 427 Position 79-160"
},
{
"Id": "S2259",
"Message": "\u0027conf.Files.FirstOrDefault(Function(y) y.Process = True AndAlso y.Type = \u0022tvseason\u0022)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L443",
"Location": "Line 443 Position 85-168"
},
{
"Id": "S2259",
"Message": "\u0027mediaPath\u0027 is Nothing on at least one execution path.",
Expand All @@ -119,24 +11,6 @@
"Message": "\u0027fiAV\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L620",
"Location": "Line 620 Position 24-28"
},
{
"Id": "S2259",
"Message": "\u0027c.values.FirstOrDefault(Function(y) y.label = saved)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L960",
"Location": "Line 960 Position 42-94"
},
{
"Id": "S2259",
"Message": "\u0027p\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L998",
"Location": "Line 998 Position 13-14"
},
{
"Id": "S2259",
"Message": "\u0027p.values.FirstOrDefault(Function(y) y.label = s)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/generic.EmberCore.NMT/dlgNMTMovies.vb#L998",
"Location": "Line 998 Position 23-71"
}
]
}
96 changes: 0 additions & 96 deletions analyzers/its/expected/Ember-MM/S2259-scraper.EmberCore.XML.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,5 @@
{
"Issues": [
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L51",
"Location": "Line 51 Position 36-164"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.PostScraperOrder = order \u002B 1)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L53",
"Location": "Line 53 Position 17-123"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L54",
"Location": "Line 54 Position 17-145"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L63",
"Location": "Line 63 Position 36-164"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L72",
"Location": "Line 72 Position 36-164"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.PostScraperOrder = order - 1)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L74",
"Location": "Line 74 Position 17-123"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLMediaSettingsHolder.vb#L75",
"Location": "Line 75 Position 17-145"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L108",
"Location": "Line 108 Position 32-160"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.ScraperOrder = order \u002B 1)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L110",
"Location": "Line 110 Position 13-115"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L111",
"Location": "Line 111 Position 13-141"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L117",
"Location": "Line 117 Position 32-160"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L123",
"Location": "Line 123 Position 32-160"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.ScraperOrder = order - 1)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L125",
"Location": "Line 125 Position 13-115"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.FirstOrDefault(Function(p) p.AssemblyName = EmberXMLScraperModule._AssemblyName)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/frmXMLSettingsHolder.vb#L126",
"Location": "Line 126 Position 13-141"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.OrderBy(Function(y) y.ScraperOrder).FirstOrDefault(Function(e) e.ProcessorModule.IsScraper AndAlso e.ProcessorModule.ScraperEnabled)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/scraperMovieXMLModule.vb#L234",
"Location": "Line 234 Position 21-201"
},
{
"Id": "S2259",
"Message": "\u0027ModulesManager.Instance.externalScrapersModules.OrderBy(Function(y) y.ScraperOrder).FirstOrDefault(Function(e) e.ProcessorModule.IsScraper AndAlso e.ProcessorModule.ScraperEnabled)\u0027 is Nothing on at least one execution path.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Ember-MM/Addons/scraper.EmberCore.XML/scraperMovieXMLModule.vb#L291",
"Location": "Line 291 Position 21-201"
},
{
"Id": "S2259",
"Message": "\u0027obj\u0027 is Nothing on at least one execution path.",
Expand Down
Loading

0 comments on commit 138deb7

Please sign in to comment.