CI: Check for whitespaces before class
State: closed

xref #28209, https://github.com/python-sprints/pandas-mentoring/issues/161

Validate that we use
```python
class Foo:
    """
    Doc.
    """
    pass
```
instead of:
```python
class Bar:

    """
    Doc.
    """
    pass
```
(note the blank line between `class  Bar:` and the docstring.

Labels:
name: CI
description: Continuous Integration
name: Code Style
description: Code style, linting, code_checks

Comments:
#28209 @datapythonista I have created the pull request, was a little unsure but does it look okay?
pending @datapythonista's suggestion about adding-then-reverting a failing case: LGTM
@datapythonista when I edit a class and add more spaces, should I commit it to this PR?
Exactly.

The idea is that you add a blank line after the `class Whatever:` line of any class in our code, and push it. Then we wait for the CI, and if your changes are working, it should be red and report the error. If that happens, you just delete the blank line again, and we merge.
Hello @Ayowolet! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

* In the file [`pandas/tests/test_algos.py`](https://github.com/pandas-dev/pandas/blob/cbc2c6b7df8ce41e6335c8e6fb64d2948f5000e1/pandas/tests/test_algos.py):

> [Line 37:1](https://github.com/pandas-dev/pandas/blob/cbc2c6b7df8ce41e6335c8e6fb64d2948f5000e1/pandas/tests/test_algos.py#L37): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace


Looks like your changes are not working. If you go the the CI, in the `Checks` build, and the step `Looking for unwanted patterns`, you'll see some errors.

What I'd do is next:
- Just leave one blank line and not two in what you added last, and remove any space in those blank lines
- Execute locally `./ci/code_checks.sh patterns`
- Fix the problems in your expression until it reports that file
- Then commit and push to this branch

Let me know if you need help. Thanks!
@Ayowolet can you rebase
@jbrockmendel, I'm not sure I understand what you mean by rebase...
> I'm not sure I understand what you mean by rebase...

Near the bottom of this page there is a gray warning saying "This branch has conflicts that must be resolved".  To resolve these, you'll need to run `git pull upstream master` and fix any merge conflicts that show up.
okay, thank you I will do that
@Ayowolet can you rebase and see why the check is failing on azure
If you can please help with the steps for this.. I tried the other method
you suggested but I think the internet connection was too slow and the page
just kept loading for days...

On Mon, Oct 21, 2019 at 2:30 AM jbrockmendel <notifications@github.com>
wrote:

> @Ayowolet <https://github.com/Ayowolet> can you rebase and see why the
> check is failing on azure
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/28489?email_source=notifications&email_token=AHZQ67RQ3O54KPZRUZJN6LLQPUA2FA5CNFSM4IXXSKWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBYZS5Q#issuecomment-544315766>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AHZQ67WIXGCBTEGB5X2O523QPUA2FANCNFSM4IXXSKWA>
> .
>

@Ayowolet the logs have been removed now, but here are a few failures.

```
 ./pandas/tests/test_algos.py#L37

./pandas/tests/test_algos.py(37,1): error W293: blank line contains whitespace
```

```
 ./pandas/tests/test_algos.py#L38

./pandas/tests/test_algos.py(38,5): error E303: too many blank lines (2)

```

```
 Build log #L42

Bash exited with code '2'.

```

I'm not sure what the last one means. You might try running `./ci/code_checks.sh lint` locally.
> I tried the other method you suggested

`git pull upstream master` didn't work?  That should be a fairly light-weight request, so I don't know what would cause that.

The azure page having trouble loading might make more sense, so I'll check that.  Looks like the linting is failing because of excess whitespace on tests.test_algos lines 37 and 38
I think this is OK. @Ayowolet can you fix the class docstring again so CI turns green?
@Ayowolet did the trouble with rebasing get resolved?
thanks @Ayowolet