-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 compiled graphql relay to be considered generated #4118
Add compiled graphql relay to be considered generated #4118
Conversation
lib/linguist/generated.rb
Outdated
# | ||
# Return true or false | ||
def generated_graphql_relay_js? | ||
!!name.match(/__generated__\/[_A-Za-z][_0-9A-Za-z]+\.graphql\.js$/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we mark the whole __generated__
directory as generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going the safer route and only marking the files (.graphql.js
) I know relay-compiler is generating, but the directory name is __generated__
...
If you think that marking everything within any __generated__
directory is safe, I can make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the __generated__
directory created by relay-compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably mark the whole __generated__
directory as generated, but then I don't know much about GraphQL and it looks like you have some reservations about it. Anything specific that makes you think this could be "unsafe" (i.e., not the expected user behavior)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me. In a GraphQL relay project it is definitely safe to mark all files under the __generated__
directory as generated. I'm not sure about other languages/frameworks, and if they ever would use a __generated__
directory for some other purpose... yeah probably never...
One sec will make the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could see in the search results, it looks like it's not really used outside of GraphQL. Worst-case scenario, we'll reverse if we have users complaining :/
lib/linguist/generated.rb
Outdated
@@ -54,6 +54,7 @@ def generated? | |||
xcode_file? || | |||
cocoapods? || | |||
carthage_build? || | |||
generated_graphql_relay_js? || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove _js
at the end of the name, now that we're marking the whole directory as generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting the pull request and for the explanations @vkmita!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the PR and welcome to Linguist.
Marking
.graphql.js
files which are generated by GraphQL relay-compiler as generated.Checklist: