-
Notifications
You must be signed in to change notification settings - Fork 178
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
Architecture for sharing processed data across rules #20
Comments
Commit 3ae3d83 introduces a framework for memoization, allowing you to define shared processing functions like this: from memoize import memoize
@memoize
def reverse(text):
return text[::-1] and then call them from within the from proselint.reverse import reverse
def check(text):
reversed_text = reverse(text)
error_code = "PL000"
msg = "First line always has an error."
return [(1, 1, error_code, msg)] One of the nice things about this system is that each linter rule includes all the data transformations it requires (e.g., maybe someday there will be I think this closes this issue because it implements a minimal version of what's requested. Does that work for you? |
If we need to use more computationally intense analyses in multiple rules (e.g., nltk & syntax parsing to identify whether •while• is being used as a conjunction or a adverb) it would make more sense to memoize the output so that it can be accessed by other rules rather than rerun.
This should be a fairly general system that automatically builds the data structures so that they can be shared across individual checks, possibly with some kind of a require type statement being present in more than one rule?
The text was updated successfully, but these errors were encountered: