Rarity

Rarity

17M Downloads

Unnecessary namespace pollution / improper use of round()

Arcitec opened this issue ยท 2 comments

commented

Two issues:

  1. Polluting the global namespace with the word round, overwriting any function with that name. Please don't do that. It's bad manners. Stick to Rarity's own namespace (addon table), or use a very unique global name. ;-)

https://github.com/SacredDuckwhale/Rarity/blob/master/Core.lua#L1188-L1190

  1. The round code is wrong. Blizzard provides a proper function already, Round() with capital R, which you can see here: https://www.townlong-yak.com/framexml/live/Util.lua#880
function Round(value)
	if value < 0.0 then
		return math.ceil(value - .5);
	end
	return math.floor(value + .5);
end
commented

Thanks for the report. I'm not the original author and there's a LOT wrong with the addon's core code, and I'm certain there are a multitude of issues a proper refactoring pass with a static analysis tool could easily fix.

Unfortunately I'm the only person working on keeping the addon barely functional, and I'm very busy. As a result, the code leaves a lot to be desired and I don't see how I can change that on my own in the foreseeable future. Sorry!

Pull requests cleaning up a little are, of course, very welcome, and fixing this particular problem should be fairly trivial.

commented

I believe this particular problem is now resolved (as of f13c918). Needless to say, a lot more could be done, but well... one step at a time.