Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

pre-commit hook for black and flake8#76

Closed
dtemir wants to merge 2 commits intofacebookresearch:mainfrom
dtemir:pre-commit-hooks
Closed

pre-commit hook for black and flake8#76
dtemir wants to merge 2 commits intofacebookresearch:mainfrom
dtemir:pre-commit-hooks

Conversation

@dtemir
Copy link
Contributor

@dtemir dtemir commented Apr 18, 2022

Description

I think it would be a good idea to standardize the code contributed to LabGraph by having contributors use pre-commit hook that will automatically run black and flake8 when the user makes a commit.

That way as users keep committing changes, the new code will automatically follow good standards.

Fixes #74

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • New and existing unit tests pass locally with these changes?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 18, 2022
@dtemir dtemir changed the title pre-ommit hook for black and flake8 pre-commit hook for black and flake8 Apr 18, 2022
@dtemir
Copy link
Contributor Author

dtemir commented Apr 18, 2022

@jfResearchEng please let me know if that'd be a useful change, but feel free to close the PR if you think it's unnecessary.

@dtemir
Copy link
Contributor Author

dtemir commented Apr 18, 2022

One more idea:
If this would be useful, I think it would be a good idea to run this

Install pre-commit:

pip install pre-commit

Install the git hooks script:

pre-commit install

It uses a file called .pre-commit-config.yaml to create a Git hook .git/hooks/pre-commit

Apply the hook to all files:
https://pre-commit.com/#4-optional-run-against-all-the-files

pre-commit run --all-files

To level everything up first

**Install the git hooks script**:

```bash
pre-commit install
Copy link
Contributor

Choose a reason for hiding this comment

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

When testing with mac, the following error appears: "pre-commit not found"
The error can be fixed using: pre-commit/pre-commit#1537

Copy link
Contributor

@jfResearchEng jfResearchEng left a comment

Choose a reason for hiding this comment

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

Shall a common error session be added for an improvement for mac users.

@dtemir dtemir closed this by deleting the head repository Jul 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using Black for Code Formatter?

3 participants