backdrop-ops / backdropcms.org

Issue tracker for the BackdropCMS.org website
https://backdropcms.org
25 stars 21 forks source link

Odd code (assign instead compare) in function borg_project_metrics_get_metrics() #1044

Open indigoxela opened 4 months ago

indigoxela commented 4 months ago

This is really odd. It may be by intention, but I really doubt it.

https://github.com/backdrop-ops/backdropcms.org/blob/main/www/modules/custom/borg_project_metrics/borg_project_metrics.module#L194-L196

Could it be that this was supposed to be elseif ($type == 'comments') { instead?

Don't wait for me, I won't provide a PR for it. :wink: Just have a look - who's more familiar with the code.

bugfolder commented 4 months ago

Sure looks like it ought to be ==. @jenlampton, would you agree?

indigoxela commented 4 months ago

It might as well be, that this was supposed to be:

else {
  $type = 'comments';
  ...

Something needs to be assigned to $type because further down in the function it's assumed it exists, and also that $url is set, of course.

I belief, the code works as intended - it's just written in a confusing way.

jenlampton commented 4 months ago

Yes, I think that was supposed to be == .