-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update VS Code for Runtime Analysis Findings Pages #519
Conversation
5604f6c
to
cb32a02
Compare
src/services/findingsIndex.ts
Outdated
return this.findings().filter((finding) => finding.finding.impactDomain === impactDomain); | ||
} | ||
|
||
findingsByHashV2(hash: string): ResolvedFinding[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-pick, but I think this should just be findingsByHash
- The fact that it's V2
is just an implementation detail that may change in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, I renamed it 👍
src/services/findingsIndex.ts
Outdated
const findingsByRuleTitle = this.findings().filter( | ||
(finding) => finding.finding.ruleTitle === ruleTitle | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can destructure the parameter here to cut down on verbosity (finding.finding
). This isn't really an issue though, just an FYI.
filter(({ finding }) => finding.ruleTitle === ruleTitle)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. I just changed it in a couple of places in this file.
const uniqueFindingsByHash = findingsByRuleTitle.reduce((accumulator, finding) => { | ||
const hashV2 = finding.finding.hash_v2; | ||
|
||
if (!(hashV2 in accumulator)) { | ||
accumulator[hashV2] = finding; | ||
} | ||
|
||
return accumulator; | ||
}, {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're finding that there's a lot of duplicate logic between the extension and front-end we can consider adding a findings model to @appland/models
.
const impactDomain = finding.finding.impactDomain; | ||
|
||
if (impactDomain && !impactDomains.includes(impactDomain)) { | ||
impactDomains.push(impactDomain); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a case normalization here but I recognize the type is defined as 'Security' | 'Performance' | 'Maintainability' | 'Stability'
.
🤷
src/webviews/findingInfoWebview.ts
Outdated
const docPath = join(__dirname, `../node_modules/@appland/scanner/doc/rules/${dasherize(id)}.md`); | ||
|
||
if (!fs.existsSync(docPath)) return; | ||
|
||
// replace any carriage return with a newline | ||
const content = fs.readFileSync(docPath, 'utf-8').replace(/\r\n/g, '\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The production build is bundled down to a single file, so this path won't exist. Instead of fs.readFileSync
, this will need to be a dynamic import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need another custom type defined in types/custom.d.ts
as well as a webpack loader rule for .md
files. This may (?) break our tests as they use tsc
compiled JavaScript (not webpack) but we'll cross that bridge when we come to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, I just changed it so that the rule information is now retrieved from parsing appmap-findings.json
instead of looking for the markdown file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
12d3868
to
6a5761b
Compare
198e858
to
40c475d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
Remove duplicate listeners in installGuideView.js, remove extraneous 1 in installGuideWebview.ts, and convert the render arrow function in appmapView.js to a method.
Sometimes a location is not available. Maybe the path no longer exists in this project or the AppMap was shared from another source. Instead of `undefined`, attempt to fall back to something descriptive.
99376fb
to
ac9b664
Compare
🎉 This PR is included in version 0.56.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Fixes #520
This PR uses webviews that are available from this PR
Overview
This PR adds webviews to the VS Code extension that provide information about findings. There are three main changes:
Runtime Analysis
tree view is now organized:Findings Overview
page:Finding Details
page for each finding:Developing Locally
appmap-js
locally.a.
git clone https:/getappmap/appmap-js.git
.b.
cd appmap-js
.c.
git checkout analysis-findings
.d.
yarn
.e.
yarn build
.vscode-appland
.package.json
file invscode-appland
, replacingYOUR_PATH
with the path toappmap-js
on your machine::yarn
from the root ofvscode-appland
.yarn watch
from the root ofvscode-appland
.vscode-appland
in VS Code and launch the debugger extension host (pressF5
or click theRun
menu and then clickStart Debugging
).