Skip to content

Commit

Permalink
Adding contributing doc and pre-commit (#73)
Browse files Browse the repository at this point in the history
* Adding contributing doc and pre-commit

* chore: add pre-commit to dev dependencies

* Switching black pre-commit repo

* Moving isort configs to pyproject.toml

* Running CI jobs in parallel

* Renaming workflow file

* Moving isort configs to pyproject.toml

* docs(changelog): add contributing guide and pre-commit

* fix(linters): tox.ini

* Adding command to install Poetry

---------

Co-authored-by: Andrej Švec <[email protected]>
  • Loading branch information
pgoslatara and sweco authored Mar 13, 2024
1 parent b3ef7b5 commit 87c05b0
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ name: Tests
on: pull_request

jobs:
linters:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install --no-root
- name: Run pre-commit
run: pre-commit run --all-files

integration-tests:
runs-on: ubuntu-latest
steps:
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/linters.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-json
- id: check-ast
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
args: [--unsafe]
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- repo: https://github.com/pycqa/isort
rev: 5.13.2 # Use the same version as in pyproject.toml
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0 # Use the same version as in pyproject.toml
hooks:
- id: black
name: Run black formatter
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for `dbt==1.7`. [#72] _Thanks to @pgoslatara!_
- Coverage type to string/markdown reports. [#74] _Thanks to @pgoslatara!_
- Contributing guide and pre-commit. [#73] _Thanks to @pgoslatara!_

## [0.3.5] - 2023-11-09
### Added
Expand Down Expand Up @@ -39,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.3.0] - 2022-11-17
### Added
- Support for custom run artifacts path. [#33] _Thanks to @Fszta!_
- Support for model selection by path. [#45] _Thanks to @followingell!_
- Support for model selection by path. [#45] _Thanks to @followingell!_
- Support for `compute doc` to print results in a markdown table format. [#47] _Thanks to @vvvito!_

## [0.2.3] - 2022-10-14
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ option.

Compute coverage from `target/catalog.json` and `target/manifest.json` files
found in a dbt project, e.g.
[jaffle_shop](https://github.com/dbt-labs/jaffle_shop).
[jaffle_shop](https://github.com/dbt-labs/jaffle_shop).

To choose between documentation and test coverage, pass `doc` or `test` as the CLI argument.

Expand Down Expand Up @@ -194,10 +194,10 @@ Misses 23 24 +1/+0

# New misses
=========================================================================
Catalog 15/38 (39.47%) -> 15/39 (38.46%)
Catalog 15/38 (39.47%) -> 15/39 (38.46%)
=========================================================================
- jaffle_shop.customers 6/7 (85.71%) -> 6/8 (75.00%)
-- new_col -/- (-) -> 0/1 (0.00%)
- jaffle_shop.customers 6/7 (85.71%) -> 6/8 (75.00%)
-- new_col -/- (-) -> 0/1 (0.00%)
=========================================================================
```

Expand Down Expand Up @@ -235,6 +235,23 @@ the support matrix.
- [interrogate](https://interrogate.readthedocs.io/en/latest/) (docs coverage for Python)
- [coverage.py](https://github.com/nedbat/coveragepy) (execution coverage for Python)

## Contributing

Clone this repo including submodules, create a virtual environment and install dependencies:
```bash
git clone --recurse-submodules [email protected]:slidoapp/dbt-coverage.git
cd dbt-coverage
pip install poetry
poetry shell
poetry install
pre-commit install
```

To run all integration tests locally, run:
```bash
tox
```

## License

Licensed under the MIT license (see [LICENSE.md](LICENSE.md) file for more
Expand Down
3 changes: 1 addition & 2 deletions dbt_coverage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
from dataclasses import dataclass, field, replace
from enum import Enum
from pathlib import Path
from typing import Dict, Set, List, Optional
from typing import Dict, List, Optional, Set

import typer


SUPPORTED_MANIFEST_SCHEMA_VERSIONS = [
"https://schemas.getdbt.com/dbt/manifest/v4.json",
"https://schemas.getdbt.com/dbt/manifest/v5.json",
Expand Down
Loading

0 comments on commit 87c05b0

Please sign in to comment.