
BernardK
Programming Ruby 3.2 (5th Edition): B2.0 page 355, autocorrection needs two passes
page 355, paragraph 3, line 2 :
figuration or by running rubocop -a to auto correct (which will fix all but the first issue).
-----> ^^^
This seems correct looking at the report :
% rubocop
Inspecting 13 files
..C...C......
...
13 files inspected, 4 offenses detected, 3 offenses auto-correctable
but is not fully true. In fact rubocop -a
finds three new offenses in spec.metadata
, corrects them but corrects only two of the three offenses declared previously as auto-correctable (aaagmnr.gemspec:5:1
, 14:32
, but not options.rb:11:26
), saying "1 more offense can be corrected with `rubocop -A` " :
% rubocop -a
Inspecting 13 files
..C...C......
Offenses:
aaagmnr.gemspec:5:1: C: [Corrected] Gemspec/RequireMFA: metadata['rubygems_mfa_required'] must be set to 'true'.
Gem::Specification.new do |spec| ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
aaagmnr.gemspec:14:32: C: Gemspec/RequiredRubyVersion: required_ruby_version and TargetRubyVersion (3.2, which may be specified in .rubocop.yml) should be equal.
spec.required_ruby_version = ">= 2.6.0"
^^^^^^^^^^
aaagmnr.gemspec:33:42: C: [Corrected] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
spec.add_dependency "date_by_example", '~> 0.1'
^^^^^^^^
aaagmnr.gemspec:34:1: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
spec.metadata['rubygems_mfa_required'] = 'true'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
aaagmnr.gemspec:34:15: C: [Corrected] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
spec.metadata['rubygems_mfa_required'] = 'true'
^^^^^^^^^^^^^^^^^^^^^^^
aaagmnr.gemspec:34:42: C: [Corrected] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
spec.metadata['rubygems_mfa_required'] = 'true'
^^^^^^
lib/aaagmnr/options.rb:11:26: C: [Correctable] Style/MutableConstant: Freeze mutable objects assigned to constants.
DEFAULT_DICTIONARY = "/usr/share/dict/words"
^^^^^^^^^^^^^^^^^^^^^^^
13 files inspected, 7 offenses detected, 5 offenses corrected, 1 more offense can be corrected with `rubocop -A`
A second pass with -A
% rubocop -A
Inspecting 13 files
..C...C......
Offenses:
aaagmnr.gemspec:14:32: C: Gemspec/RequiredRubyVersion: required_ruby_version and TargetRubyVersion (3.2, which may be specified in .rubocop.yml) should be equal.
spec.required_ruby_version = ">= 2.6.0"
^^^^^^^^^^
lib/aaagmnr/options.rb:11:26: C: [Corrected] Style/MutableConstant: Freeze mutable objects assigned to constants.
DEFAULT_DICTIONARY = "/usr/share/dict/words"
^^^^^^^^^^^^^^^^^^^^^^^
13 files inspected, 2 offenses detected, 1 offense corrected
has corrected options.rb
by adding freeze
:
DEFAULT_DICTIONARY = "/usr/share/dict/words".freeze
First Post!

noelrappin
Author of Modern Front-End Development for Rails
Okay that’s true, and I’ve cleaned up the text to better reflect the reality.
Popular Pragmatic Bookshelf topics

The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New

Title: Hands-On Rust (Chapter 11: prefab)
Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New

I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps.
With:
ruby-3.0.0
s...
New

When I run the coverage example to report on missing lines, I get:
pytest --cov=cards --report=term-missing ch7
ERROR: usage: pytest [op...
New

When installing Cards as an editable package, I get the following error:
ERROR: File “setup.py” not found. Directory cannot be installe...
New

When trying to run tox in parallel as explained on page 151, I got the following error:
tox: error: argument -p/–parallel: expected one...
New

Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New

AWDWR 7, page 152, page 153:
Hello everyone,
I’m a little bit lost on the hotwire part. I didn’t fully understand it.
On page 152 @rub...
New

I am using Android Studio Chipmunk | 2021.2.1 Patch 2
Build #AI-212.5712.43.2112.8815526, built on July 10, 2022
Runtime version: 11.0....
New

Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
Other popular topics

I’ve been really enjoying obsidian.md:
It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New

Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New

I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
New

Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New

The V Programming Language
Simple language for building maintainable programs
V is already mentioned couple of times in the forum, but I...
New

API 4
Path:
/user/following/
Method:
GET
Description:
Returns the list of all names of people whom the user follows
Response
[
{ ...
New

Author Spotlight
Rebecca Skinner
@RebeccaSkinner
Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
New

If you’re getting errors like this:
psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /django
- /manjaro
- /spring
- /diversity
- /lua
- /nodejs
- /slackware
- /julia
- /c
- /neovim