pulp / plugin_template

GNU General Public License v2.0
8 stars 35 forks source link

As a developer, I have an easy way to check my commit and code locally before pushing #650

Open pulpbot opened 2 years ago

pulpbot commented 2 years ago

Author: daviddavis (daviddavis)

Redmine Issue: 6938, https://pulp.plan.io/issues/6938


I was talking to ggainey about some of the automation checks we have in pulp (commit validation, style/lint checks, changelog, etc) and how it might be frustrating for new devs. I've heard the same feedback from other contributors such as galaxy.

We need to provide an easy way for developers to run our CI checks locally. I've seen other projects (bandersnatch[0], black[1], celery[2], etc) use pre-commit:

https://pre-commit.com/

[0] https://github.com/pypa/bandersnatch/blob/master/.pre-commit-config.yaml

[1] https://github.com/psf/black/blob/master/.pre-commit-config.yaml

[2] https://github.com/celery/celery/blob/master/.pre-commit-config.yaml

pulpbot commented 2 years ago

From: @ggainey (ggainey) Date: 2020-06-09T14:54:23Z


None of the individual bookeeping tasks are bad - they're all great individually - but en masse, they cause a lot of friction for the dev, which is a good way to get people to not-contribute to your project

Consider:

  1. "black/flake"
  2. "check for issue/noissue"
  3. "check for coverage/nocoverage"
  4. "check issue is in project"
  5. "check for CHANGES existence"
  6. "check that CHANGES file has an allowed suffix"

are all checks that happen serially in travis, and which therefore will fail individually. So if you're particularly dense (like I have been on frequent occasions), that can mean SIX separate pushes/builds, just to get to the point where travis will tell you if your code even builds/works.

pulpbot commented 2 years ago

From: @fao89 (fao89) Date: 2020-06-09T16:06:35Z


We can start a new directory on plugin_template or use .travis one. It needs to be customizable by plugins, as only pulp_rpm needs [nocoverage]. Maybe calling a script "additional_checks.sh": https://stackoverflow.com/a/59499550 It would be helpful to have a makefile for facilitating setting and using the pre-commit

install:
    pip install --upgrade pip
    pip install -r requirements_dev.txt
    make setup-pre-commit

setup-pre-commit:
    pre-commit install
    pre-commit install-hooks

run-pre-commit:
    rm -rf .tox/
    pre-commit run --files $$(find -regex '.*\.\(py\|yaml\|yml\|md\)') -v

example from: https://github.com/rochacbruno/dynaconf/blob/master/Makefile#L135-L146

pulpbot commented 2 years ago

From: @fao89 (fao89) Date: 2020-06-11T21:01:22Z


https://medium.com/@jmarhee/using-pre-commit-and-post-update-git-hooks-10ca8171daf5

pulpbot commented 2 years ago

From: daviddavis (daviddavis) Date: 2020-06-11T21:58:23Z


Thanks for the article. I posted a small PoC:

https://github.com/daviddavis/pulpcore/commit/eba832370

pulpbot commented 2 years ago

From: @fao89 (fao89) Date: 2020-08-03T13:21:16Z


I never got the notification, I like your PoC, I think we should be working on it after 3.6

pulpbot commented 2 years ago

From: daviddavis (daviddavis) Date: 2020-09-25T14:49:17Z


One of the problems that was raised today during open floor is that users could have different flake8 plugins installed with different versions. We need to figure out how to handle this issue.

pulpbot commented 2 years ago

From: pulpbot (pulpbot) Date: 2020-10-17T12:29:09Z


PR: https://github.com/pulp/plugin_template/pull/278

stale[bot] commented 2 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

stale[bot] commented 2 years ago

This issue is no longer marked for closure.

stale[bot] commented 2 years ago

This issue is no longer marked for closure.