BotBlake / pyTAB

Python Transcoding Acceleration Benchmark Client made for Jellyfin Hardware Survey
GNU General Public License v3.0
9 stars 8 forks source link

Feature add pre-commit tool to workflow #3

Closed stseifer closed 7 months ago

stseifer commented 7 months ago

Summary

This adds a config file for pre-commit. This tool is a framework to install git-hooks which serve the purpose of running code/programs on certain git events like pre-commit and pre-merge-commit and more.

How to use

wezterm-gui_OKTJd8JsgO

Details

I added common hooks from the pre-commit sample-config and ruff-pre-commit hooks to run ruff formater and ruff lint --fix. Some of the problems are easy enough to be autofixable. but if one of the hooks return a non 0 value then the commit won't happen.

trailing-whitespace

This rule removes the white space in the last character of a row.

end-of-file-fixer

This rule checks if the files end on a new line.

check-yaml

Check if yaml files are syntax correct.

check-added-large-files

Prevents giant files to be commited. By default this has 500kB, I set the config at 4096kB via args: [--maxkb=]

ruff

Runs ruff --format and ruff --fix.

stseifer commented 7 months ago

Stare @BotBlake Stare

BotBlake commented 7 months ago

@stseifer Okay I actually took my Time to read for once.

Since I typically commit over the VSCode GitHub Integration, this Feature would mostly make sense when it also works with the VSCode commit.

VSCode does offer a pre-commit Extension, that is capable to use a preexisting .pre-commit-config.yaml

I Just wanted to Double Check with you wether or not this makes Sense AND that this File is actually universal, so that in can be interpreted Correctly by VSCode.

stseifer commented 7 months ago

If you don't want checks to whitespace characters to be done just disable these two hooks and leave the file like this

    ...
    hooks:
      - id: check-yaml
      - id: check-added-large-files
        args: [--maxkb=4096]
    ...
stseifer commented 7 months ago

Updated the feature branch with only changes adding the pre-commit config file