fosslight / fosslight_dependency_scanner

FOSSLight Dependency Scanner
https://fosslight.org
Apache License 2.0
32 stars 20 forks source link

Add Pre-Commit Hooks for Code Linting and Formatting #220

Open JaeHyuckSa opened 2 months ago

JaeHyuckSa commented 2 months ago

Description

This PR adds pre-commit hooks to automatically run code linting and formatting tools before any commit.

Scenario

1. Install Dependencies from requirements-dev.txt

pip install -r requirements-dev.txt

2. Install the Pre-Commit Hooks

pre-commit install

3. Test the Pre-Commit Hooks

echo "print('Hello, world!')" > test_file.py
git add test_file.py
git commit -m "Test pre-commit hooks"

If the hooks are set up correctly, pre-commit will run the specified checks and formatting on test_file.py before the commit is finalized.

4. Apply Hooks to Existing Codebase

To ensure the entire codebase complies with the pre-commit hooks, run

pre-commit run --all-files

Type of change

soimkim commented 2 months ago

@saJaeHyukc , 사용 시나리오 Description에 추가 부탁드립니다.

JaeHyuckSa commented 2 months ago

@saJaeHyukc , 사용 시나리오 Description에 추가 부탁드립니다.

@soimkim 해당 부분 추가했습니다 이 부분 적용할 경우 contribute 문서도 수정하도록 하겠습니다.