Skip to content

Commit

Permalink
remove dependency on pyproject.toml (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkandersson authored Dec 23, 2022
1 parent ee515f5 commit 1d886d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## [Unreleased]

## [v1.0.4] - 2022-12-23
## [v1.0.5] - 2022-12-23

### Fixed

- Fix incorrect toml package name for Python 3.10 and earlier
- Remove dependency on presence of `pyproject.toml` file

## [v1.0.0] - 2022-12-23

Expand All @@ -22,4 +22,4 @@

[//]: # "Release links"
[v1.0.0]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.0
[v1.0.4]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.4
[v1.0.5]: https://github.com/jdkandersson/flake8-test-docs/releases/v1.0.5
18 changes: 1 addition & 17 deletions flake8_test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,13 @@
import argparse
import ast
import re
import sys
from functools import wraps
from pathlib import Path
from typing import Callable, Iterable, List, NamedTuple, Optional, Tuple, Type

from flake8.options.manager import OptionManager

# One or the other line can't be covered depending on the Python version
if sys.version_info < (3, 11): # pragma: nocover
import tomli as tomllib
else: # pragma: nocover
import tomllib

ERROR_CODE_PREFIX = next(
iter(
tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][
"plugins"
]["flake8.extension"].keys()
)
)
ERROR_CODE_PREFIX = "TDO"
MORE_INFO_BASE = "more information: https://github.com/jdkandersson/flake8-test-docs"
MISSING_CODE = f"{ERROR_CODE_PREFIX}001"
MISSING_MSG = (
Expand Down Expand Up @@ -369,9 +356,6 @@ class Plugin:
"""

name = __name__
version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["tool"]["poetry"][
"version"
]
_test_docs_pattern: DocsPattern = DocsPattern(*TEST_DOCS_PATTERN_DEFAULT.split("/"))
_test_docs_filename_pattern: str = TEST_DOCS_FILENAME_PATTERN_DEFAULT
_test_docs_function_pattern: str = TEST_DOCS_FUNCTION_PATTERN_DEFAULT
Expand Down
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flake8-test-docs"
version = "1.0.4"
version = "1.0.5"
description = "A linter that checks test docstrings for the arrange/act/assert structure"
authors = ["David Andersson <[email protected]>"]
license = "Apache 2.0"
Expand All @@ -22,7 +22,6 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.8.1"
flake8 = "^6"
tomli = { version = "^2", python = "<3.11" }

[tool.poetry.group.dev.dependencies]
pytest = "^7"
Expand Down

0 comments on commit 1d886d6

Please sign in to comment.