Skip to content

Commit

Permalink
Add Cargo.toml.orig as TOML filename (#6787)
Browse files Browse the repository at this point in the history
* Add `Cargo.toml.orig` as TOML filename

* Mark `Cargo.toml.orig` as generated
  • Loading branch information
spenserblack committed Jun 7, 2024
1 parent 9d2fd70 commit 00bf9c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
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? ||
cargo_orig? ||
flake_lock? ||
bazel_lock? ||
node_modules? ||
Expand Down Expand Up @@ -478,6 +479,13 @@ def cargo_lock?
!!name.match(/Cargo\.lock/)
end

# Internal: Is the blob a generated Rust Cargo original file?
#
# Returns true or false.
def cargo_orig?
!!name.match(/Cargo\.toml\.orig/)
end

# Internal: Is the blob a generated Nix flakes lock 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 @@ -7041,6 +7041,7 @@ TOML:
- ".toml"
filenames:
- Cargo.lock
- Cargo.toml.orig
- Gopkg.lock
- Pipfile
- pdm.lock
Expand Down
24 changes: 24 additions & 0 deletions samples/TOML/filenames/Cargo.toml.orig

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_generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def test_check_generated
generated_fixture_loading_data("Generated/Haxe/Main.cs")
generated_fixture_loading_data("Generated/Haxe/Main.php")

# Cargo
generated_sample_without_loading_data("TOML/filenames/Cargo.toml.orig")

# jOOQ
generated_sample_loading_data("Java/generated-jooq-table.java")

Expand Down

0 comments on commit 00bf9c9

Please sign in to comment.