Skip to content
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

Vale 3 not respecting BlockIgnores for Python docstrings #858

Open
1 task done
jorgepiloto opened this issue Jul 1, 2024 · 0 comments
Open
1 task done

Vale 3 not respecting BlockIgnores for Python docstrings #858

jorgepiloto opened this issue Jul 1, 2024 · 0 comments

Comments

@jorgepiloto
Copy link

jorgepiloto commented Jul 1, 2024

Check for existing issues

Environment

OS information

OS: Ubuntu 22.04.3 LTS x86_64 
Kernel: 6.5.0-41-generic 
Shell: zsh 5.8.1 
Terminal: xfce4-terminal 
CPU: 11th Gen Intel i7-11850H (8) @ 2.496GHz

Install method

Snap

Vale version

3.6.0

Describe the bug / provide steps to reproduce it

Background

I have a Python file that renders into an example within the documentation of a project. Its inline comments support Markdown style, see:

# # Computing the area of a circle
#
# Use the formula: $A = \pi r^2$
#
# The following function implements previous formula:

def compute_circle_area(circle_radius: float) -> float:
    """Compute the area of a circle from its radius.

    Parameters
    ----------
    circle_radius : float
        Radius of the circle

    Returns
    -------
    float
        Area of the circle

    """
    return 3.14 * circle_radius ** 2


# Use previous function as follows:

circle_radius = 1
area = compute_circle_area(circle_radius)
print(f"{area = :.2f}")

Given the following .vale.ini file:

# Core settings
# =============

# Location of our `styles`
StylesPath = "styles"

# The options are `suggestion`, `warning`, or `error` (defaults to “warning”).
MinAlertLevel = warning

# By default, `code` and `tt` are ignored.
IgnoredScopes = code, tt

# By default, `script`, `style`, `pre`, and `figure` are ignored.
SkippedScopes = script, style, pre, figure

# WordTemplate specifies what Vale will consider to be an individual word.
WordTemplate = \b(?:%s)\b

# List of Packages to be used for our guidelines
Packages = Google

# Define the Ansys vocabulary
Vocab = ANSYS


[formats]
# Python + Markdown
py = md

[*.{py,md,rst}]
IgnoredScopes = code, tt

# Apply the following styles
BasedOnStyles = Vale, Google
Vale.Terms = NO

# Ignore inline LaTeX equations
TokenIgnores = (\$+[^\n$]+\$+)

# Ignore Python code blocks (not working despite being a valid regex)
BlockIgnores = (?s) """([^"]*)"""

This issue seems similar to the one in #736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant