Skip to content

Commit

Permalink
Prospector fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 7, 2025
1 parent 978ac97 commit 6a0611e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ repos:
- --output-format=pylint
additional_dependencies:
- prospector-profile-duplicated==1.8.0 # pypi
- prospector-profile-utils==1.14.1 # pypi
- prospector-profile-utils==1.15.1 # pypi
- ruff==0.7.3 # pypi
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 39.42.4
Expand Down
32 changes: 4 additions & 28 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
inherits:
- utils:base
- utils:no-design-checks
- utils:fix
- utils:unsafe
- duplicated
strictness: veryhigh
max-line-length: 110
doc-warnings: true

pycodestyle:
disable:
- E501 # line too long
pydocstyle:
disable:
- D104 # Missing docstring in public package
- D203 # 1 blank line required before class docstring (found 0)

pylint:
disable:
- line-too-long
- no-else-break
- no-else-return
- too-many-branches
- too-many-statements
- too-many-locals
- missing-module-docstring
- invalid-name

mypy:
run: true

options:
python-version: '3.10'
pyroma:
run: true

mccabe:
run: false
ruff:
options:
target-version: py310
44 changes: 43 additions & 1 deletion poetry.lock

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

19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[tool.ruff]
target-version = "py310"
line-length = 110

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

[tool.poetry]
name = "sphinx-prompt"
version = "0.0.0"
Expand Down Expand Up @@ -45,18 +52,12 @@ certifi = "2024.8.30"
jinja2 = "3.1.5"

[tool.poetry.group.dev.dependencies]
prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma"] }
prospector = { version = "1.13.3", extras = ["with_bandit", "with_mypy", "with_pyroma", "with_ruff"] }
prospector-profile-utils = "1.15.1"
prospector-profile-duplicated = "1.8.0"
pytest = "8.3.4"
types-docutils = "0.21.0.20241128"
prospector-profile-duplicated = "1.8.0"


[tool.ruff]
target-version = "py310"
line-length = 110

[tool.ruff.lint.pydocstyle]
convention = "numpy"
[build-system]
requires = ["poetry-core>=1.0.0", "poetry-plugin-tweak-dependencies-version", "poetry-dynamic-versioning", "poetry-plugin-drop-python-upper-constraint"]
build-backend = "poetry.core.masonry.api"
Expand Down
5 changes: 2 additions & 3 deletions sphinx_prompt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ def run(self) -> list[nodes.raw]:
location=(self.state.document.settings.env.docname, self.lineno),
)
break
else:
self.options[option_name] = self.arguments[idx]
self.options[option_name] = self.arguments[idx]

language: str = self.options.get("language") or "text"
prompt: str = self.options.get("prompts") or PROMPTS.get(language, "")
Expand Down Expand Up @@ -142,7 +141,7 @@ def run(self) -> list[nodes.raw]:
highlighted_line = highlight("\n".join(statement), Lexer(), HtmlFormatter(nowrap=True)).strip(
"\r\n"
)
if len(line) == 0 or not line[-1] == "\\":
if len(line) == 0 or line[-1] != "\\":
html += f'<span class="{_cache.get_prompt_class(prompt)}">{highlighted_line}</span>\n'
if prompt is not None:
statements = "\n".join(statement)
Expand Down

0 comments on commit 6a0611e

Please sign in to comment.