summaryrefslogtreecommitdiff
path: root/.rubocop_todo.yml
Commit message (Collapse)AuthorAgeFilesLines
* Add hash slice using IndifferentAccess.kenner kliemann2020-10-031-5/+5
|
* Change rubocop to allow 100 character lines.Bobby McDonald2019-10-171-6/+0
| | | | | For accessibility reasons, we should limit our lines to 100 chars max. https://github.com/slack-ruby/slack-ruby-client/pull/293#discussion_r309472083
* Allow mash error silencing (#488)Bobby McDonald2019-10-141-2/+8
|
* Make Hashie play nice with Rails 6 Hash#except method (#479)Bobby McDonald2019-10-021-5/+0
|
* Implement non-destructive hash methodsBobby McDonald2019-08-141-3/+3
| | | | | | | | | | | | | | | When calling the following non-destructive hash methods: :compact :invert :reject :select :slice :transform_keys :transform_values we would be returned an instance of a standard Hash rather than a Mash (or subclass). This changes that behavior to instead return an instance of the class the method was called on.
* Add selective key-conflict warnings for Mash subclasses (#478)Bobby McDonald2019-07-181-2/+2
| | | | | | | | | | | In some cases, you want to be able to ignore Mash warnings for keys that you know you aren't going to access via a method accessor, yet be warned for other keys that you know you might want to access. This change adds the ability to selectively ignore warnings for specific keys instead of globally ignoring the warnings. The change retains the original behavior as well, so if you call `Mash.disable_warnings` without a value it will still globally ignore the warnings.
* Allow options on Mash.load (#474)Daniel Doubrovkine (dB.) @dblockdotorg2019-03-221-3/+3
| | | | | | | | | | | | | | | | | `Mash.load` uses the Ruby standard library to load Yaml-serialized files into a Mash. The original implementation used `YAML.load` for this purpose. However, that method is inherently unsafe so we switched to using `YAML.safe_load`. Safely loading Yaml files has many different domain-specific configuration flags that we did not, by default, expose. This change introduces the ability to configure the safe loading of Yaml files so that all types of Yaml can be loaded when necessary using the flags from the standard library. This implementation preserves the backwards-compatibility with the prior implementation so that it should not require updates from users of the current `Mash.load` behavior. For those who this change affects, we included upgrading documentation to ease the transition.
* Add Hashie::Extensions::Mash::DefineAccessors.Vladimir Kochnev2019-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch adds an extension for Mash that makes it behave like `OpenStruct`. It reduces overhead of `method_missing?` magic which is a good thing! It's inspired by the recent @sferik's work on `OpenStruct` — https://github.com/ruby/ruby/pull/1033. When using it in `Mash` subclasses it makes them *remember* methods so then it's more like `ActiveModel` than `OpenStruct` in this case. To use it like `OpenStruct` one could use this shortcut: ```ruby { foo: 1, bar: 2 }.to_mash.with_accessors! ``` Implementation details: It injects to class an anonymous module that stores accessor method definitions. This is inspired by `ActiveModel` / `ActiveRecord`. It allows to override accessors in subclass and call them via `super` if this is intended.
* [rubocop] Improve our RuboCop setupMichael Herold2018-09-301-28/+6
| | | | | | | | | | | Disable Metrics/BlockLength in specs because the length of a block in the test suite isn't something we want to lint. We want the tests to be as long as they need to be. Set an explicit line length metric instead of continually updating this as we go. Let's pick a max line length that we want to see and stick with it. This metric should only ever decrease: we don't want to see it ever increase again.
* Update Rubocop todoMichael Herold2018-08-141-3/+3
|
* Make Dash greedier when creating gettersMichael Herold2018-08-111-7/+6
| | | | | | | | | | | | | | | | | | Dash, in its current form, was created to be very conservative in creating the getters for its properties. It only creates them when the accompanying setter has not already been created. This means that the property translation capability that is layered on top of Dash to create a Trash cannot have dependence between properties in an order-independent way. This change makes it so Dash now greedily creates a getter method for each property. To ensure that we don't do this more than once for a given Dash class, we track the getters we have previously created. This keeps the number of warnings from Ruby down to the same number of warnings that were emitted prior to this change. Given that Dash users expect the getter to be set, this doesn't feel like it should cause any backwards-compatibility issues.
* Update Rubocop and address the addressable todosMichael Herold2018-06-171-32/+19
| | | | | | | | | | | | | | | | | | | | | This is a big step forward in our Rubocop setup. I addressed all of the todos from the current version of Rubocop that made sense to. The only things that remain are metrics and one cop that relies on the line length metric to work. I made some judgment calls on disabling a few cops: 1. The `Layout/IndentHeredoc` cop wants you to either use the squiggly heredoc from Ruby 2.3 or introduce a library. Since we are a low-level library that is used as a transitive dependency, we cannot introduce another library as a dependence, so that option is out. Also, we support Rubies back to 2.0 currently, so using the squiggly heredoc isn't an option. Once we remove support for Rubies older than 2.3, we can switch to the squiggly heredoc cop. 2. The `Naming/FileName` cop was reporting false positives for a few files in the repository, so I disabled it on those files. 3. The `Style/DoubleNegation` cop reports lints on a few cases where we use double negation. Given the very generic nature of Hashie, the double-negation is the easiest, clearest way to express that we want an item to be a Boolean. I disabled the cop because we exist in the gray area where this makes sense.
* Ensure IndifferentAccess is injected after mergeMichael Herold2018-02-051-2/+7
| | | | | | | | During non-destructive merges (i.e. `#merge`), the `IndifferentAccess` mixin was failing to inject itself into the resulting Hash. This caused a `NoMethodError` to be thrown when attempting to perform the action. Now, we properly inject the mixin when necessary so the `#merge` method works.
* Don't log when overwriting Mash keysMichael Herold2017-02-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we switched to using `#respond_to?` to detecting whether to log a Mash collision, we started reporting when we were overwriting keys that already exist in the Mash. This is a poor experience because it causes extra warnings (as in #414) or, in the worst case, causes an "undefined method" error (as in #413). This change fixes that problem and benchmarks to ensure we're not appreciably regressing performance. The results of two benchmarks are below: ``` bundle exec ruby benchmark/mash_method_access.rb: Warming up -------------------------------------- before 92.456k i/100ms Calculating ------------------------------------- before 1.290M (± 4.4%) i/s - 6.472M in 5.028183s Pausing here -- run Ruby again to measure the next benchmark... Warming up -------------------------------------- after 92.941k i/100ms Calculating ------------------------------------- after 1.326M (± 5.4%) i/s - 6.692M in 5.060756s Comparison: after: 1326239.2 i/s before: 1289624.0 i/s - same-ish: difference falls within error ``` and ``` within spec/integrations/omniauth, bundle exec rake perf:ips Warming up -------------------------------------- before 1.260k i/100ms Calculating ------------------------------------- before 13.114k (± 4.2%) i/s - 66.780k in 5.101689s Pausing here -- run Ruby again to measure the next benchmark... Warming up -------------------------------------- after 1.299k i/100ms Calculating ------------------------------------- after 13.149k (± 4.0%) i/s - 66.249k in 5.046630s Comparison: after: 13148.9 i/s before: 13113.8 i/s - same-ish: difference falls within error ``` Closes #413 Closes #414
* Add an extension to maintain original Mash keys (#326)Michael Herold2017-02-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | One of the behaviors of Mash that we see regularly surprise users is that Mash stringifies any keys passed into it. This leads to unexpected lack of synergy between Mash and its cousins (particularly Dash), since the property DSLs do not handle indifferent key access. This extension ensures that the original keys are kept inside the Mash's data structure, at the expense of more costly logic for fetching information indifferently. I have included a benchmark that compares the two. The benchmark shows that when you are passing string keys into a Mash, using this extension will actually be _faster_ than the default implementation, but that the reverse is true when passing symbol keys. In #296, I tried to do this universally for all Mashes, which slowed down the fetching behavior for Mash significantly. I like this attempt much better because it allows users to opt into the new behavior if they want it, while still keeping the default implementation as-is. Fixes #196 by giving the option of keeping the original structure of the Mash when using it with Dash. Fixes #246 by giving the option of opting into keeping the original keys. Closes #296 by giving a more flexible path forward that doesn't change the semantics of the main Mash class.
* Carry over disabling warnings to subclassesMichael Herold2017-02-101-12/+5
|
* Allow Mash subclasses to disable warningsMichael Herold2017-02-041-9/+9
| | | | | | | | | | | | | | | | | Since we are transitively used as a dependency in many projects, we should have given the ability to toggle this behavior off. The logging feature is more of a "help people get started with Mash" feature. If you're using Hashie in a library, it's likely that you already know the tradeoffs of attempting to override methods on the object. To use this feature, you only have to subclass Mash and then call the class method: ```ruby class KeyStore < Hashie::Mash disable_warnings end ```
* Add a logging layer to address common issues (#381)Michael Herold2016-11-021-1/+1
|
* Fix support for Array#digjonathan schatz2016-06-011-7/+7
|
* Convert Mash keys for #digTakashi Kokubun2016-02-081-1/+1
|
* Fix: broken cop, for now disabling hash syntax check.dblock2015-10-251-1/+7
|
* Upgraded to RuboCop 0.34.2.dblock2015-10-251-13/+33
|
* Add Hashie::Mash#reverse_merge. Increase Rubocop class length.Max Goldstein2015-02-251-1/+1
| | | | Fixes intridea/hashie#270
* add Hashie::Mash#extractable_options?Ryan Buckley2015-01-191-1/+1
|
* Upgraded RuboCop to 0.28.0.dblock2014-12-301-8/+8
|
* Locked version of RuboCop.dblock2014-11-181-0/+45