Skip to content
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

Detect references to ENV outside of config directories #71

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rzane
Copy link
Contributor

@rzane rzane commented Jan 29, 2025

This cop will report references to ENV in files outside of the config directory.

The idea is that applications should extract variables from the ENV at boot time, and fail if those variables are not valid.

@rzane rzane marked this pull request as ready for review January 29, 2025 13:19
@smudge smudge requested a review from 6f6d6172 February 6, 2025 16:19
@6f6d6172
Copy link
Contributor

6f6d6172 commented Feb 6, 2025

woaow this is a great idea! gonna take a peek 🙂

6f6d6172
6f6d6172 previously approved these changes Feb 6, 2025
Copy link
Contributor

@6f6d6172 6f6d6172 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain lgtm, it all looks straightforward to me. only thing I would consider is a more precise name over Betterment/Environment, but I don't feel strongly enough about it to block.

what's your plan to roll this out? we use ENV in a lot of places, in models and controllers and their specs, etc

@rzane
Copy link
Contributor Author

rzane commented Feb 6, 2025

The plan is to:

  1. Record existing violations in the TODO file
  2. Prevent new violations from being introduced.
  3. Fix existing violations over time.

Copy link
Member

@smudge smudge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platform LGTM - pending naming choice raised by @6f6d6172.

README.md Outdated
@@ -130,6 +130,27 @@ end
```

All three `params.permit` calls will be flagged.

### Betterment/Environment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Betterment/Environment
### Betterment/EnvironmentConfiguration

If you're looking for a slightly more descriptive name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants