Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: display up to 60 chars of the filepath in tree view #451

Conversation

bastiandoetsch
Copy link
Collaborator

@bastiandoetsch bastiandoetsch commented Sep 22, 2023

Description

Display up to 60 chars of the filepath in tree view

Checklist

  • Tests added and all succeed
  • Linted
  • CHANGELOG.md updated
  • README.md updated, if user-facing

Screenshots / GIFs

image

@bastiandoetsch bastiandoetsch requested a review from a team as a code owner September 22, 2023 09:10
@bastiandoetsch bastiandoetsch changed the title feat: display up to 70 chars of the filepath in tree view feat: display up to 60 chars of the filepath in tree view Sep 22, 2023
{
"ok": false,
"error": "Missing node_modules folder: we can't test without dependencies.\nPlease run 'npm install' first.",
"path": "/Users/user/Desktop/example-npm-project"
}
""".trimIndent())
""".trimIndent()

Check warning

Code scanning / detekt

Reports mis-indented code Warning test

Unexpected indent of multiline string closing quotes
Missing node_modules folder: we can't test without dependencies. Please run 'npm install' first.
""".trimIndent())
""".trimIndent()

Check warning

Code scanning / detekt

Reports mis-indented code Warning test

Unexpected indent of multiline string closing quotes
{
"ok": false,
"error": ["could not be","array here"],
"path": "some/path/here"
}
""".trimIndent())
""".trimIndent()

Check warning

Code scanning / detekt

Reports mis-indented code Warning test

Unexpected indent of multiline string closing quotes
{
"ok": false,
"error": "error",
"path_not_provided": ""
}
""".trimIndent())
""".trimIndent()

Check warning

Code scanning / detekt

Reports mis-indented code Warning test

Unexpected indent of multiline string closing quotes
Comment on lines +371 to +372
cliResult3.getFirstError()!!.message.contains(
"Parameter specified as non-null is null: method snyk.oss.OssVulnerabilitiesForFile.copy, parameter displayTargetFile"

Check warning

Code scanning / detekt

Reports lines with exceeded length Warning test

Exceeded max line length (120)
))
assertTrue(
cliResult3.getFirstError()!!.message.contains(
"Parameter specified as non-null is null: method snyk.oss.OssVulnerabilitiesForFile.copy, parameter displayTargetFile"

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning test

Line detected, which is longer than the defined maximum line length in the code style.
Comment on lines +73 to +85
val relativePath = fileVulns.virtualFile?.let {
GotoFileCellRenderer.getRelativePath(
fileVulns.virtualFile, value.project
)
} ?: ""
toolTipText =
relativePath + fileVulns.sanitizedTargetFile + ProductType.OSS.getCountText(value.childCount)

text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) {
"..." + it.substring(
it.length - MAX_FILE_TREE_NODE_LENGTH, it.length
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +112 to +122
toolTipText =
GotoFileCellRenderer.getRelativePath(file.virtualFile, file.project) + productType.getCountText(
value.childCount
)

text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) {
"..." + it.substring(
it.length - MAX_FILE_TREE_NODE_LENGTH, it.length
)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +137 to +148
val relativePath = iacVulnerabilitiesForFile.virtualFile?.let {
GotoFileCellRenderer.getRelativePath(
iacVulnerabilitiesForFile.virtualFile, value.project
)
} ?: iacVulnerabilitiesForFile.targetFilePath
toolTipText = relativePath + ProductType.IAC.getCountText(value.childCount)

text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) {
"..." + it.substring(
it.length - MAX_FILE_TREE_NODE_LENGTH, it.length
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +15 to +16

val virtualFile: VirtualFile? = LocalFileSystem.getInstance().findFileByPath(this.targetFilePath)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +17 to +18
val virtualFile: VirtualFile? = LocalFileSystem.getInstance().findFileByPath(this.path)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +105 to +106
mockkStatic(GotoFileCellRenderer::class)
every { GotoFileCellRenderer.getRelativePath(any(), any()) } returns "abc/"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

Comment on lines +44 to +45
mockkStatic(GotoFileCellRenderer::class)
every { GotoFileCellRenderer.getRelativePath(any(), any()) } returns "abc/"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may be interesting for review

@bastiandoetsch bastiandoetsch enabled auto-merge (squash) September 22, 2023 13:41
@bastiandoetsch bastiandoetsch force-pushed the feat/display-relative-path-to-file-in-tool-window-tree-node branch from 668bd05 to 60972c0 Compare October 9, 2023 14:33
Copy link
Contributor

@cat2608 cat2608 left a comment

Choose a reason for hiding this comment

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

🚀

@bastiandoetsch bastiandoetsch merged commit bf46cf7 into master Oct 9, 2023
8 checks passed
@bastiandoetsch bastiandoetsch deleted the feat/display-relative-path-to-file-in-tool-window-tree-node branch October 9, 2023 14:50
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