Subject: Patch for SonarQube code scan fixes.

From: Nikhil Mohite <[email-masked]>
Date: Tue, 8 Sep 2020 14:58:58 +0530

Hi Team,

I have fixed some code smell issues in the SonarQube scan, PFA patch.
Details as follows:

1. psycopg2/connection:

   - Refactor this function to reduce its Cognitive Complexity from 32 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 17 to
   the 15 allowed.

2. psycopg2/server_manager:

   - Refactor this function to reduce its Cognitive Complexity from 20 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 33 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 26 to
   the 15 allowed.

3. sqlautocomplete/parseutils:

   - Refactor this function to reduce its Cognitive Complexity from 23 to
   the 15 allowed.

-- 
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/>
*Mob.No: +91-7798364578.*

---

From: Aditya Toshniwal <[email-masked]>
Date: Tue, 8 Sep 2020 15:30:52 +0530

Hi,

sqlautocomplete code is mostly inherited from the pgcli project. Changing
it might create trouble in updating the code with new versions.

-- 
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com>
"Don't Complain about Heat, Plant a TREE"

---

From: Dave Page <[email-masked]>
Date: Tue, 8 Sep 2020 11:23:08 +0100

> it might create trouble in updating the code with new versions.

Send a patch upstream :-)

>
> On Tue, Sep 8, 2020 at 2:59 PM Nikhil Mohite <
> [email-masked]> wrote:
>
>> Hi Team,
>>
>>    - Refactor this function to reduce its Cognitive Complexity from 32
>>    to the 15 allowed.
>>    - Refactor this function to reduce its Cognitive Complexity from 17
>>    to the 15 allowed.
>>
>>    - Refactor this function to reduce its Cognitive Complexity from 20
>>    to the 15 allowed.
>>    - Refactor this function to reduce its Cognitive Complexity from 33
>>    to the 15 allowed.
>>    - Refactor this function to reduce its Cognitive Complexity from 26
>>    to the 15 allowed.
>>
>>    - Refactor this function to reduce its Cognitive Complexity from 23
>>    to the 15 allowed.
>>
>>
>>
>> --
>> *Thanks & Regards,*
>> *Nikhil Mohite*
>> *Software Engineer.*

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: http://www.enterprisedb.com

---

From: Aditya Toshniwal <[email-masked]>
Date: Tue, 8 Sep 2020 16:10:18 +0530

Hi Dave,

> Send a patch upstream :-)
I remember Akshay had fixed all the PEP8 issues in pgcli and sent the
patch. But it was rejected by the pgcli author. :/

---

From: Dave Page <[email-masked]>
Date: Tue, 8 Sep 2020 12:56:19 +0100

On Tue, Sep 8, 2020 at 11:40 AM Aditya Toshniwal <
[email-masked]> wrote:

>>> sqlautocomplete code is mostly inherited from the pgcli project.
>>> Changing it might create trouble in updating the code with new versions.
>>>
>>

Doesn't mean this one will be though - we can at least try.

---

From: Akshay Joshi <[email-masked]>
Date: Wed, 9 Sep 2020 11:28:05 +0530

Thanks, patch applied. I haven't committed changes for
"sqlautocomplete/parseutils", as Dave suggested send the patch to pgcli.

-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*