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

Rubocop enforces different standards in the gem than in the frontend apps #2626

Open
danacotoran opened this issue Feb 15, 2022 · 0 comments · May be fixed by #4471
Open

Rubocop enforces different standards in the gem than in the frontend apps #2626

danacotoran opened this issue Feb 15, 2022 · 0 comments · May be fixed by #4471

Comments

@danacotoran
Copy link
Contributor

I suppose this one's more of a question/prompt for discussion than a proper issue.

Rubocop configuration is different in the gem than it is on the frontend apps:
govuk_publishing_components rubocop config
government-frontend rubocop config

This can pose a problem when components are moved from the gem to an individual application which is not uncommon (maybe the component used to be shared across different apps but is now being used by one app alone).

Because the Rubocop rules are stricter on the app level, it can force the developer to re-write some parts of the code completely, turning the simple operation of moving over some component files from govuk_publishing_components to any of the frontend apps into a real time sink.

Concrete example: most of the component helpers in the gem use instance variables. rubocop does not complain about this in the gem, but when you move the component from the gem to one of the frontend apps , rubocop raises a Rails/HelperInstanceVariable offense. Developer has to spend time reworking the component helper code to eliminate use of instance variables, which wouldn't need to happen if the code in the gem was written to the same standard as the code in the FE apps to begin with.

Should components gem rubocop be made stricter so that there is parity between the coding standards that are adhered to in the gem and the standards used in the other apps?

@jon-kirwan jon-kirwan linked a pull request Dec 3, 2024 that will close this issue
@jon-kirwan jon-kirwan linked a pull request Dec 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant