Skip to content

Commit

Permalink
feat: Improve commit yaml error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Oct 30, 2024
1 parent b7968a4 commit 2f2a0c4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function UploadsCard() {
<Card.Title size="base">Coverage reports history</Card.Title>
{/* @ts-expect-error */}
<A onClick={() => setShowYAMLModal(true)} hook="open yaml modal">
<span className="text-xs">view YAML file</span>
<span className="text-xs text-red-700">view YAML file</span>
</A>
</div>
<Card.Description className="text-ds-gray-quinary">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import A from 'ui/A'
import Banner from 'ui/Banner'
import BannerContent from 'ui/Banner/BannerContent'
import BannerHeading from 'ui/Banner/BannerHeading'
Expand All @@ -6,11 +7,20 @@ function YamlErrorBanner() {
return (
<Banner variant="warning">
<BannerHeading>
<p className="font-semibold">Commit YAML is invalid</p>
<p className="font-semibold">
<A to="" isExternal={true}>
YAML
</A>{' '}
is invalid
</p>
</BannerHeading>
<BannerContent>
Coverage data is unable to be displayed, as the commit YAML appears to
be invalid.
be invalid. The{' '}
<A to="" isExternal={true}>
yaml validator
</A>{' '}
can help determine its validation.
</BannerContent>
</Banner>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ function YamlModalErrorBanner() {
return (
<Banner variant="warning">
<BannerHeading>
<div className="font-semibold">Commit YAML is invalid</div>
<div className="font-semibold"><A to="">YAML</A> is invalid</div>
</BannerHeading>
<BannerContent>
When the commit-level YAML is invalid, we use the last valid repo YAML.
Coverage data is unable to be displayed, as the yaml appears to be invalid.
The <A to="" isExternal={true}>yaml validator</A> can help determine its validation.

{/* When the commit-level YAML is invalid, we use the last valid repo YAML.
To determine if your YAML is valid, please follow the steps{' '}
<A to={{ pageName: 'repoYaml' }}>here.</A>
<A to={{ pageName: 'repoYaml' }}>here.</A> */}
</BannerContent>
</Banner>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useParams } from 'react-router-dom'

import { useCommitCoverageDropdownSummary } from 'services/commit/useCommitCoverageDropdownSummary'
import Icon from 'ui/Icon'
import SummaryDropdown from 'ui/SummaryDropdown'

interface URLParams {
Expand All @@ -21,6 +22,13 @@ const CoverageMessage: React.FC = () => {
const comparison = data?.commit?.compareWithParent
const uploadErrorCount = data?.uploadErrorCount

return (
<>
data unavailable due to invalid yaml{' '}
<Icon name="exclamationTriangle" className="fill-ds-primary-red" />
</>
)

if (!!uploadErrorCount) {

Check warning on line 32 in src/pages/CommitDetailPage/Dropdowns/CommitCoverageDropdown.tsx

View workflow job for this annotation

GitHub Actions / Run Lint

Unreachable code
if (uploadErrorCount === 1) {
return (
Expand Down

0 comments on commit 2f2a0c4

Please sign in to comment.