Skip to content

fix: suppress warning for shared file extensions (like .h)#148

Merged
kapral18 merged 1 commit intoelastic:mainfrom
kapral18:chore/suppress-file-ext-c-warning
Feb 16, 2026
Merged

fix: suppress warning for shared file extensions (like .h)#148
kapral18 merged 1 commit intoelastic:mainfrom
kapral18:chore/suppress-file-ext-c-warning

Conversation

@kapral18
Copy link
Collaborator

@kapral18 kapral18 commented Feb 15, 2026

Summary

  • Scope shared extension suppression to explicit language pairs using isSharedExtensionAllowed, allowing .h only for c and cpp.
  • Apply the same shared-extension rule in both LanguageParser and language validation so runtime and startup warnings are consistent.
  • Expand unit tests to cover allowed .h sharing (c/cpp), disallowed .h duplicates with other languages, and non-shared duplicate regression behavior.

Test plan

  • npm test
  • npm run lint

@kapral18 kapral18 force-pushed the chore/suppress-file-ext-c-warning branch from da7f85b to d977b01 Compare February 15, 2026 23:10
- Add a shared-extension helper and allow `.h` only for the `c`/`cpp` pair.
- Apply the same allowlist in parser warning logic and language validation.
- Expand parser and validator unit tests for allowed and disallowed duplicate cases.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the language-extension conflict logic so that intentionally shared extensions (currently .h) do not produce duplicate-extension warnings/errors except for explicitly allowed language pairs, keeping runtime (LanguageParser) and startup validation (validateLanguageConfiguration) behavior consistent.

Changes:

  • Introduces isSharedExtensionAllowed to explicitly allow .h sharing only between c and cpp.
  • Applies the shared-extension rule to both LanguageParser warning emission and language configuration validation.
  • Adds unit tests covering allowed .h sharing, disallowed .h conflicts with other languages, and regression coverage for non-shared duplicates.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/parser_extension_conflict.test.ts Adds unit tests ensuring .h sharing between c/cpp does not warn, while other .h and non-.h duplicates still warn.
tests/unit/language_validator.test.ts Adds validator tests ensuring .h is allowed only for the c/cpp pair and still errors for other language pairs.
src/utils/shared_extensions.ts Adds centralized shared-extension allowlist logic via isSharedExtensionAllowed.
src/utils/parser.ts Suppresses duplicate-extension warnings when the duplicate is explicitly allowed (e.g., .h for c/cpp).
src/utils/language_validator.ts Suppresses duplicate-extension validation errors for explicitly allowed shared extensions, matching runtime behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kapral18 kapral18 merged commit cc09ee4 into elastic:main Feb 16, 2026
12 checks passed
@kapral18 kapral18 deleted the chore/suppress-file-ext-c-warning branch February 16, 2026 00:26
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.

2 participants