lib/linguist/generated.rb in github-linguist-7.17.0 vs lib/linguist/generated.rb in github-linguist-7.18.0

- old
+ new

@@ -50,10 +50,11 @@ # `test/test_blob.rb#test_generated` if you make any changes. # # Return true or false def generated? xcode_file? || + intellij_file? || cocoapods? || carthage_build? || generated_graphql_relay? || generated_net_designer_file? || generated_net_specflow_feature_file? || @@ -63,10 +64,11 @@ go_vendor? || go_lock? || poetry_lock? || esy_lock? || npm_shrinkwrap_or_package_lock? || + terraform_lock? || generated_yarn_plugnplay? || godeps? || generated_by_zephir? || minified_files? || has_source_map? || @@ -81,11 +83,10 @@ generated_protocol_buffer? || generated_javascript_protocol_buffer? || generated_apache_thrift? || generated_jni_header? || vcr_cassette? || - jest_snapshot? || generated_antlr? || generated_module? || generated_unity3d_meta? || generated_racc? || generated_jflex? || @@ -111,10 +112,20 @@ # # Returns true or false. def xcode_file? ['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname) end + + # Internal: Is the blob an IntelliJ IDEA project file? + # + # JetBrains IDEs generate project files under an `.idea` directory + # that are sometimes checked into version control. + # + # Returns true or false. + def intellij_file? + !!name.match(/(?:^|\/)\.idea\//) + end # Internal: Is the blob part of Pods/, which contains dependencies not meant for humans in pull requests. # # Returns true or false. def cocoapods? @@ -442,22 +453,10 @@ return false unless lines.count > 2 # VCR Cassettes have "recorded_with: VCR" in the second last line. return lines[-2].include?("recorded_with: VCR") end - # Is this a Jest Snapshot? - # - # Jest Snapshots always start with: - # // Jest Snapshot v1 ... - # - # Returns true or false - def jest_snapshot? - return false unless extname == '.snap' - return false unless lines.count > 1 - return lines[0].include?("// Jest Snapshot ") - end - # Is this a generated ANTLR file? # # Returns true or false def generated_antlr? return false unless extname == '.g' @@ -481,9 +480,16 @@ # Internal: Is this a Pipenv lock file? # # Returns true or false. def pipenv_lock? !!name.match(/Pipfile\.lock/) + end + + # Internal: Is this a Terraform lock file? + # + # Returns true or false. + def terraform_lock? + !!name.match(/(?:^|\/)\.terraform\.lock\.hcl$/) end # Internal: Is it a KiCAD or GFortran module file? # # KiCAD module files contain: