Skip to content

Commit

Permalink
Add detection of generated IntelliJ files (#5617)
Browse files Browse the repository at this point in the history
* Add detection of generated IntelliJ files

* Fix detection regex

Co-authored-by: John Gardner <gardnerjohng@gmail.com>

* Make documentation consistent

Co-authored-by: John Gardner <gardnerjohng@gmail.com>

Co-authored-by: John Gardner <gardnerjohng@gmail.com>
Co-authored-by: Colin Seymour <colin@github.com>
  • Loading branch information
3 people authored Nov 25, 2021
1 parent 68631fb commit 7c5e732
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def lines
# Return true or false
def generated?
xcode_file? ||
intellij_file? ||
cocoapods? ||
carthage_build? ||
generated_graphql_relay? ||
Expand Down Expand Up @@ -112,6 +113,16 @@ def generated?
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.
#
Expand Down

0 comments on commit 7c5e732

Please sign in to comment.