diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index b66cdf80fbd2fed370d6c05797e1b50935911bf8..37180e9283c9bcc3a11ce8a883e6c84329bdb479 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -5,6 +5,12 @@ name: CI Tests +on: + push: + branches: [main] + pull_request: + branches: [main] + jobs: build: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index efa407c35ff028586b7ef5456c537971fefa5cea..d57bf65f017e09a5ec2d0f27f81ead1922a84545 100644 --- a/.gitignore +++ b/.gitignore @@ -159,4 +159,5 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +#.idea/ +*.orig diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eec77720c09a262dda2776140901a24a821b223d..631f59e12671d7146510434746826a83c28c4f98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,10 @@ repos: - - repo: "https://github.com/psf/black" - rev: "22.3.0" + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 hooks: - - id: black - stages: [commit] - - - repo: "https://github.com/pre-commit/mirrors-prettier" - rev: "v2.7.1" - hooks: - - id: prettier - stages: [commit] - exclude: tests\/test_.+\. + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-yaml - repo: https://github.com/codespell-project/codespell rev: v2.3.0 @@ -20,8 +14,19 @@ repos: additional_dependencies: - tomli - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.215" + - repo: "https://github.com/pre-commit/mirrors-prettier" + rev: v3.1.0 hooks: - - id: ruff + - id: prettier stages: [commit] + exclude: tests\/test_.+\. + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.4.4 + hooks: + # Run the linter. + - id: ruff + args: [--fix] + # Run the formatter. + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index e1d3488c69f3a47411aa8c5f3c6f380c1481e299..0cd4c0a48390cdb3440753957e3eca0bea694260 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,7 @@ ignore_missing_imports = true [tool.ruff] ignore-init-module-imports = true fix = true -select = ["E", "F", "W", "I", "D", "RUF"] +select = ["D", "E", "F", "W", "I", "UP", "G"] ignore = [ "D100", # Missing docstring in public module "D101", # Missing docstring in public class @@ -119,15 +119,12 @@ ignore = [ "D104", # Missing docstring in public package "D105", # Missing docstring in magic method "D107", # Missing docstring in `__init__` - "E501", # line too long | Black take care of it - + "E501", # line too long ] +line-length = 100 [tool.ruff.flake8-quotes] docstring-quotes = "double" [tool.ruff.pydocstyle] convention = "google" - -[tool.black] -line-length = 100 diff --git a/tests/common.py b/tests/common.py index 26ff07b5d9d8cdc1dec0c8ab5fd86139046542d6..40b9dcbd0bdbba8b16314040f3b4c76aea1bced2 100644 --- a/tests/common.py +++ b/tests/common.py @@ -190,4 +190,6 @@ def sqlite_db_uri(db_uri="sqlite:///test.db"): def pg_db_uri( db_uri="postgresql://eralchemy:eralchemy@localhost:5432/eralchemy", ): + engine = create_engine(db_uri) + Base.metadata.create_all(engine) return db_uri diff --git a/tests/test_intermediary_to_dot.py b/tests/test_intermediary_to_dot.py index b4fda1e649d0bff35249566f381d872e3b0b192d..19e411a08af19bc4212d81881056dc6cd1c6a09d 100644 --- a/tests/test_intermediary_to_dot.py +++ b/tests/test_intermediary_to_dot.py @@ -33,6 +33,7 @@ column_inside = re.compile( def assert_is_dot_format(dot): """Checks that the dot is usable by graphviz.""" + # We launch a process calling graphviz to render the dot. If the exit code is not 0 we assume that the syntax # wasn't good def run_graph(dot):