-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
feat: detect usage of env() function outside of config folder #1828
Conversation
99e48fd
to
1be6b05
Compare
Looks like tests are currently failing on |
Yes, the scheduled workflow also fails |
Hi, I think we can use Also I do not remember exactly now, but we might need to check that the function is actually coming from Laravel. Or at least that the function is in global namespace and not in Lastly, I'd prefer that it is disabled by default. |
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.
Laravel 9 has no useConfigPath
What's useConfigPath? |
A method called in this PR: tests/Rules/NoEnvCallsOutsideOfConfigRuleTest.php |
@szepeviktor should be fixed now, thanks for catching! |
Thank you! |
Closes #1695.
Changes
Hello!
This PR adds a rule to report any
env
calls outside the config directory. Currently it just checks for aconfig
directory in the file name where the call is located. A more robust solution might be to use the container to grab the configured config path? However this is more complicated and I wasn't sure how exactly to do such a thing.Thanks!