lib/linguist/generated.rb in github-linguist-6.1.0 vs lib/linguist/generated.rb in github-linguist-6.2.0

- old
+ new

@@ -52,16 +52,18 @@ # Return true or false def generated? xcode_file? || cocoapods? || carthage_build? || + generated_graphql_relay? || generated_net_designer_file? || generated_net_specflow_feature_file? || composer_lock? || cargo_lock? || node_modules? || go_vendor? || + go_lock? || npm_shrinkwrap_or_package_lock? || godeps? || generated_by_zephir? || minified_files? || has_source_map? || @@ -83,11 +85,12 @@ generated_jflex? || generated_grammarkit? || generated_roxygen2? || generated_jison? || generated_yarn_lock? || - generated_grpc_cpp? + generated_grpc_cpp? || + generated_perl_ppport_header? end # Internal: Is the blob an Xcode file? # # Generated if the file extension is an Xcode @@ -348,10 +351,17 @@ # Returns true or false. def go_vendor? !!name.match(/vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)/) end + # Internal: Is the blob a generated Go dep or glide lock file? + # + # Returns true or false. + def go_lock? + !!name.match(/(Gopkg|glide)\.lock/) + end + # Internal: Is the blob a generated npm shrinkwrap or package lock file? # # Returns true or false. def npm_shrinkwrap_or_package_lock? name.match(/npm-shrinkwrap\.json/) || name.match(/package-lock\.json/) @@ -530,8 +540,24 @@ # Return true or false def generated_grpc_cpp? return false unless %w{.cpp .hpp .h .cc}.include? extname return false unless lines.count > 1 return lines[0].start_with?("// Generated by the gRPC") + end + + # Internal: Is the file a generated Perl/Pollution/Portability header file? + # + # Returns true or false. + def generated_perl_ppport_header? + return false unless name.match(/ppport\.h$/) + return false unless lines.count > 10 + return lines[8].include?("Automatically created by Devel::PPPort") + end + + # Internal: Is this a relay-compiler generated graphql file? + # + # Return true or false + def generated_graphql_relay? + !!name.match(/__generated__\//) end end end