Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: expose schema_cache & file_context in lint rules#449

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
juleswritescode merged 21 commits intomainfromfeat/lint-with-ctx
Jul 15, 2025

Conversation

juleswritescode
Copy link
Collaborator

@juleswritescodejuleswritescode commentedJul 13, 2025
edited
Loading

  • TheAnalyser::run now takesVec<AnalysableStatement> and anOption<&SchemaCache>
  • it also initializes anAnalysedFileContext
  • theSchemaCache and theAnalysedFileContext are passed into each linting rule.

This should roughly match how theeugene code base does it.

The rest of the changes are adaptions to those changes or minor things, e.g. a new document-mapper or some renamings.

  • there's a bug with the lint spans, I'll fix it and write a test for it

@juleswritescodejuleswritescode marked this pull request as draftJuly 13, 2025 08:30
@juleswritescodejuleswritescode marked this pull request as ready for reviewJuly 13, 2025 12:20
Copy link
Collaborator

@psteinroepsteinroe left a comment

Choose a reason for hiding this comment

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

any reason why we do not simply put these into the rule context? from an API standpoint, I feel like they should?

Comment on lines 34 to 36
ctx: &RuleContext<Self>,
_file_context: &AnalysedFileContext,
_schema_cache: Option<&SchemaCache>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

from an API standpoint, I would put these two into theRuleContext. After all, they are "context" info.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I felt theRuleContext held static metadata about the rule, while the other stuff is related to the db/data model and the parsed sql file.

But I don't have a hard opinion

@@ -0,0 +1,7 @@
#[derive(Default)]
pub struct AnalysedFileContext {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this for?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

That's just a scaffold for the file context.
We can add properties in future linting PRs.
eugene works the same way:link

@juleswritescodejuleswritescodeenabled auto-merge (squash)July 15, 2025 10:08
@juleswritescodejuleswritescode merged commitc323eb0 intomainJul 15, 2025
7 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@psteinroepsteinroepsteinroe approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@juleswritescode@psteinroe

[8]ページ先頭

©2009-2025 Movatter.jp