Hi everyone! I have a question about maintaining c...
# support
r
Hi everyone! I have a question about maintaining code style, because I didn't find any information in the guides and in search here. Just installed a fresh rails app and solidus with solidus_starter_frontend. Rubocop is saying that about 4k offenses are found with default config. I saw in the Gemfile that next dependencies were added:
Copy code
gem "rubocop", "~> 1.0"
gem "rubocop-performance", "~> 1.5"
gem "rubocop-rails", "~> 2.3"
gem "rubocop-rspec", "~> 2.0"
Enabling rubocop-rails and rubocop-rspec in the config produced even more offenses. But since the dependencies are added, I assume that I need to import a rubocop config from somewhere to follow your code style?
k
Good catch! I think Rubocop is not been yet considered for this project and I’m not sure who is adding those gems to the Gemfile. I think we should either remove them or fix the offenses. Is this something you would help contributing?
r
@kennyadsl I saw on one of the solidus repos the discussion about making a change to
standard
gem instead of maintaining the rubocop rules, but it was decided not to make that change now to avoid touching a lot of files just for formatting. Can't find it anymore unfortunately. As of now there are a lot of violations in the specs, because they contain a lot of context nesting, and more than 1 expectation in examples, which violates
rubocop-rspec
rules. And a bunch more not inside specs. I personally think that it would be better to not add these gems into Gemfile if they are not used in
solidus_starter_frontend
repo. And to copy some rubocop configuration file when installing
solidus_starter_frontend
template (because that almost always mean that it is a new project without custom configuration) to project root, that has the same rules used in
solidus_starter_frontend
, so rubocop command will not have failures after installation. And I think that would better be done from someone who has knowledge with
solidus_starter_frontend
and installer script. When it would be decided how to correctly implement code styling I can help with rewriting the existing code for new rules.
k
I recall that discussion, but it was more for the core. We have more flexibility with the starter because all files are used as a template and doesn’t really matter if it changes with time
BTW I agree with what you say but if someone wants to install rubocop or standard in their project we are demanding a huge effort to make things compatible
r
@kennyadsl If people want to use rubocop or standard with their set of rules it's their responsibility to make changes in violations. All I'm trying to say, that if rubocop is used in
solidus_starter_frontend
repo with some set of rules, they should be copied into project during installation, so people then could decide whether to continue using them or make changes based on their preference. Because as of now, there are no docs on code styling, and these gems are added to the Gemfile, but are not used in
solidus_starter_frontend
repo, so it's a bit confusing why they are added there. Initially I thought that I would need to search for some set of rules, but as I see in the repo itself
rubocop-rspec
and
rubocop-rails
are not used. I think it would be better to remove them during installation step and copy
solidus_starter_frontend
rubocop set of rules into project, because as I see there are some, at least on line size, so they would pass on initial installation. Maybe some mention in the README about code style would be helpful too.
k
this is probable the easiest change we can do now, and I’m ok going in this direction. But maybe people expect that we provide some code compatible with some standard coding style, and no matter if we install those gems, we should give some code that is in line with those expectations.