neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.4k stars 276 forks source link

Refactor HasnN#association_proxy #1547

Closed yourpalal closed 8 months ago

yourpalal commented 5 years ago

Clean up and comment the HashN#association_proxy method which was pretty convoluted. Functionally equivalent to #1530, so this is a style-only fix, once that PR has been merged.

Technically, this also fixes #1529, but there is another PR that fixes it with a smaller change (#1530)

yourpalal commented 5 years ago

BTW, CI failed due to rubocop issues:

Offenses:
lib/neo4j/active_node/has_n.rb:212:5: C: Metrics/AbcSize: Assignment Branch Condition size for association_proxy is too high. [18.06/18] (http://c2.com/cgi/wiki?AbcMetric)
    def association_proxy(name, options = {}) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/neo4j/active_node/has_n.rb:212:5: C: Metrics/MethodLength: Method has too many lines. [17/15] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    def association_proxy(name, options = {}) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2 lines too many and 0.06 too many ABC points :/ I guess splitting into 2 methods would do better?