Skip to content

Commit

Permalink
Convert to standardrb (#156)
Browse files Browse the repository at this point in the history
- I mostly don’t care about this, but there are a couple of things that
  Standard does that I disagree with. They are inherited from Rubocop,
  but Standard fixes many of Rubocop’s nonsense rules.

  - Array literal wrappers %i[], %w[], etc. are just ugly and never
    should have become any sort of standard. I would be happier if this
    part of standard were just completely disabled, because it‘s
    unnecessary and wrong.

  - Quote literals having to be %q() is equally wrong. I’ve avoided the
    issue here because the generated gemspec uses both "unnecessary"
    quote literals (it’s necessary if I say it’s necessary) and the
    wrong wrappers (I wouldn’t use %q<>, but this is generated code).

- I still think that short hashes can be `{ foo: "bar" }`, but I’m
  mostly using Elixir these days, so I don’t mind `%{foo: "bar"}`, so
  I can get used to it in Ruby. It still feels wrong, almost 20 years
  in.

- There are semantic differences between and / &&, or / ||, but in some
  cases the reformatted code is substantially _worse_ to read. Again,
  I mostly don’t _care_ about this difference, but Rubocop’s insistence
  is silly; these should only be replaced where there _is_ ambiguity.

  - Replacing `x = foo or next` should never be replaced with `(x = foo)
    || next`. That’s replacing something that is somewhat readable with
    something damned-near unreadable. Both should be replaced with:

    ```ruby
    x = foo
    next unless x
    ```

- YAML.safe_load works differently between Psych 2.x and Psych 3.x, so
  some updates have been made to make that work cleanly.

Overall, this introduces a lot of churn, but I think will be easier to
deal with updates to `standardrb` instead of the rapid churn that has
been Rubocop.
  • Loading branch information
halostatue authored Jun 2, 2021
1 parent b8db65a commit 6c8324d
Show file tree
Hide file tree
Showing 31 changed files with 825 additions and 911 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ publish
test/cache.tst
tmp/
.byebug_history
tags
94 changes: 0 additions & 94 deletions .rubocop.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parallel: true
ruby_version: 2.0
ignore:
- 'mime-types.gemspec'
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# NOTE: This file is present to keep Travis CI happy. Edits to it will not
# be accepted.

source 'https://rubygems.org/'
source "https://rubygems.org/"

gem 'mime-types-data', path: '../mime-types-data' if ENV['DEV']
gem "mime-types-data", path: "../mime-types-data" if ENV["DEV"]

gemspec

Expand Down
10 changes: 4 additions & 6 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[#150]. Removed Coveralls configuration.
- Igor Victor added TruffleRuby to the Travis CI configuration [#149].
- Koichi ITO loosened an excessively tight dependency [#147].
- Started using `standardrb` for Ruby formatting and validation.

## 3.3.1 / 2019-12-26

Expand All @@ -28,8 +29,7 @@

- Administrivia:

- Olle Jonsson removed an outdated Travis configuration option (`sudo:
false`). [#142]
- Olle Jonsson removed an outdated Travis configuration option (`sudo: false`). [#142]

## 3.3 / 2019-09-04

Expand Down Expand Up @@ -64,8 +64,7 @@
to be in the same family even if strict sorting would cause an
unregistered type to be sorted first. [#132]

- Dillon Welch contributed a change that added `frozen_string_literal:
true` to files so that modern Rubies can automatically reduce duplicate
- Dillon Welch contributed a change that added `frozen_string_literal: true` to files so that modern Rubies can automatically reduce duplicate
string allocations. [#135]

- 2 bug fixes
Expand Down Expand Up @@ -169,8 +168,7 @@
`x-` prefixes.

- Improved initialization with an Array works so that extensions do not
need to be wrapped in another array. This means that `%w(text/yaml yaml
yml)` works in the same way that `['text/yaml', %w(yaml yml)]` did (and
need to be wrapped in another array. This means that `%w(text/yaml yaml yml)` works in the same way that `['text/yaml', %w(yaml yml)]` did (and
still does).

- Changed `priority_compare` to conform with attributes that no longer
Expand Down
Loading

0 comments on commit 6c8324d

Please sign in to comment.