Reactors AnnotateModels.get_schema_info (#791)
This is a bit of a cheat of a refactoring that simply extracts the logic for collecting a column's attributes out of `get_schema_info` and into its own method (`get_attributes`).
I found that in PRs like #779 that the Rubocop ABC limit was being exceeded:
```
lib/annotate/annotate_models.rb:235:5: C: Metrics/AbcSize: Assignment Branch Condition size for get_schema_info is too high. [145/145]
def get_schema_info(klass, header, options = {}) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Hopefully, this should break this up and reduce the complexity of the method.
There are opportunities to go further, but I thought this could be a good place to start.
I would be open and interested in discussing further refactoring opportunities if it would make sense (maybe creating some new classes to encapsulate some of this logic).
Showing
Please
register
or
sign in
to comment