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 SQLx query files as generated #6748

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def generated?
generated_haxe? ||
generated_jooq? ||
generated_pascal_tlb? ||
generated_sorbet_rbi?
generated_sorbet_rbi? ||
generated_sqlx_query?
end

# Internal: Is the blob an Xcode file?
Expand Down Expand Up @@ -825,5 +826,18 @@ def extract_html_meta(match)
[key, val]
end.select { |x| x.length == 2 }.to_h
end

# Internal: Is this a generated SQLx query file?
#
# SQLx is a Rust SQL library which generates `**/.sqlx/query-*.json` files
# in offline mode (enabled by default).
#
# These are used to be able to compile a project without requiring
# the development database to be online.
#
# Returns true or false.
def generated_sqlx_query?
!!name.match(/(?:^|.*\/)\.sqlx\/query-.+\.json$/)
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/test_blob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ def test_generated
assert sample_blob_memory("Ruby/rails@7.0.3.1.rbi").generated?
assert sample_blob_memory("Ruby/rendering.rbi").generated?
assert sample_blob_memory("Ruby/actionmailer.rbi").generated?

# SQLx query files
assert fixture_blob_memory("Rust/.sqlx/query-2b8b1aae3740a05cb7179be9c7d5af30e8362c3cba0b07bc18fa32ff1a2232cc.json").generated?
end

def test_vendored
Expand Down
Loading