Repository navigation
Conversation
A line whose leading whitespace is one or more tabs, then exactly one space, then an asterisk is the continuation line of a tab-indented block comment, such as ApexDoc. The single space only aligns the asterisk under the opening slash-asterisk, so the line is no longer reported as mixed indentation. Every other mixed-indentation case is still reported.
|
Git2Gus App is installed but the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes forcedotcom/code-analyzer#2012.
The problem
NoMixedIndentationreports every continuation line of a block comment in a file that is indented with tabs. In ApexDoc and Javadoc-style comments, each continuation line is the indentation of the comment, then one space, then an asterisk. The one space only aligns the asterisk under the asterisk of the opening/**. The line is not mixed indentation, but the rule sees a tab followed by a space and reports it. The same happens for plain/* ... */block comments, and for block quotes written inside them.In this class,
→stands for one tab character and nothing else. Lines 3 to 6 start with a tab, then one space, then an asterisk. They are reported today:Before:
After:
The change
src/plugin.ts: the rule regex gets a negative lookahead,^(?!\t+ \*). A line whose leading whitespace is one or more tabs, then exactly one space, then an asterisk is skipped. Every other case is still reported: tabs then two or more spaces, spaces then a tab, and tabs then one space then any character that is not an asterisk. The lookahead is anchored at the start of the line, so it costs one comparison per line.src/messages.ts: the rule description names the exception.package.json: the regex engine's version goes to0.41.0-SNAPSHOT.test/engine.test.tsand two new fixtures:validIndentation_TabsWithBlockComments.clshas tab-indented ApexDoc comments, a plain block comment two tabs deep, and a block quote and a code block inside an ApexDoc comment. It must produce no violation. The current rule reports 15 lines in it.mixedIndentation_BlockCommentLookalikes.clshas four lines that look like comment continuation lines but are mixed indentation: tabs then two spaces then an asterisk, a space then a tab then a space then an asterisk, tabs then one space then a letter, and tabs then two spaces then text. The test checks the exact four violations with their lines and columns.The
regex_ignoreoption cannot express this exception. It is tested against the matched text only, which is the leading whitespace, so it never sees the asterisk that follows.Testing
With the change, the regex engine's build, lint, and tests pass locally (81 tests of 81, with
plugin.tsandmessages.tsat 100% coverage), and so do the snapshot version check and the package interdependency check. The six existing mixed indentation fixtures produce the same number of matches with the old regex and with the new one.The title
I do not have a work item number, so the title has none and the title check will fail. Please rename the pull request as you need.
🤖 Generated with Claude Code