Skip to content

Add documentation for linting with a pre-commit hook - #249

Draft
SibiAkkash wants to merge 1 commit into
india-ultimate:mainfrom
SibiAkkash:pre-commit-hook
Draft

Add documentation for linting with a pre-commit hook#249
SibiAkkash wants to merge 1 commit into
india-ultimate:mainfrom
SibiAkkash:pre-commit-hook

Conversation

@SibiAkkash

Copy link
Copy Markdown
Contributor

No description provided.

@SibiAkkash SibiAkkash self-assigned this Dec 27, 2023
@SibiAkkash
SibiAkkash marked this pull request as draft December 27, 2023 16:33
@SibiAkkash

SibiAkkash commented Dec 27, 2023

Copy link
Copy Markdown
Contributor Author

This is actually not right, there are 2 problems here

  1. Running scripts/lint would lint all the files, and not the ones staged for this particular commit (I'd have to modify the lint script to take in a subset of files)
  2. The lint script modifies the files. These files would have to be staged again before committing, ideally the hook itself takes care of restaging the modified files (if the lint script didn't fail).

If atleast 2. isn't addressed, there's no point in using the hook. I'll fix these and open pr for review again 😅

This is a good way for me to learn cmd line text processing (that's my justification for sinking time into this 👍)

@punchagan

Copy link
Copy Markdown
Member

Running scripts/lint would lint all the files, and not the ones staged for this particular commit (I'd have to modify the lint script to take in a subset of files)

The idea is to keep the linting fast enough that it's okay to run the lint on all the files, and not just modified ones. But, sure, you could run it on only the changed files.

@SibiAkkash

Copy link
Copy Markdown
Contributor Author

Running scripts/lint would lint all the files, and not the ones staged for this particular commit (I'd have to modify the lint script to take in a subset of files)

The idea is to keep the linting fast enough that it's okay to run the lint on all the files, and not just modified ones. But, sure, you could run it on only the changed files.

yeah the linting is fast, which is really nice. Point 1 might not be a problem, point 2 is the main one.

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.

3 participants