-
Notifications
You must be signed in to change notification settings - Fork 21
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
Applications do not follow component conventions #3369
Comments
There's an interesting inconsistency in We use two different systems for tests - RSpec and Minitest, and which directory the test should go in is related to the system. |
I was having a quick look at this issue and how we can try to avoid using incorrect file names in the future. When I followed the documentation to Create a new component in the application, I ran the command below to generate a new component: rails generate govuk_publishing_components:component new_component_name However, the file name for the component view template included hyphens instead of underscores. government-frontend % rails generate govuk_publishing_components:component new_component_name
create app/views/components/_new-component-name.html.erb
create app/views/components/docs/new-component-name.yml
create app/assets/stylesheets/components/_new-component-name.scss This could also be worth looking into further, but might be beyond the scope of this issue. |
I'm doing a bit of a spike into making the component auditing report on components within applications, prompted by recent conversations. Turns out that our naming and file location conventions for components within the gem aren't always being followed by applications. Here's some (very) initial investigations.
For component templates:
_component_name.html.erb
app/views/govuk_publishing_components/components/
_component-name.html.erb
app/views/components/
_component-name.html.erb
app/views/components/
For component test files:
component_name_spec.rb
spec/components/
component_name.html.erb_spec.rb
spec/views/components/
component_name_spec.rb
spec/components/
This inconsistency is going to make auditing components in applications difficult, as we'd have to include specific details of all of these things on a per-application basis within the auditing. I'll have a look at whether applications could be restructured slightly instead.
The text was updated successfully, but these errors were encountered: