1. 05 Apr, 2020 3 commits
    • Reactors AnnotateModels.get_schema_info (#791) · da1e6052
      Troy Rosenberg authored
      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). 
    • Refactor AnnotateRoutes by adding AnnotateRoutes::HeaderGenerator (#790) · d89ddefa
      Shu Fujita authored
      I noticed that `AnnotateRoutes` can be more maintainable by refactoring.
      
      I am planning to refactor `AnnotateRoutes` in this order.
      *   separate logic of `AnnotateRoutes` into `AnnotateRoutes::HeaderGenerator`.
      *   add methods to `AnnotateRoutes::HeaderGenerator` and refactor methods.
      *   add `AnnotateRoutes::AnnotationProcessor` and `AnnotateRoutes::RemovalProcessor`
      
      The final goal of this refactoring is as follows.
      * https://github.com/nard-tech/annotate_models/blob/feature/refactor_annotate_routes/processors/lib/annotate/annotate_routes.rb
      * https://github.com/nard-tech/annotate_models/tree/feature/refactor_annotate_routes/processors/lib/annotate/annotate_routes
      
      So in the first I added `AnnotateRoutes::HeaderGenerator` in order to separate logic of `AnnotateRoutes` in this PR.
      
      When refactor of `AnnotateRoutes` is finished, I would like to refactor `AnnotateModels` in a like way.
    • Fix "undefined method `<'" error message (#774) · d9392d9e
      Erik Kessler authored
      ## Problem
      
      I have some files in the "models" directory that are not true a `Class`. For example, a [`dry-types`](https://dry-rb.org/gems/dry-types/1.2/sum/) sum type:
      
      ```ruby
      # app/models/foo.rb
      Foo = Types::String | Types::Integer
      ```
      
      This results in the following line when I annotate.
      
      ```
      Unable to annotate app/models/foo.rb: undefined method `<' for #<Dry::Struct::Sum:0x00007ff2dd262988>
      ```
      
      Not a blocking issue but somewhat annoying nonetheless.
      
      ## Solution
      
      When annotating a file, check that the file's object is a `Class` to ensure it has the interface we expect.
  2. 01 Apr, 2020 1 commit
    • Add integration test env var to CI (#788) · 8ecd0116
      Andrew W. Lee authored
      Integration tests were made conditional in #786 and so they stopped running in CI. This PR adds the `INTEGRATION_TESTS` environment variable to CI so that integration tests start running again.
  3. 31 Mar, 2020 1 commit
  4. 30 Mar, 2020 1 commit
    • Some project clean up (#786) · 1c1c5850
      Andrew W. Lee authored
      This PR does the following:
      * moves code coverage generation to happen when `COVERAGE` environment variable is present.
      * makes integration tests run when when `INTEGRATION_TESTS` is present.
      * moves `ruby-head` from TravisCI build. Previously the configuration allowed for `ruby-head` to be ignored if it failed, but it conflicted with the gem release build job step.
  5. 24 Mar, 2020 1 commit
  6. 09 Mar, 2020 4 commits
  7. 08 Mar, 2020 3 commits
  8. 01 Mar, 2020 4 commits
  9. 25 Feb, 2020 1 commit
  10. 22 Feb, 2020 1 commit
  11. 20 Feb, 2020 5 commits
  12. 17 Feb, 2020 1 commit
  13. 13 Feb, 2020 3 commits
  14. 11 Feb, 2020 1 commit
    • Add integration tests to project (#747) · ec0b3b61
      Andrew W. Lee authored
      Adds integration tests to the project that's able to run in CI across different ruby versions.
      
      * Adds a Rails 5.2.4.1 app
      * Adds a Rails 6.0.2.1 app
      
      Fixes #733 
  15. 06 Feb, 2020 1 commit
  16. 04 Feb, 2020 2 commits
  17. 03 Feb, 2020 1 commit
  18. 01 Feb, 2020 3 commits
  19. 27 Jan, 2020 3 commits