- 09 May, 2020 1 commit
-
-
Viktor Fonic authored
This is an addition to this PR: https://github.com/ctran/annotate_models/pull/692 I've seen it's been stale for a while and it's rather simple fix. I noticed my ActiveAdmin resources are not being annotated. I know ActiveAdmin uses plural model names, but, as far as I remember, they used to use singular model names in the past. We can see some "evidence" of that here: https://activeadmin.info/2-resource-customization.html#customizing-parent-menu-items Probably in other places as well. In order to keep the gem working as expected for singular ActiveAdmin resources, I suggest we annotate both singular and plural model names. I just tested this out in a project of mine where I renamed one file to be in singular form and left the other files in plural form. It worked like a charm. :)
-
- 08 May, 2020 1 commit
-
-
ethanbresler authored
Currently, the models annotator automatically attempts to find a class with a matching name at the bottom of project's directory tree before going up into specific engine's models. This causes issues with models that share names with classes in other engines or lower classes in the project's directory. This PR adds the option to skip attempts to load classes from lower directories and just uses the model's file path directly. #674
-
- 07 May, 2020 1 commit
-
-
Olle Jonsson authored
Allow people easier access the source code, raise issues and read the changelog, by adding [project metadata](https://guides.rubygems.org/specification-reference/#metadata) to the gemspec file. These links will appear on the RubyGems page at https://rubygems.org/gems/annotate and be available via the RubyGems API – after the next release. Also: used https in URLs.
-
- 06 Apr, 2020 2 commits
-
-
Shu Fujita authored
AnnotateModels is fat and so hard to maintain. In order to reduce code lines of AnnotateModels, move constants and methods defined in AnnotateModels to another namespace AnnotateModels::FilePatterns.
-
Henrik Nyh authored
-
- 05 Apr, 2020 5 commits
-
-
Shu Fujita authored
cf. #790 In order to refactor `AnnoateRoutes`, I added methods to `AnnotateRoutes::HeaderGenerator` and refactor methods. I will add `AnnotateRoutes::AnnotationProcessor` and `AnnotateRoutes::RemovalProcessor` in next PR.
-
Troy Rosenberg authored
Closes #778 If a column comment includes the newline character, the newline character would be "printed" into the annotation block resulting in a line break and an uncommented line. For example, for the following table: ``` create_table "users", force: :cascade do |t| t.string "name", comment: "This is a comment.\nWith two lines!" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end ``` annotating the model with the `--with-comment` flag will result in: ``` \# == Schema Information \# \# Table name: users \# \# id :bigint not null, primary key \# name(This is a comment. With two lines!) :string \# created_at :datetime not null \# updated_at :datetime not null \# ``` This uncommented line would result in invalid Ruby and cause the file to no longer be valid. This fix replaces the newline character with an escaped version, so the output will look more like: ``` \# == Schema Information \# \# Table name: users \# \# id :bigint not null, primary key \# name(This is a comment.\nWith two lines!):string \# created_at :datetime not null \# updated_at :datetime not null \# ```
-
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).
-
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.
-
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.
-
- 01 Apr, 2020 1 commit
-
-
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.
-
- 31 Mar, 2020 1 commit
-
-
Andrew W. Lee authored
Add integration test that calls on rails generator.
-
- 30 Mar, 2020 1 commit
-
-
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.
-
- 24 Mar, 2020 1 commit
-
-
Andrew W. Lee authored
In https://travis-ci.org/github/ctran/annotate_models/builds/659982898/config?utm_medium=notification&utm_source=github_status it looks like `travis.yml` is not valid and seems the `matrix` portion seems to be overwriting `jobs`, which is used to release the gem. This config is valid. I used `travis lint .travis.yml` to validate locally.
-
- 09 Mar, 2020 4 commits
-
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
- 08 Mar, 2020 3 commits
-
-
Shu Fujita authored
For further refactoring toward better architecture, I moved methods `.strip_annotations`, `.extract_magic_comments_from_array` and `.real_content_and_header_position` from `AnnotateRoutes` to `AnnotateRoutes::Helpers`.
-
Andrew W. Lee authored
In #764, it was pointed out that the gemspec requires ruby version `>= 2.2.0`. We've stopped testing for older versions of Ruby in CI and so it makes sense to make it explicit.
-
Andrew W. Lee authored
It was reported in https://github.com/ctran/annotate_models/issues/762 that column defaults were broken. This reverts changes made in #677 to restore the expected behavior of column defaults. For the time being columns with associated enums won't be working.
-
- 01 Mar, 2020 4 commits
-
-
dependabot[bot] authored
Bumps [puma](https://github.com/puma/puma) from 4.3.1 to 4.3.3. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v4.3.1...v4.3.3) Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [puma](https://github.com/puma/puma) from 3.12.2 to 4.3.3. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v3.12.2...v4.3.3) Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.7 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.7...v1.10.8) Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.7 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.7...v1.10.8) Signed-off-by: dependabot[bot] <support@github.com>
-
- 25 Feb, 2020 1 commit
-
-
Shu Fujita authored
This is the final completed version of refactoring AnnotateRoutes.
-
- 22 Feb, 2020 1 commit
-
-
Henrik Nyh authored
-
- 20 Feb, 2020 5 commits
-
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
Andrew W. Lee authored
-
- 17 Feb, 2020 1 commit
-
-
Ryan authored
* Fix new lines after comments for rubocop compatability Fix #552, #607
-
- 13 Feb, 2020 3 commits
-
-
Shu Fujita authored
The test cases of AnnotateModels.get_schema_info was separated into two sections. So I merged them into one, and refactor test cases. This PR is new version of #741.
-
Ryan authored
-
Shu Fujita authored
Refactor test cases for entire rewrite in the future.
-
- 11 Feb, 2020 1 commit
-
-
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
-
- 06 Feb, 2020 1 commit
-
-
Shu Fujita authored
Refactor of test cases for AnnotateRoutes.remove_annotations after #736.
-
- 04 Feb, 2020 2 commits
-
-
Shu Fujita authored
Refactor test cases for AnnotateModels.get_schema_info with Globalize gem
-
Daisuke Murakami authored
* Fixed CHANGELOG.md to add link to each PR * Fixed link to markdown format
-