Skip to content

Update codingStandards to remove instruction to double indent function parameters, and to note instructions for nameing scripts.#17126

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
XLTechie:updateCodingStandardsBecauseBot
Sep 9, 2024
Merged

Update codingStandards to remove instruction to double indent function parameters, and to note instructions for nameing scripts.#17126
seanbudd merged 3 commits into
nvaccess:masterfrom
XLTechie:updateCodingStandardsBecauseBot

Conversation

@XLTechie

@XLTechie XLTechie commented Sep 6, 2024

Copy link
Copy Markdown
Collaborator

Link to issue number:

In-response-to #12355 (comment)

Summary of the issue:

Pre-commit-ci, on behalf of Ruff, does not approve of function parameter lists being double indented.
I.e. NVDA's coding standards said:

For the parameter list of function definitions, double indent, this differentiates the parameters and the body of the function.

That resulted in, e.g.:

def test(
		param1: str,
		param2: int,
		param3: bool = False,
) -> str:
	pass

Pushing a function definition like that to an NVDA PR, would result in Pre-commit-ci "fixing" it, to appear as:

def test(
	param1: str,
	param2: int,
	param3: bool = False,
) -> str:
	pass

Sean suggested updating coding standards, which is presumably easier than trying to convince Ruff to do it our way.

Description of user facing changes

None

Description of development approach

  • Updated coding standards.
  • Also noticed that there was no instruction on how to format script names, but there was for events and various other entities. Added one to the relevant section.
  • Changed a few "eg"s to "e.g."s, and made other slight grammar alterations.

Luke Davis added 2 commits September 6, 2024 01:41
…n parameters, and to note instructions for nameing scripts.
@XLTechie XLTechie requested a review from a team as a code owner September 6, 2024 05:56

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for these changes, @XLTechie

I'm not a fan of letting our tools bully us into changing the way we work, but this is the path of least resistance, and using Ruff does outweigh this change, methinks.

@XLTechie

XLTechie commented Sep 6, 2024

Copy link
Copy Markdown
Collaborator Author

@SaschaCowley Yes, exactly. I don't like at all caving to the tyranny of a tool. But, in this case, it's not really a change worth trying to circumvent. The unindented closing parenthesis indicates the same thing as the double tabs, and there are bigger wars to fight.

Comment thread user_docs/en/changes.md
@CyrilleB79

Copy link
Copy Markdown
Contributor

Maybe a change log entry is not needed. But some communication, e.g. on NVDA dev list, surely would prevent a developer from spending time investigating why the pre-commit has modified their code.

@seanbudd seanbudd merged commit 2275711 into nvaccess:master Sep 9, 2024
@github-actions github-actions Bot added this to the 2025.1 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants