Personally I think the code has a very weird "smell"... Assuming you don't
have any way of rewriting the calling code and are stuck with editing this
single method, I'd suggest something along the lines of:
@staticmethod
def in_circle_check(obj_type, item, uuid):
if obj_type not in ['trees', '
The first step is to ensure you have a precise and accurate understanding
of the code before optimization. Right now, I am suspicious of at least 2
things in the code.
First, the function returns any of {None, -1, True}. While this is
certainly allowed, is this correct? If not, please correct the
On 21/07/2022 3:52 pm, Sencer Hamarat wrote:
Hi everyone,
I have a code block with high cognitive complexity below:
@staticmethod
def in_circle_check(obj_type, item, uuid, item_is_array=False):
Partly because the args seem weird.
Try writing a docstring which says what the method nee
The only things that comes into my mind is taking away that first if which
is redundant with the third block.
An other way might be to include all the if in a big switch...
My 2 cents
Agnese
On Thu, 21 Jul 2022 at 07:53, Sencer Hamarat
wrote:
> Hi everyone,
>
> I have a code block with high cogn
Hi everyone,
I have a code block with high cognitive complexity below:
@staticmethod
def in_circle_check(obj_type, item, uuid, item_is_array=False):
if obj_type not in ['trees', 'flowers']:
return None
plant = get_plant_with_circles(uuid)
if not plant
5 matches
Mail list logo