
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 topics

page 20: … protoc command…
I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New

This test is broken right out of the box…
— FAIL: TestAgent (7.82s)
agent_test.go:77:
Error Trace: agent_test.go:77
agent_test.go:...
New

The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New

On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New

This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New

I ran this command after installing the sample application:
$ cards add do something --owner Brian
And got a file not found error:
Fil...
New

Is the book’s epub format available to read on Google Play Books?
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

Title: Agile Web Development with Rails 7: (page 70)
I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
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

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

Do the test and post your score :nerd_face:
:keyboard:
If possible, please add info such as the keyboard you’re using, the layout (Qw...
New

Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New

“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco
Ever wonder how authoring books compares to writing articles?...
New

A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New

Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New

Large Language Models like ChatGPT say The Darnedest Things.
The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
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

This is a very quick guide, you just need to:
Download LM Studio: https://lmstudio.ai/
Click on search
Type DeepSeek, then select the o...
New
Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /textmate
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /julia
- /c
- /neovim