Skip to content

Commit

Permalink
tox fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lucabello committed Aug 19, 2024
1 parent 733cdf6 commit 021150e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ ignore-words-list = "assertIn"
[tool.ruff]
line-length = 99
exclude = ["__pycache__", "*.egg_info"]

[tool.ruff.lint]
select = ["E", "W", "F", "C", "N", "R", "D", "I001"]
# Ignore E501 because using black creates errors with this
# Ignore D107 Missing docstring in __init__
ignore = ["C901", "E501", "D107", "RET504"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
# D100, D101, D102, D103: Ignore missing docstrings in tests
"tests/*" = ["D100","D101","D102","D103"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

# Static analysis tools configuration
Expand Down
3 changes: 2 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
from charms.prometheus_k8s.v0.prometheus_scrape import MetricsEndpointConsumer
from charms.tempo_k8s.v1.charm_tracing import trace_charm
from cosl import GrafanaDashboard
from grafana_agent import CONFIG_PATH, GrafanaAgentCharm
from ops.main import main
from ops.pebble import Layer

from grafana_agent import CONFIG_PATH, GrafanaAgentCharm

logger = logging.getLogger(__name__)

SCRAPE_RELATION_NAME = "metrics-endpoint"
Expand Down
3 changes: 2 additions & 1 deletion tests/scenario/test_dashboard_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# See LICENSE file for licensing details.
import json

from charm import GrafanaAgentK8sCharm
from cosl import GrafanaDashboard
from scenario import Container, Context, Relation, State

from charm import GrafanaAgentK8sCharm


def encode_as_dashboard(dct: dict):
return GrafanaDashboard._serialize(json.dumps(dct).encode("utf-8"))
Expand Down
3 changes: 2 additions & 1 deletion tests/scenario/test_setup_statuses.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

import charm
from ops import BlockedStatus, UnknownStatus, pebble
from scenario import Container, Context, ExecOutput, State

import charm


def test_install(vroot):
context = Context(
Expand Down
3 changes: 2 additions & 1 deletion tests/scenario/test_start_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import dataclasses
from pathlib import Path

from charm import GrafanaAgentK8sCharm
from ops import pebble
from scenario import Container, Context, ExecOutput, State

from charm import GrafanaAgentK8sCharm

CHARM_ROOT = Path(__file__).parent.parent.parent


Expand Down
5 changes: 3 additions & 2 deletions tests/scenario/test_tracing_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import pytest
import scenario
import yaml
from charm import GrafanaAgentK8sCharm
from charms.tempo_k8s.v1.charm_tracing import charm_tracing_disabled
from charms.tempo_k8s.v2.tracing import Receiver, TracingProviderAppData, TracingRequirerAppData
from grafana_agent import CONFIG_PATH
from ops import pebble

from charm import GrafanaAgentK8sCharm
from grafana_agent import CONFIG_PATH


@pytest.fixture
def ctx(vroot):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_relation_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import unittest
from unittest.mock import patch

from charm import GrafanaAgentK8sCharm as GrafanaAgentCharm
from ops.model import ActiveStatus, BlockedStatus
from ops.testing import Harness

from charm import GrafanaAgentK8sCharm as GrafanaAgentCharm


class TestRelationStatus(unittest.TestCase):
def setUp(self, *unused):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_update_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import unittest
from unittest.mock import patch

from charm import GrafanaAgentK8sCharm as GrafanaAgentCharm
from ops.testing import Harness

from charm import GrafanaAgentK8sCharm as GrafanaAgentCharm


class TestUpdateStatus(unittest.TestCase):
def setUp(self, *unused):
Expand Down

0 comments on commit 021150e

Please sign in to comment.