[PR #12] [MERGED] Implement pre-commit hooks #534

Closed
opened 2026-02-27 23:01:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/12
Author: @st-den
Created: 5/12/2020
Status: Merged
Merged: 5/15/2020
Merged by: @sigma67

Base: masterHead: dev


📝 Commits (2)

  • d8ea95b Implement pre-commit hooks
  • b142cf3 Format the code with YAPF

📊 Changes

8 files changed (+228 additions, -97 deletions)

View changed files

.flake8 (+10 -0)
.pre-commit-config.yaml (+9 -0)
.style.yapf (+5 -0)
📝 tests/test.py (+18 -9)
📝 ytmusicapi/helpers.py (+7 -9)
📝 ytmusicapi/parsers.py (+42 -19)
📝 ytmusicapi/setup.py (+4 -2)
📝 ytmusicapi/ytmusic.py (+133 -58)

📄 Description

Now the following checks have to be passed before committing:

YAPF hook check:
Formats the staged files. If staged version differs from the correctly formatted version, the file is formatted correctly and the changes become unstaged, so the developer could review them.

Flake8 hook check:
Lints the staged files. If staged file had linting errors, pre-commit yields those errors and the changes become unstaged, so the developer could fix them.

If both checks were passed, commit is made.
Checks can be made explicitly with pre-commit run.

I set up YAPF and Flake8, so that the code looked good enough, mostly. Also, I adjusted the settings a little, so that the code in its current state passed the checks. Though almost all of Flake8 ignore settings are considered sane defaults, nevertheless. Line length 99 is recommended by PEP as one of options.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/sigma67/ytmusicapi/pull/12 **Author:** [@st-den](https://github.com/st-den) **Created:** 5/12/2020 **Status:** ✅ Merged **Merged:** 5/15/2020 **Merged by:** [@sigma67](https://github.com/sigma67) **Base:** `master` ← **Head:** `dev` --- ### 📝 Commits (2) - [`d8ea95b`](https://github.com/sigma67/ytmusicapi/commit/d8ea95b05d90b8dde12f5ff91baaabd4aaffc300) Implement pre-commit hooks - [`b142cf3`](https://github.com/sigma67/ytmusicapi/commit/b142cf3340c0fef9b0bcd4a86c0a0001bd5b0589) Format the code with YAPF ### 📊 Changes **8 files changed** (+228 additions, -97 deletions) <details> <summary>View changed files</summary> ➕ `.flake8` (+10 -0) ➕ `.pre-commit-config.yaml` (+9 -0) ➕ `.style.yapf` (+5 -0) 📝 `tests/test.py` (+18 -9) 📝 `ytmusicapi/helpers.py` (+7 -9) 📝 `ytmusicapi/parsers.py` (+42 -19) 📝 `ytmusicapi/setup.py` (+4 -2) 📝 `ytmusicapi/ytmusic.py` (+133 -58) </details> ### 📄 Description Now the following checks have to be passed before committing: **YAPF hook check:** Formats the staged files. If staged version differs from the correctly formatted version, the file is formatted correctly and the changes become unstaged, so the developer could review them. **Flake8 hook check:** Lints the staged files. If staged file had linting errors, pre-commit yields those errors and the changes become unstaged, so the developer could fix them. If both checks were passed, commit is made. Checks can be made explicitly with ``pre-commit run``. I set up YAPF and Flake8, so that the code looked good enough, mostly. Also, I adjusted the settings a little, so that the code in its current state passed the checks. Though almost all of Flake8 ignore settings are considered sane defaults, nevertheless. Line length 99 is recommended by PEP as one of options. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 23:01:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#534
No description provided.