- 05 Apr, 2020 4 commits
-
-
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
-
- 03 Feb, 2020 1 commit
-
-
Masanori Ishiwata authored
-
- 01 Feb, 2020 3 commits
-
-
Andrew W. Lee authored
The integration tests were removed since they were outdated and not working. These are dead files so let's remove them. #725 #744
-
Andrew W. Lee authored
Helper methods were moved into Annotate::Helpers but instances in bin/annotate had not been updated. Because of this, bin/annotate would throw NoMethodError.
-
Andrew W. Lee authored
There's some left over files from #725, this change cleans up the remaining files in `spec/integration/`.
-
- 27 Jan, 2020 2 commits
-
-
Andrew W. Lee authored
`spec/integration` contains a lot of files that were used for integration tests. They stopped were [disabled in 2014](https://github.com/ctran/annotate_models/commit/9540121243da58cad3ab3c0ba444f22445a995ed#diff-78ddf877ecc2a9344997ef077a77955a) and haven't been working since. Removing because those tests don't run, don't work, and are outdated. The plan is to re-introduce integration tests sometime in the future.
-
Shu Fujita authored
# Summary * Removed unnecessary variables * Renamed variables that have same name as reserved word (`p`) * Other tiny fixes
-