diff --git a/.github/workflows/format-and-lint.yml b/.github/workflows/format-and-lint.yml deleted file mode 100644 index c961ba4..0000000 --- a/.github/workflows/format-and-lint.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Code format and linting - -on: [pull_request] - -jobs: - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - cache: 'pip' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Checking code format with autopep8 - run: autopep8 --diff --exit-code $(git ls-files '*.py') - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - cache: 'pip' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Analysing the code with flake8 - run: flake8 $(git ls-files '*.py') diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..61b31c7 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,26 @@ +name: Pre-commit CI + +on: [push, pull_request] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install -r requirements.txt + + # This will configure the pre-commit hooks in + # '.pre-commit-config.yaml' file. + - name: Configure pre-commit + run: pre-commit install + + - name: Run pre-commit hooks + run: pre-commit run --all-files diff --git a/create_db.py b/create_db.py index 59235e1..d2044a3 100644 --- a/create_db.py +++ b/create_db.py @@ -126,9 +126,9 @@ def __init__(self, message): crawler.close() if not relations_count_new > relations_count: error_message = ( - f"Unexpected relation count change in the crawler '{name}': " - f"Expected new relations ({relations_count_new}) " - f"to be greater than the previous relations ({relations_count})." + f'Unexpected relation count change in the crawler "{name}": ' + f'Expected new relations ({relations_count_new}) ' + f'to be greater than the previous relations ({relations_count}).' ) raise RelationCountError(error_message) status[module_name] = 'OK'