Skip to content

docs: Change --indent-string's whitespace representation #9904

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 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed the default back to spaces (with "")
  • Loading branch information
rogersheu committed Sep 1, 2024
commit 67cd28ae16323e2ac7afa8c5267b505457996c93
4 changes: 2 additions & 2 deletions doc/user_guide/configuration/all-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ Standard Checkers
"""""""""""""""
*String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1 tab).*

**Default:** ``"    "``
**Default:** ``" "``


--max-line-length
Expand Down Expand Up @@ -955,7 +955,7 @@ Standard Checkers

indent-after-paren = 4

indent-string = "    "
indent-string = " "

max-line-length = 100

Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class FormatChecker(BaseTokenChecker, BaseRawFileChecker):
(
"indent-string",
{
"default": '"    "',
"default": '" "',
Copy link
Member

Choose a reason for hiding this comment

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

This change thΓ© default value in the code, it's going to cause problem. There's a mechanism in place to modify the default value for the doc but not the code, see enchent dict of available language for the spell checker or default python interpreter. (On mobile, can't link to the exact place Sorry)

Copy link
Contributor Author

@rogersheu rogersheu Sep 1, 2024

Choose a reason for hiding this comment

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

I see. Yeah, I can see how this might cause a problem.

I'm looking at the arguments for enchant. Is this the one you had in mind?

        (
            "spelling-dict",
            {
                "default": "",
                "type": "choice",
                "metavar": "<dict name>",
                "choices": _get_enchant_dict_choices(enchant_dicts),
                "help": _get_enchant_dict_help(enchant_dicts, PYENCHANT_AVAILABLE),
            },
        ),
...

I see what's happening here, with functions being passed into choices/help, but the real issue is that default has to be four spaces, , exactly to make sure the default remains correct. This means that the value has to be different when interpreted for the conversion to reStructuredText.

Does adding such functionality sound like a reasonable path forward for this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Back on a PC πŸ˜„ I meant this:

DYNAMICALLY_DEFINED_OPTIONS: dict[str, dict[str, str]] = {
# Option name, key / values we want to modify
"py-version": {"default": "sys.version_info[:2]"},
"spelling-dict": {
"choices": "Values from 'enchant.Broker().list_dicts()' depending on your local enchant installation",
"help": "Spelling dictionary name. Available dictionaries depends on your local enchant installation",
},
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing me to this @Pierre-Sassoulas !!

Been busy with work lately, but I'm hoping to find a little time to test out this change soon. πŸ˜…

"type": "non_empty_string",
"metavar": "<string>",
"help": "String used as indentation unit. This is usually "
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy