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

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

merged 9 commits into from
Sep 4, 2021

Conversation

Zeroto521
Copy link
Member

@Zeroto521 Zeroto521 commented Aug 25, 2021

PR Description

Please describe the changes proposed in the pull request:

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.
We should use one of them as the standard, not both. Otherwise, we would get confused.

PR Checklist

Please ensure that you have done the following:

  1. PR in from a fork off your branch. Do not PR from <your_username>:dev, but rather from <your_username>:<feature-branch_name>.
  1. If you're not on the contributors list, add yourself to AUTHORS.rst.
  1. Add a line to CHANGELOG.md under the latest version header (i.e. the one that is "on deck") describing the contribution.
    • Do use some discretion here; if there are multiple PRs that are related, keep them in a single line.

Automatic checks

There will be automatic checks run on the PR. These include:

  • Building a preview of the docs on Netlify
  • Automatically linting the code
  • Making sure the code is documented
  • Making sure that all tests are passed
  • Making sure that code coverage doesn't go down.

Relevant Reviewers

Please tag maintainers to review.

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.
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.

@codecov
Copy link

codecov bot commented Aug 25, 2021

Codecov Report

Merging #892 (a9a7c8c) into dev (36d6a6b) will decrease coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##              dev     #892      +/-   ##
==========================================
- Coverage   95.66%   95.62%   -0.05%     
==========================================
  Files          19       19              
  Lines        2448     2448              
==========================================
- Hits         2342     2341       -1     
- Misses        106      107       +1     

@Zeroto521
Copy link
Member Author

Because the linting standard is different, so https://github.com/pyjanitor-devs/pyjanitor/pull/892/checks is red.

Now we should determine to use which linting is the standard.
code-checks.yml or pre-commit?

@ericmjl
Copy link
Member

ericmjl commented Aug 25, 2021

@Zeroto521 thanks for handling this! In the interest of minimizing the diff, I think we should defer to the codechecks.yml file for the settings, but use pre-commit as our actual code checker. Would you be open to making that happen please?

`-c` = `--code TEXT`, Format the code passed in as a string.
keep the same with the old code-checks.yml
@Zeroto521 Zeroto521 changed the title [INF] simplify a bit linting, use pre-commit as the standard [INF] simplify a bit linting Aug 26, 2021
@Zeroto521 Zeroto521 changed the title [INF] simplify a bit linting [INF] simplify a bit linting, use pre-commit as the CI linting checker Aug 26, 2021
@Zeroto521 Zeroto521 changed the title [INF] simplify a bit linting, use pre-commit as the CI linting checker [INF] simplify a bit linting, use pre-commit as CI linting checker Aug 26, 2021
Copy link
Member Author

@Zeroto521 Zeroto521 left a comment

Choose a reason for hiding this comment

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

Now use the old code-checks.yml as the base standard and pre-commit as the lining checker.

But these hooks weren't removed. They changed a little. Just remove some whitespace when lint.

hooks:
  - id: trailing-whitespace
  - id: end-of-file-fixer
  - id: check-yaml
  - id: check-added-large-files

Comment on lines -16 to -20
- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout
files: ".ipynb"
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.)

@ericmjl
Copy link
Member

ericmjl commented Aug 26, 2021

Let's get one more review in before merging. Tagging @loganthomas and @hectormz, whom I think might take an interest in the PR.

@ericmjl
Copy link
Member

ericmjl commented Sep 4, 2021

@Zeroto521 I'm going to merge as I'd like to have these changes present in #897. Thanks for your contributions here, much appreciated!

@ericmjl ericmjl merged commit f4b4f8e into pyjanitor-devs:dev Sep 4, 2021
ericmjl added a commit that referenced this pull request Sep 5, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to ml module

* [DOC] mkdocs updates to ml module

* [DOC] mkdocs updates to ml module

* [DOC] mkdocs updates to ml module; black formatting

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 5, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to read_csv() in io

* [DOC] mkdocs updates to incldue io in docs

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 5, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to log() in math

* [DOC] mkdocs updates to ecdf() in math

* [DOC] mkdocs updates to exp() in math

* [DOC] mkdocs updates to logit() in math

* [DOC] mkdocs updates to normal_cdf() in math

* [DOC] mkdocs updates to probit() in math

* [DOC] mkdocs updates to single line docstrings in math

* [DOC] mkdocs updates to z_score() in math

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 5, 2021
* mkdocstrings on chemistry functions

* Minor update to biology.py

* Proper config for syntax highlighting

* Switch to nord theme for syntax highlighting

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

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* FLake8 fix.

Co-authored-by: Zero <[email protected]>
ericmjl added a commit that referenced this pull request Sep 5, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [CLN] remove README.rst in favor of mkdocs/index.md

* [CLN] remove CONTRIBUTING.rst in favor of mkdocs/devguide.md

* [DOC] add symlink to mkdocs/devguide.md for CONTRIBUTING.md

* [FIX] remove file CONTRIBUTING.md

* [DOC] add symlink to mkdocs/devguide.md for CONTRIBUTING.md

* [INF] update setup.py to replace README.rst with mkdocs/index.md

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 5, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to convert_units() in engineering

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
@Zeroto521 Zeroto521 deleted the simplify-code-checks.yml branch September 6, 2021 01:50
ericmjl added a commit that referenced this pull request Sep 6, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to refactored_function() in utils

* [DOC] mkdocs updates to rename_kwargs() in utils

* [DOC] mkdocs updates to check_column() in utils

* [DOC] mkdocs updates to skipna() in utils

* [DOC] mkdocs updates to skiperror() in utils

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
nvamsikrishna05 pushed a commit that referenced this pull request Sep 7, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* [DOC] mkdocs updates to check() in utils

* [DOC] mkdocs updates to _strip_underscores() in utils

* [DOC] mkdocs updates to import_message() in utils

* [DOC] mkdocs updates to idempotent() in utils

* [DOC] mkdocs updates to deprecated_alias() in utils

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 12, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* DOC: update _sub_expand_grid(pd.DataFrame) in utils

* DOC: update _sub_expand_grid(pd.Index) in utils

* DOC: update _data_checks_complete() in utils

* DOC: update  _computations_complete() in utils

* DOC: update _create_indexer_for_complete() in utils

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
ericmjl added a commit that referenced this pull request Sep 12, 2021
* [INF] simplify a bit linting, use pre-commit as CI linting checker (#892)

* [INF] simplify a bit linting

There is two similar linting CIs (pre-commit and code-checks) but also have tiny differences.

We should use one of them as the standard, not both.

* Update CHANGELOG.md

* should be `--config` not `-c`

`-c` = `--code TEXT`, Format the code passed in as a string.

* remove nbstripout

keep the same with the old code-checks.yml

* lint via pre-commit

* Update CHANGELOG.md

Co-authored-by: Eric Ma <[email protected]>

* DOC: update _computations_expand_grid() in utils

* DOC: update _expand_grid() in utils

* DOC: update _sub_expand_grid() in utils

* DOC: update _sub_expand_grid(np.ndarray) in utils

* DOC: update _sub_expand_grid(pd.Series) in utils

* [DOC] fix NumPy

Co-authored-by: Zero <[email protected]>
Co-authored-by: Eric Ma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants