Skip to content

Commit

Permalink
More ruff rules (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Jun 14, 2024
1 parent e63ba19 commit 21a7ba9
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 29 deletions.
17 changes: 0 additions & 17 deletions .black.toml

This file was deleted.

14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,26 @@ repos:
exclude: ^test/resources/.+

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.4.6
hooks:
- id: ruff
args: [--extend-ignore, "F401,F403"]

- repo: https://github.com/ambv/black
rev: 24.4.2
hooks:
- id: black
args: [--config=.black.toml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
hooks:
- id: mypy

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.1.3
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.18
hooks:
- id: validate-pyproject
3 changes: 1 addition & 2 deletions puremagic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/usr/bin/env python
from puremagic.main import __version__, __author__
from puremagic.main import *
from puremagic.main import __author__, __version__
2 changes: 1 addition & 1 deletion puremagic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ def magic_stream(stream, filename: os.PathLike | str | None = None) -> list[Pure


def command_line_entry(*args):
from argparse import ArgumentParser
import sys
from argparse import ArgumentParser

parser = ArgumentParser(
description=(
Expand Down
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[tool.black]
line-length = 120
target-version = [
'py36',
'py37',
'py38',
'py39',
]
exclude = '''
/(
\.eggs
| \.git
| \.idea
| \.pytest_cache
| \.github
| _build
| build
| dist
| venv
| test/resources
)/
'''

[tool.ruff]
line-length = 120

lint.select = [
"ALL",
]
lint.extend-ignore = [
"ANN",
"B008",
"BLE001",
"C408",
"COM812",
"D",
"EM101",
"EM103",
"EXE001",
"F401",
"F403",
"FBT",
"FIX002",
"N817",
"PERF401",
"PGH003",
"PT",
"PTH",
"PYI024",
"S101",
"S112",
"S314",
"SLF001",
"T201",
"TD002",
"TD003",
"TRY003",
"UP",
]
lint.mccabe.max-complexity = 13
lint.pylint.allow-magic-value-types = [
"float",
"int",
"str",
]
lint.pylint.max-branches = 13
4 changes: 2 additions & 2 deletions scripts/parse_ftk_kessler_sigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"""


import os
import xml.etree.ElementTree as ET
import binascii
import json
import os
import xml.etree.ElementTree as ET

import puremagic

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python

from setuptools import setup
import os
import re

from setuptools import setup

root = os.path.abspath(os.path.dirname(__file__))

Expand Down
7 changes: 4 additions & 3 deletions test/test_common_extensions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import unittest
from tempfile import NamedTemporaryFile
import os
import unittest
from io import BytesIO
import pytest
from pathlib import Path
from tempfile import NamedTemporaryFile

import pytest

import puremagic

Expand Down

0 comments on commit 21a7ba9

Please sign in to comment.