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 support for flake.lock #6166

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def generated?
generated_net_specflow_feature_file? ||
composer_lock? ||
cargo_lock? ||
flake_lock? ||
node_modules? ||
go_vendor? ||
go_lock? ||
Expand Down Expand Up @@ -466,6 +467,13 @@ def cargo_lock?
!!name.match(/Cargo\.lock/)
end

# Internal: Is the blob a generated Nix flakes lock file?
#
# Returns true or false
def flake_lock?
!!name.match(/(^|\/)flake\.lock$/)
end

# Is the blob a VCR Cassette file?
#
# Returns true or false
Expand Down
1 change: 1 addition & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,7 @@ JSON:
- ".watchmanconfig"
- Pipfile.lock
- composer.lock
- flake.lock
- mcmod.info
language_id: 174
JSON with Comments:
Expand Down
191 changes: 191 additions & 0 deletions samples/JSON/filenames/flake.lock

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 @@ -163,6 +163,9 @@ def test_generated
# Composer generated composer.lock file
assert sample_blob_memory("JSON/filenames/composer.lock").generated?

# Nix generated flake.lock file
assert sample_blob_memory("JSON/filenames/flake.lock").generated?

# PEG.js-generated parsers
assert sample_blob_memory("JavaScript/parser.js").generated?

Expand Down