Skip to content

Commit

Permalink
Change: Replace pylint with ruff
Browse files Browse the repository at this point in the history
Ruff is just so much faster.
  • Loading branch information
bjoernricks committed Jul 18, 2023
1 parent 0fd8c44 commit eec57e6
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 225 deletions.
2 changes: 0 additions & 2 deletions autohooks/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
Main Plugin API
"""

from typing import Callable, Optional

from autohooks.config import Config
from autohooks.precommit.run import ReportProgress
from autohooks.terminal import bold_info, error, fail, info, ok, out, warning
Expand Down
2 changes: 1 addition & 1 deletion autohooks/cli/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def list_plugins(term: Terminal, args: Namespace) -> None:
config = load_config_from_pyproject_toml(pyproject_toml)

current_plugins = (
config.settings.pre_commit if config.has_autohooks_config() else [] # type: ignore # pylint:disable = C0301
config.settings.pre_commit if config.has_autohooks_config() else [] # type: ignore # pylint:disable = C0301 # noqa:E501
)
print_current_plugins(term, current_plugins)

Expand Down
2 changes: 1 addition & 1 deletion autohooks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def has_autohooks_config(self) -> bool:
return self.settings is not None

def get_pre_commit_script_names(self) -> List[str]:
return self.settings.pre_commit if self.has_autohooks_config() else [] # type: ignore # pylint:disable
return self.settings.pre_commit if self.has_autohooks_config() else [] # type: ignore # pylint:disable # noqa: E501

def get_mode(self) -> Mode:
return (
Expand Down
244 changes: 34 additions & 210 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rich = ">=12.5.1"

[tool.poetry.dev-dependencies]
autohooks-plugin-black = ">=21.12.0"
autohooks-plugin-pylint = ">=21.6.0"
autohooks-plugin-ruff = ">=23.6.0"
autohooks-plugin-isort = ">=22.3.0"
autohooks-plugin-mypy = ">=23.3.0"
coverage = ">=7.2.7"
Expand Down Expand Up @@ -87,7 +87,7 @@ exclude = '''
pre-commit = [
'autohooks.plugins.isort',
'autohooks.plugins.black',
'autohooks.plugins.pylint',
'autohooks.plugins.ruff',
'autohooks.plugins.mypy',
]
mode = "poetry"
Expand All @@ -103,3 +103,7 @@ line_length = 80
files = "autohooks"
ignore_missing_imports = true
explicit_package_bases = true

[tool.ruff]
line-length = 80
target-version = "py38"
4 changes: 2 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import tempfile
from contextlib import AbstractContextManager, contextmanager
from pathlib import Path
from typing import Generator, Optional
from typing import Generator

from autohooks.utils import exec_git

Expand Down Expand Up @@ -104,7 +104,7 @@ def tempgitdir() -> Generator[Path, None, None]:
def temp_file(
content: str,
*,
name: Optional[str] = "test.toml",
name: str = "test.toml",
change_into: bool = False,
) -> Generator[Path, None, None]:
"""
Expand Down
10 changes: 3 additions & 7 deletions tests/api/git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import random
import tempfile
import unittest
from contextlib import contextmanager
from pathlib import Path
from typing import Generator

from autohooks.utils import exec_git

Expand All @@ -33,15 +29,15 @@ def randbytes(n: int) -> bytes: # pylint: disable=invalid-name


def git_add(*paths: Path) -> None:
exec_git("add", *paths)
exec_git("add", *paths) # type: ignore[arg-type]


def git_rm(*paths: Path) -> None:
exec_git("rm", *paths)
exec_git("rm", *paths) # type: ignore[arg-type]


def git_mv(from_path: Path, to_path: Path) -> None:
exec_git("mv", from_path, to_path)
exec_git("mv", from_path, to_path) # type: ignore[arg-type]


def git_commit(message: str = "Foo Bar"):
Expand Down

0 comments on commit eec57e6

Please sign in to comment.