Skip to content

Print multiple errors at once #121

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

A5rocks
Copy link

@A5rocks A5rocks commented Sep 18, 2024

This is a very basic .search -> .finditer replacement.

There's a few rules where this isn't wanted, because e.g. there's only one possible construct that could fail or because they provide no information in the error message.

Fixes #119

@@ -126,8 +125,7 @@ def check_default_role(file, lines, options=None):
for lno, line in enumerate(lines, start=1):
line = clean_paragraph(line)
line = escape2null(line)
match = rst.INTERPRETED_TEXT_RE.search(line)
if match:
for match in rst.INTERPRETED_TEXT_RE.finditer(line):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this because all the error messages are the same. On the other hand, this does potentially mean this rules catches offenses that previously it missed (because it just looked at the first possibility).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you give an example repro to trigger this?

@A5rocks

This comment was marked as resolved.

@hugovk

This comment was marked as resolved.

@CAM-Gerlach

This comment was marked as resolved.

@AlexWaygood

This comment was marked as resolved.

@A5rocks
Copy link
Author

A5rocks commented Jan 1, 2025

Just wanted to bump this!

@hugovk
Copy link
Collaborator

hugovk commented Feb 7, 2025

Addressing @AlexWaygood's performance concerns in #119 (comment), here's how the current Sphinx Lint main performs against CPython (macOS, Python 3.13.1):

hyperfine --warmup 3 "sphinx-lint Doc Misc/NEWS.d --enable=default-role" --ignore-failure
Benchmark 1: sphinx-lint Doc Misc/NEWS.d --enable=default-role
  Time (mean ± σ):      1.616 s ±  0.034 s    [User: 12.088 s, System: 0.696 s]
  Range (min … max):    1.580 s …  1.694 s    10 runs

  Warning: Ignoring non-zero exit code.

And this PR:

hyperfine --warmup 3 "sphinx-lint Doc Misc/NEWS.d --enable=default-role" --ignore-failure
Benchmark 1: sphinx-lint Doc Misc/NEWS.d --enable=default-role
  Time (mean ± σ):      1.680 s ±  0.021 s    [User: 12.671 s, System: 0.699 s]
  Range (min … max):    1.657 s …  1.728 s    10 runs

  Warning: Ignoring non-zero exit code.

The PR's time (1.68) is 0.96 times as fast as (96.19%) as the first time (1.616).

Is that acceptable?

@hugovk hugovk added the enhancement New feature or request label Feb 7, 2025
@AlexWaygood
Copy link
Collaborator

AlexWaygood commented Feb 7, 2025

Is that acceptable?

That seems fine to me! Thanks for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary-parenthesis only catches a single error per line
4 participants