Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a NameError in AugeasTree#replace_entry #28

Merged
merged 7 commits into from
Jun 21, 2019

Conversation

mvidner
Copy link
Contributor

@mvidner mvidner commented Jun 7, 2019

I found this bug with Sorbet static analysis, and it seems none of the library users exercise this unusual code path.
So I am not sure whether to make a Bugzilla entry for this and release it right away. See also #6 "Do not try to merge changes"

@coveralls
Copy link

coveralls commented Jun 7, 2019

Coverage Status

Coverage increased (+3.2%) to 96.409% when pulling ba6b822 on nameerror-replaceentry into b5e62c4 on master.

@mvidner
Copy link
Contributor Author

mvidner commented Jun 7, 2019

The build failure is new RuboCop complaining, about "Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true." all over the place, related to its dropping support for Ruby 2.2.

https://github.com/rubocop-hq/rubocop/blob/c2047b71a68d079533ebe9b3766a5ed80b7f8a42/relnotes/v0.69.0.md#L23
https://github.com/rubocop-hq/rubocop/blob/5ffddbb92926122a4f3fc1bf8ae29d5be31d481f/lib/rubocop/cop/style/frozen_string_literal_comment.rb#L42

@jreidinger
Copy link
Contributor

@mvidner regarding that rubocop rule. There is basically two options:

  1. disable it
  2. drop from travis ruby 2.2, add it everywhere and fix all problems that it brings ( as I think not all code expect frozen strings everywhere )

https://www.ruby-lang.org/en/news/2019/03/31/support-of-ruby-2-3-has-ended/

The reason is that new RuboCop, which we use, also drops it,
which affects the default cop config, which we need to adjust to.

> The build failure is new RuboCop complaining, about "Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true." all over the place, related to its dropping support for Ruby 2.2.
>
> https://github.com/rubocop-hq/rubocop/blob/c2047b71a68d079533ebe9b3766a5ed80b7f8a42/relnotes/v0.69.0.md#L23
> https://github.com/rubocop-hq/rubocop/blob/5ffddbb92926122a4f3fc1bf8ae29d5be31d481f/lib/rubocop/cop/style/frozen_string_literal_comment.rb#L42
- it pleases RuboCop
- prepares for Ruby 3
- is more efficient
```console
$ srb
lib/cfa/augeas_parser.rb:327: Method key does not exist on CFA::AugeasTree https://sorbet.org/docs/error-reference#7003
     327 |        @data.delete_if { |d| d[:key] == key }
                                                   ^^^
Errors: 1
```

See also https://sorbet.org/
undefined local variable or method `key' for #<CFA::AugeasTree:0x0000000002005c10>
@mvidner mvidner merged commit ba6b822 into master Jun 21, 2019
@mvidner mvidner deleted the nameerror-replaceentry branch June 21, 2019 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants