Skip to content

Conversation

@shreyasutha
Copy link

This edit merges the indent() and space() options into a single interface. It:

  • Removes space() from all syntax blocks and user-facing documentation
  • Introduces a new internal variable indentval that is set to:
  •              indent() if provided
    
  •              space() if only it is provided (for backward compatibility)
    
  •              Defaults to 4 otherwise
    
  • Uses indentval consistently for both indentation detection and hard tab replacement

@luisesanmartin luisesanmartin self-requested a review July 18, 2025 14:47
@shreyasutha shreyasutha changed the title Merge space() into indent() for indentation handling (#84) Merge space() into indent() for indentation handling (#91) Jul 18, 2025
@luisesanmartin luisesanmartin linked an issue Aug 7, 2025 that may be closed by this pull request
Copy link
Member

@luisesanmartin luisesanmartin left a comment

Choose a reason for hiding this comment

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

@shreyasutha thanks a lot for working on this. After reviewing the code, I don't think we should apply any changes in it but only in the documentation because of these reasons:

  • space already defaults to the value in indent when the user doesn't define it. Hence, if in the future no user ever uses space again, the command would still work as intended
  • Keeping this differentiation between space and indent is critical for back-compatibility. The current solution you added to this commit is not back-compatible, as it would use the same value (indentval, the value in indent) even if the user defines two different values for space and indent
  • Then, I think the best solution for back-compatibility + merging both options is just modify the documentation to:
    1. Delete any mention of space
    2. Explain that indent checks the spaces for indentation and replaces hard-tabs with that number of spaces

That way, any old users still using space and indent will be able to use it with the original functionality, while new users will only use indent which will also be assigned internally to the value for space.

Can you then modify the documentation in this PR and revert your changes to the code? I know you were looking for a coding challenge here and I'm sorry this became only a documentation challenge. However, feel free to take on any other issues on repkit or lint if you can!

NOSUMmary ///
Indent(string) ///
Linemax(string) ///
Space(string) ///
Copy link
Member

Choose a reason for hiding this comment

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

these lines define the syntax of the command. As we want to keep the option space for backwards compatibility, we shouldn't remove it from the syntax definition

src/ado/lint.ado Outdated
Comment on lines 39 to 47
if ("`indent'" != "") {
local indentval = "`indent'"
}
else if ("`space'" != "") {
local indentval = "`space'"
}
else {
local indentval = 4
}
Copy link
Member

Choose a reason for hiding this comment

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

the condition in 39 will never activate, see that line 35 already already assigns a value for indent (4) if there isn't one already.
After checking the code again, I'm actually not convinced we should change any of this code as space will always take the value in indent when it's not defined by the user. See my other general comment on the review about changing only the documentation for a more detailed explanation.

@shreyasutha
Copy link
Author

Hi @luisesanmartin, thanks again for the helpful review!

I’ve now:

  • Reverted the code changes to preserve full backward compatibility
  • Edited mdhlp/lint.md to remove mentions of space() and clarify that indent() sets indentation and replaces hard tabs
  • Regenerated src/help/lint.sthlp

Let me know if any further tweaks are needed, but I believe this version aligns with your suggestion to treat this as a documentation-only update.

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.

lint: merge indent() and space() options into one

2 participants