Skip to content

[INF] simplify a bit linting, use pre-commit as CI linting checker #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/noop.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This file is copied into the container along with environment.yml* from the
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.
69 changes: 4 additions & 65 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,9 @@ name: Code style checks
on: [push, pull_request]

jobs:
black:
name: Check black compliance.
linting:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install black
run: python -m pip install black==21.7b0

- name: Run black
run: black --config pyproject.toml --check .

interrogate:
name: Check interrogate compliance.
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install interrogate
run: python -m pip install interrogate

- name: Run interrogate
run: interrogate .

darglint:
name: Check darglint compliance.
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install darglint
run: python -m pip install darglint

- name: Run darglint
run: darglint janitor -v 2

flake8:
name: Check flake8 compliance.
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install flake8
run: python -m pip install flake8

- name: Run flake8
run: flake8 . --exclude ./nbconvert_config.py
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ repos:
rev: 21.7b0
hooks:
- id: black
args: [-l 79]
- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout
files: ".ipynb"
Comment on lines -16 to -20
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nbstripout should be removed.
It changed a lot, even would make ipynb outputs become empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks @Zeroto521.

We can remove it for now. In a future setting, though, I think we'd want to do the notebooks such that they are built in the CI system and deployed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see conf.py already adds nbsphinx, but no a .rst file index these notebooks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Regarding the notebooks (and docs more generally), I have been debating, btw, to switch the docs over to mkdocs + mkdocs-material. It is much easier to maintain in the long-run than Sphinx; I know I have been hesitant to make any changes to the docs as it stands right now because of a lot of magic that happens behind the scenes that I'm just not well-versed in, whereas MkDocs and mkdocs-material are much easier to maintain combined. (It feels... flatter.)

args: [--config, pyproject.toml]
- repo: https://github.com/econchick/interrogate
rev: 1.4.0
hooks:
Expand All @@ -28,3 +23,8 @@ repos:
hooks:
- id: darglint
args: [-v 2] # this config makes the error messages a bit less cryptic.
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: [--exclude, nbconvert_config.py]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-checks.yml has flake8, but pre-commit doesn't.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
- [INF] Simplify a bit linting, use pre-commit as the CI linting checker. @Zeroto521


## [v0.21.1] - 2021-08-29

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/janitor.functions/janitor.add_columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.add\_columns

.. currentmodule:: janitor

.. autofunction:: add_columns
.. autofunction:: add_columns
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.convert\_excel\_date

.. currentmodule:: janitor

.. autofunction:: convert_excel_date
.. autofunction:: convert_excel_date
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.currency\_column\_to\_numeric

.. currentmodule:: janitor

.. autofunction:: currency_column_to_numeric
.. autofunction:: currency_column_to_numeric
2 changes: 1 addition & 1 deletion docs/reference/janitor.functions/janitor.filter_on.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.filter\_on

.. currentmodule:: janitor

.. autofunction:: filter_on
.. autofunction:: filter_on
2 changes: 1 addition & 1 deletion docs/reference/janitor.functions/janitor.find_replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.find\_replace

.. currentmodule:: janitor

.. autofunction:: find_replace
.. autofunction:: find_replace
2 changes: 1 addition & 1 deletion docs/reference/janitor.functions/janitor.get_dupes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.get\_dupes

.. currentmodule:: janitor

.. autofunction:: get_dupes
.. autofunction:: get_dupes
2 changes: 1 addition & 1 deletion examples/notebooks/dirty_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
2 changes: 1 addition & 1 deletion examples/notebooks/expand_grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
2 changes: 1 addition & 1 deletion examples/notebooks/groupby_agg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
2 changes: 1 addition & 1 deletion examples/notebooks/pyjanitor_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -932,4 +932,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}