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(pr-baseline-2): Modify ADO PR comments to include baseline info #909
Conversation
…der in preparation for different PR comments
…updating pr comment
…tion into lisli1/pr-comment-baseline
Accessibility Insights Action
Failed instances
This scan used axe-core 4.3.2 with Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36. |
Codecov Report
@@ Coverage Diff @@
## main #909 +/- ##
==========================================
+ Coverage 87.61% 88.55% +0.93%
==========================================
Files 39 39
Lines 840 909 +69
Branches 102 113 +11
==========================================
+ Hits 736 805 +69
Misses 104 104
Continue to review full report at Codecov.
|
let reportMarkdown: string; | ||
const baselineFileName = this.adoTaskConfig.getBaselineFile(); | ||
|
||
if (baselineFileName === undefined) { |
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.
Would it be useful to push this into a function whose name provides some clarity about what it does?
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.
Do you mean specifically the part for checking if baselining was configured by the user (just L99-101)?
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.
At first I was thinking 98-117 would be the new method. Looking again, you could wrap lines 108-110 in a simple method to get the BaselineInfo, then call it something like this:
const reportMarkdown = this.reportMarkdownConvertor.convert(
combinedReportResult,
AdoPullRequestCommentCreator.CURRENT_COMMENT_TITLE,
this.getBaselineInfo(this.adoTaskConfig.getBaselineFile(), baselineEvaluation)
);
...
function getBaselineInfo(baselineFileName: string, baselineEvaluation: BaselineEvaluation) {
if (!baselineFileName) {
return {} as BaselineInfo;
}
return { baselineFileName, baselineEvaluation };
}
I wouldn't consider this as a "must have", but it feels like it would improve the readability a bit. I remember hearing someone on the team comment that a let
keyword is a sort of a code smell that can usually be improved with a simple refactor.
Co-authored-by: Dave Tryon <45672944+DaveTryon@users.noreply.github.com>
…essibility-insights-action into lisli1/pr-comment-baseline
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.
Wording seems a bit odd, but approving either way
Co-authored-by: Dave Tryon <45672944+DaveTryon@users.noreply.github.com>
Details
Added the different scenarios for the PR comments in ADO:
Note: The snapshot for result-markdown-builder is long but it's worth reviewing for the different PR comment scenarios
Motivation
Addresses part of WI 1882596 for feature work
Context
baseline-types.ts
is a temp file until ai-scan package gets updated and we can consume thebaseline-types
from that.Pull request checklist
yarn test
)<rootDir>/test-results/unit/coverage
yarn precheckin
)Accessibility Checks (pull_request)
check should fail. All other checks should pass.