cli
cli copied to clipboard
New Source Type for URLs
User story
At the moment the Issue
type only accepts SourceFileLocation
like follows:
const sourceFileLocationSchema = z.object(
{
file: filePathSchema.describe('Relative path to source file in Git repo'),
position: z
.object(
{
startLine: positiveIntSchema.describe('Start line'),
startColumn: positiveIntSchema.describe('Start column').optional(),
endLine: positiveIntSchema.describe('End line').optional(),
endColumn: positiveIntSchema.describe('End column').optional(),
},
{ description: 'Location in file' },
)
.optional(),
});
export const issueSchema = z.object(
{
// ...
source: sourceFileLocationSchema.optional(),
}
);
As some of problems could be HTML
under a rendered URL we could consider this format as additional issue location.
A example for the above described case could be CLS elements within a page measured by the cumulative-layout-shifts
audit.
Acceptance criteria
- [ ] The
models
package extends the model for issue location withsourceUrlLocationSchema
- [ ] The
cli
package uploads the new data to the backend - [ ] The
portal
displays the new data
Implementation details
const sourceUrlLocationSchema = z.object(
{
url: urlSchema.describe('Url in the browser'),
snippet: z.string({ description: 'HTMl. snippet in rendered URL' })
});
export const issueSchema = z.object(
{
// ...
source: z.union([sourceFileLocationSchema, sourceUrlLocationSchema]).optional(),
}
);