Repository navigation
refactor: resolve DeepSource findings for require imports and dynamic delete - #328
Merged
Merged
Conversation
DeepSource reported "Require statement not part of import statement"
for `import path = require("path")` in vs-code-adapter.test.ts.
Use a named import there and `import * as Mocha` in the test runner,
which compiles to the same require() call. nyc ships no type
definitions and sonar-project.js is a plain node script, so both keep
their require() with a justified eslint-disable comment.
Enable @typescript-eslint/no-require-imports, so lint and CI catch
this before DeepSource does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
DeepSource reported "Do not delete dynamically computed property keys" for `delete doc[key]` in the custom sort of YamlUtil.sortYaml(). The loaded document was typed as `any` and mutated while the keywords were dumped. Type the loaded document as unknown, apply the custom sort only to mappings, dump each keyword in the new dumpKeyword() and build the remaining keys as a new object. Characterization tests cover keyword order, a document with only keywords, list and scalar documents. Enable @typescript-eslint/no-dynamic-delete, so lint and CI catch this before DeepSource does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.



What changed
vs-code-adapter.test.ts:import path = require("path")replaced byimport { resolve } from "path". The test runner usesimport * as Mocha from "mocha", which compiles to the samerequire()call.nyc(no type definitions) andsonar-project.js(plain node script) keeprequire()with a justifiedeslint-disablecomment.YamlUtil.sortYaml(): the custom sort no longer deletes keys from the loaded document. The document is typed asunknowninstead ofany, the custom sort applies to mappings only, each keyword is dumped by the newdumpKeyword(), and the remaining keys are built as a new object.@typescript-eslint/no-require-importsand@typescript-eslint/no-dynamic-deletein.eslintrc.js.Why
DeepSource reported two code smells after #327:
src/test/suite/adapter/vs-code-adapter.test.ts:2)src/util/yaml-util.ts:74)With the lint rules,
npm run lintand CI catch these before DeepSource does.Testing
tsc,eslint(with the new rules), dependency-cruiser and 207 tests pass locally. No behavior change.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M