Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more linting #9

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ types-colorama = "^0.4.15.20240106"
pytest-asyncio = "^0.23.4"
ipdb = "^0.13.13"

[tool.ruff.lint]
select = ["E", "F", "B", "I"]

[tool.mypy]
strict = true
Expand Down
9 changes: 5 additions & 4 deletions rexi/rexi.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import dataclasses
import re
from typing import cast, Match, Iterable, Optional
from typing import Iterable, Match, Optional, cast

from colorama import Fore
from textual import on
from textual.app import App, ComposeResult, ReturnType
from textual.containers import ScrollableContainer, Horizontal
from textual.widgets import Input, Static, Header, Select
from textual.containers import Horizontal, ScrollableContainer
from textual.widgets import Header, Input, Select, Static

UNDERLINE = "\033[4m"
RESET_UNDERLINE = "\033[24m"
Expand Down Expand Up @@ -44,7 +44,8 @@ def __init__(
initial_mode = initial_mode or RexiApp.AVAILABLE_MODES[0]
if initial_mode not in RexiApp.AVAILABLE_MODES:
raise ValueError(
f"This regex mode isn't supported!, please choose from the following list: {RexiApp.AVAILABLE_MODES}"
f"This regex mode isn't supported!"
f"please choose from the following list: {RexiApp.AVAILABLE_MODES}"
)

super().__init__()
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from _pytest.monkeypatch import MonkeyPatch
from typer.testing import CliRunner

from rexi.cli import app


Expand Down
10 changes: 5 additions & 5 deletions tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from colorama import Fore
from textual.widgets import Static

from rexi.rexi import RexiApp, UNDERLINE, RESET_UNDERLINE
from rexi.rexi import RESET_UNDERLINE, UNDERLINE, RexiApp


@pytest.mark.parametrize(
Expand All @@ -13,17 +13,17 @@
[
"match",
".*(aTe).*",
f"{UNDERLINE}This iS! {Fore.RED}aTe{Fore.RESET} xt2 F0r T3sT!ng{RESET_UNDERLINE}",
f"{UNDERLINE}This iS! {Fore.RED}aTe{Fore.RESET} xt2 F0r T3sT!ng{RESET_UNDERLINE}", # noqa: E501
],
[
"match",
".*(aTe.*)",
f"{UNDERLINE}This iS! {Fore.RED}aTe xt2 F0r T3sT!ng{Fore.RESET}{RESET_UNDERLINE}",
f"{UNDERLINE}This iS! {Fore.RED}aTe xt2 F0r T3sT!ng{Fore.RESET}{RESET_UNDERLINE}", # noqa: E501
],
[
"finditer",
"(aTe)",
f"This iS! {UNDERLINE}{Fore.RED}aTe{Fore.RESET}{RESET_UNDERLINE} xt2 F0r T3sT!ng",
f"This iS! {UNDERLINE}{Fore.RED}aTe{Fore.RESET}{RESET_UNDERLINE} xt2 F0r T3sT!ng", # noqa: E501
],
],
)
Expand All @@ -44,7 +44,7 @@ async def test_input_box_with_initial_pattern() -> None:
result = str(cast(Static, app.query_one("#output")).renderable)
assert (
result
== f"{UNDERLINE}{Fore.RED}This iS!{Fore.RESET}{RESET_UNDERLINE} aTe xt2 F0r T3sT!ng"
== f"{UNDERLINE}{Fore.RED}This iS!{Fore.RESET}{RESET_UNDERLINE} aTe xt2 F0r T3sT!ng" # noqa: E501
)


Expand Down
Loading