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

core(inspector-issues): update inspector-issues audit to match gatherer #13948

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

adamread
Copy link
Contributor

@adamread adamread commented May 2, 2022

Summary
Updates the inspector-issues audit to handle all of the issue types currently being picked up in the gatherer.

Related Issues/PRs
fixes #13147

@adamread adamread requested a review from a team as a code owner May 2, 2022 20:04
@adamread adamread requested review from connorjclark and removed request for a team May 2, 2022 20:04
@adamread adamread changed the title core(inspector-issues): Update inspector-issues audit to match gatherer core(inspector-issues): update inspector-issues audit to match gatherer May 2, 2022
@adamread
Copy link
Contributor Author

adamread commented May 2, 2022

Sorry this took literally forever.

Something I'm wondering about is adding smoke tests. Some of the issues are hard to find real-life examples for, and others don't seem to be reported in the issues panel yet. Should I be adding smoke tests for everything too?

Thanks.

lighthouse-core/audits/dobetterweb/inspector-issues.js Outdated Show resolved Hide resolved
lighthouse-core/audits/dobetterweb/inspector-issues.js Outdated Show resolved Hide resolved
lighthouse-core/audits/dobetterweb/inspector-issues.js Outdated Show resolved Hide resolved
issueTypeLowTextContrast: 'Low text contrast',
/** Issue related to the reduction of information in user-agent strings. */
issueTypeNavigatorUserAgent: 'Using information not present in reduced user-agent strings',
/** Issue related to the document rendering in quirks mode. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's suggest to the translator that terms like "legacy" are also a valid descriptor. Or maybe we should backtick quirks...

Copy link
Collaborator

Choose a reason for hiding this comment

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

(unresolved): do you perhaps have changes you haven't pushed to the branch?

for (const issue of navigatorUserAgentIssues) {
const url = issue.url;
const lineNumber = issue.location?.lineNumber;
urls.add(`${url}${lineNumber ? `, line ${lineNumber}` : ''}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this line looks like a string typo?

return {
issueType: str_(UIStrings.issueTypeNavigatorUserAgent),
subItems: {
type: 'subitems',
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this issue type has source line/col information, we can instead use Audit.makeSourceLocation. It should override the default column type here if you do this:

items: dedupedNavigatorUserAgentIssues.map(url => Audit.makeSourceLocation(url, line, column, bundle))

For an example of how to get the bundle value for this script (the script that url references), see violation-audit

Another option is to leave this for another PR / for us to handle (and just add items with the URL, no line/col info for now)

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, and the columns here I think are 1-indexed but we use 0-indexed

// Protocol.Audits.SourceCodeLocation.columnNumber is 1-indexed, but we use 0-indexed.

@connorjclark
Copy link
Collaborator

I don't think we need smoke tests for every single issue type, you're right that would be a lot of code to write. The one big new thing here is issue types with source location information, so perhaps just one for those would be good? Although I've just noticed we have zero smoke tests for any of these at the moment..

@connorjclark
Copy link
Collaborator

@adamread resolved the conflict with master for you. do you have time to address feedback? If not, we can take over. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

installability errors and inspector issues need updating
5 participants