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).
Name |
Last commit
|
Last update |
---|---|---|
.github | Loading commit data... | |
bin | Loading commit data... | |
lib | Loading commit data... | |
spec | Loading commit data... | |
.dockerignore | Loading commit data... | |
.document | Loading commit data... | |
.gitignore | Loading commit data... | |
.overcommit.yml | Loading commit data... | |
.rbenv-gemsets | Loading commit data... | |
.rspec | Loading commit data... | |
.rubocop.yml | Loading commit data... | |
.rubocop_todo.yml | Loading commit data... | |
.travis.yml | Loading commit data... | |
.yardopts | Loading commit data... | |
AUTHORS.md | Loading commit data... | |
CHANGELOG.md | Loading commit data... | |
Gemfile | Loading commit data... | |
Guardfile | Loading commit data... | |
LICENSE.txt | Loading commit data... | |
README.md | Loading commit data... | |
RELEASE.md | Loading commit data... | |
Rakefile | Loading commit data... | |
annotate.gemspec | Loading commit data... | |
potato.md | Loading commit data... |