Skip to content

Add Rubocop to alert on empty lines between shared example blocks

Description of the proposal

Enforces furthering newlines rules after shared example blocks as seen below

        # bad
        RSpec.describe Foo do
          it_behaves_like 'do this first'
          it_behaves_like 'does this' do
          end
          it_behaves_like 'does that' do
          end
          it_behaves_like 'do some more'
        end

        # good
        RSpec.describe Foo do
          it_behaves_like 'do this first'
          it_behaves_like 'does this' do
          end

          it_behaves_like 'does that' do
          end

          it_behaves_like 'do some more'
        end

        # fair - it's ok to have non-separated without blocks
        RSpec.describe Foo do
          it_behaves_like 'do this first'
          it_behaves_like 'does this'
        end

Check-list

  • Make sure this MR enables a static analysis check rule for new usage but ignores current offenses
  • Mention this proposal in the relevant Slack channels (e.g. #development, #backend, #frontend)
  • The MR doesn't have significant objections, and is getting a majority of 👍 vs 👎 (remember that we don't need to reach a consensus)
  • Create a follow-up issue to fix the current offenses as a separate iteration: #217338
  • Follow the review process as usual
  • Once approved and merged by a maintainer, mention it again:
    • In the relevant Slack channels (e.g. #development, #backend, #frontend)
    • (Optional depending on the impact of the change) In the Engineering Week in Review

/label Engineering Productivity ~"Style decision" development guidelines ~"static analysis"

/cc @gitlab-org/maintainers/rails-backend

Closes #216271

Edited by Doug Stull

Merge request reports

Loading