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

Add linter_level to Linter() metadata. #2351

Closed
AshesITR opened this issue Nov 24, 2023 · 3 comments · Fixed by #2352
Closed

Add linter_level to Linter() metadata. #2351

AshesITR opened this issue Nov 24, 2023 · 3 comments · Fixed by #2352

Comments

@AshesITR
Copy link
Collaborator

          Here's what cost > 1s in `lint()` during `lint_package()` currently:

image

We can see 30% of the time is spent in xml_find_all().
What surprised me was is_lint_level() taking a whole 8s. That may be worth converting to an attribute of Linter()?

Originally posted by @AshesITR in #2350 (comment)

@AshesITR
Copy link
Collaborator Author

~10% of the time lint_package() took (80s) is spent in is_lint_level().
We could avoid this by adding an attribute to Linter() that specifies lint_level.

For maximum backward compatibility, I suggest it to default to NA_character_ keeping the current behavior.
If it is set to "file" or "expression", only those source_expressions should be passed into the linter.
This means we can drop the check for all our linters and delegate it to lint() checking linter attributes.

@MichaelChirico
Copy link
Collaborator

I've actually had in mind something along these lines, namely, that most linters could be toggled very easily between file- and expression-level operation, with the difference maybe being a slight difference in the XPath (but in most cases the same XPath works for both cases).

It would be nice to have an easy API through lint() to say "I don't care about expression-level cacheing, just run file-level lints".

@AshesITR
Copy link
Collaborator Author

Working on this atm (diff will be large because it needs to touch all linters for the performance benefits)

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

Successfully merging a pull request may close this issue.

2 participants