Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: codeclimate/styleguide
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: codeclimate/styleguide
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: rubocop-block-delimiters-semantic
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Oct 1, 2020

  1. BlockDelimiters cop uses semantic style.

    The default option for Style/BlockDelimiters, `line_count_based`, simply
    counts the number of lines in the block to determine whether to use
    braces or do/end. These leads to superficial visual consistency, but
    actually contradicts the semantic rule, which says that the choice of
    braces vs do/end should depend on whether the block's purpose is
    functional or procedural, i.e. whether it returns a value or has side
    effects. When possible we should be using static analysis to enforce
    conventions around a programmer's intent, which is more critical
    information than how many lines a piece of code has.
    
    The `semantic` option, used here, is implemented with a relatively
    simple check to see if the return value of the block is assigned,
    receives a method call, or is the last thing inside of an outer scope
    that will thus return it. General consensus on the PR is that, although you
    can probably find some edge-cases that will lead to counterintuitive
    rule interpretations, this is a good-enough implementation.
    
    Implementing PR: rubocop/rubocop#1731
    Jim Weirich's initial request for the feature (RIP):
      rubocop/ruby-style-guide#162
    fhwang committed Oct 1, 2020
    Copy the full SHA
    e25dbce View commit details

This comparison is taking too long to generate.

Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.

You can try running this command locally to see the comparison on your machine:
git diff master...rubocop-block-delimiters-semantic