bridge-in-tech-backend icon indicating copy to clipboard operation
bridge-in-tech-backend copied to clipboard

Add tests to follow PEP8 guidelines

Open devkapilbansal opened this issue 4 years ago • 15 comments

Is your feature request related to a problem? Please describe.

PEP stands for Python Enhancement Proposal. It is a style document that documents some best practices

Describe the solution you'd like

Code written in Python should follow standard practices and PEP8 guidelines. For this a linter that follows these guidelines or some sort of checks can be implemented

Describe alternatives you've considered

I would suggest using Flake8 to test if PEP8 best practices are followed in the code written or not. Additionally, Flake8 workflow tests can be setup to ensure pull requests made follow these guidelines as well.

Additional context

Flake8 is not the only tool available and other alternatives can be considered.

devkapilbansal avatar Mar 25 '21 12:03 devkapilbansal

I would like to work on this one @devkapilbansal

Aryamanz29 avatar Apr 01 '21 06:04 Aryamanz29

I would like to work on this one @devkapilbansal

You have been already assigned one issue. Please claim it after you send a successful PR for the former.

decon-harsh avatar Apr 01 '21 06:04 decon-harsh

@Aryamanz29 are you working on this?

devkapilbansal avatar Apr 07 '21 17:04 devkapilbansal

@Aryamanz29 are you working on this?

Yes, Sorry for the delay I'll raise PR soon.

Aryamanz29 avatar Apr 08 '21 02:04 Aryamanz29

@devkapilbansal While testing my code locally most unittest fails and I'm unable to debug it after several attempts, So kindly unassign this issue to me for now. I'll try to work on this issue later.

Screenshot (49)

Aryamanz29 avatar Apr 09 '21 17:04 Aryamanz29

Are you using @mtreacy002's forked repo as the Mentorship backend?

epicadk avatar Apr 09 '21 17:04 epicadk

@Aryamanz29 , can you check if running the test from the Test Explorer of your VS Code IDE pass? I've asked since this is also happened to me when I'm using Windows OS (running tests inside the terminal failed but running them inside VS Code IDE Test explorer passed). I have opened an issue #133 to investigate this. ATM when using Windows OS, I just run the tests on the VS Code terminal. On MacOS this issue doesn't exist (both terminal and VS Code IDE work just fine). cc @epicadk

mtreacy002 avatar Apr 10 '21 00:04 mtreacy002

@mtreacy002 Test fails same as they on the terminal, Now I'll try to set up this repo on my Linux machine to solve this problem😅

Screenshot (51)

Aryamanz29 avatar Apr 10 '21 05:04 Aryamanz29

@Aryamanz29 , also, have you completed the compulsory #244 before working on this issue? You shouldn’t face this issue once you’ve successfully completed the task there. cc @epicadk

mtreacy002 avatar Apr 10 '21 13:04 mtreacy002

@Aryamanz29 , also, have you completed the compulsory #244 before working on this issue? You shouldn’t face this issue once you’ve successfully completed the task there. cc @epicadk

I guess this was before I was your message 😅. @Aryamanz29 please complete #244 before you attempt this.

epicadk avatar Apr 10 '21 14:04 epicadk

@Aryamanz29 , also, have you completed the compulsory #244 before working on this issue? You shouldn’t face this issue once you’ve successfully completed the task there. cc @epicadk

I guess this was before I was your message 😅. @Aryamanz29 please complete #244 before you attempt this.

I have raised PR #267 for env setup, Please have a look to it @epicadk

Aryamanz29 avatar Apr 19 '21 03:04 Aryamanz29

@devkapilbansal and @epicadk , since we're running lint workflow using black, wouldn't this pr (using Flake8) contradicting the workflow. I mean the 2 (black and flake8) don't always play nice with each other 🤔 . Unless you're thinking of using flake8-black plugin, perhaps on the VSCode IDE? But I still don't see why we need to add flake8 workflow on top of black linting 🤔

mtreacy002 avatar May 22 '21 12:05 mtreacy002

Hi @mtreacy002 black is used to lint the code so to increase readability but flake8 ensures that the code follows Python standards specified by PEP8. There are some cases where black and flake8 contradicts each other but I think that can be managed using config file.

devkapilbansal avatar Jul 15 '21 20:07 devkapilbansal

Hi @mtreacy002 black is used to lint the code so to increase readability but flake8 ensures that the code follows Python standards specified by PEP8. There are some cases where black and flake8 contradicts each other but I think that can be managed using config file.

May I ask what you think of the flake8-black plugin I mentioned above? wouldn't this be a faster and easier option instead of writing the config file, @devkapilbansal ?

mtreacy002 avatar Jul 16 '21 02:07 mtreacy002

Yes, it looks good to. I was unaware of this. I think we can proceed with this instead of having flake8 and flask.

devkapilbansal avatar Jul 28 '21 11:07 devkapilbansal