From f5aef868144534d620ad1e2812258e12b1b9a956 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Sat, 9 Nov 2024 09:56:11 +0100 Subject: [PATCH] Switch to a maintained fork of annotate --- .annotaterb.yml | 58 +++++++++++++++++++++++++ Gemfile | 2 +- Gemfile.lock | 6 +-- app/models/coder.rb | 6 ++- app/models/commit.rb | 20 ++++++--- app/models/git_identity.rb | 13 +++++- app/models/organisation_member.rb | 6 ++- app/models/repository.rb | 10 +++-- lib/tasks/annotate_rb.rake | 8 ++++ test/fixtures/coders.yml | 6 ++- test/fixtures/commits.yml | 20 ++++++--- test/fixtures/git_identities.yml | 13 +++++- test/fixtures/organisation_members.yml | 6 ++- test/fixtures/repositories.yml | 10 +++-- test/models/coder_test.rb | 6 ++- test/models/commit_test.rb | 20 ++++++--- test/models/git_identity_test.rb | 13 +++++- test/models/organisation_member_test.rb | 6 ++- test/models/repository_test.rb | 10 +++-- 19 files changed, 198 insertions(+), 41 deletions(-) create mode 100644 .annotaterb.yml create mode 100644 lib/tasks/annotate_rb.rake diff --git a/.annotaterb.yml b/.annotaterb.yml new file mode 100644 index 0000000..2811be7 --- /dev/null +++ b/.annotaterb.yml @@ -0,0 +1,58 @@ +--- +:position: before +:position_in_additional_file_patterns: before +:position_in_class: before +:position_in_factory: before +:position_in_fixture: before +:position_in_routes: before +:position_in_serializer: before +:position_in_test: before +:classified_sort: true +:exclude_controllers: true +:exclude_factories: false +:exclude_fixtures: false +:exclude_helpers: true +:exclude_scaffolds: true +:exclude_serializers: false +:exclude_sti_subclasses: false +:exclude_tests: false +:force: false +:format_markdown: false +:format_rdoc: false +:format_yard: false +:frozen: false +:ignore_model_sub_dir: false +:ignore_unknown_models: false +:include_version: false +:show_check_constraints: false +:show_complete_foreign_keys: false +:show_foreign_keys: true +:show_indexes: true +:simple_indexes: false +:sort: false +:timestamp: false +:trace: false +:with_comment: true +:with_column_comments: true +:with_table_comments: true +:active_admin: false +:command: +:debug: false +:hide_default_column_types: '' +:hide_limit_column_types: '' +:ignore_columns: +:ignore_routes: +:models: true +:routes: false +:skip_on_db_migrate: false +:target_action: :do_annotations +:wrapper: +:wrapper_close: +:wrapper_open: +:classes_default_to_s: [] +:additional_file_patterns: [] +:model_dir: +- app/models +:require: [] +:root_dir: +- '' diff --git a/Gemfile b/Gemfile index 9d9130b..e69276a 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ group :development, :test do end group :development do - gem 'annotate', '~> 3.2', require: false + gem 'annotaterb', '~> 4.13', require: false gem 'brakeman', require: false gem 'rubocop-minitest', '~> 0.36.0', require: false gem 'rubocop-rails', '~> 2.27', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 2ab0a93..3590b10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,9 +74,7 @@ GEM tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) + annotaterb (4.13.0) ast (2.4.2) base64 (0.2.0) benchmark (0.3.0) @@ -326,7 +324,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - annotate (~> 3.2) + annotaterb (~> 4.13) bootsnap brakeman capybara diff --git a/app/models/coder.rb b/app/models/coder.rb index ff4f85a..c566af5 100644 --- a/app/models/coder.rb +++ b/app/models/coder.rb @@ -3,13 +3,17 @@ # Table name: coders # # id :bigint not null, primary key +# avatar_url :string not null # full_name :string not null # github_name :string not null -# avatar_url :string not null # github_url :string not null # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_coders_on_github_name (github_name) UNIQUE +# class Coder < ApplicationRecord has_many :commits, dependent: :restrict_with_error has_many :repositories, -> { distinct }, through: :commits diff --git a/app/models/commit.rb b/app/models/commit.rb index 00f3198..b05a184 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -3,15 +3,25 @@ # Table name: commits # # id :bigint not null, primary key -# coder_id :bigint not null -# repository_id :bigint not null -# sha :string not null # additions :integer not null -# deletions :integer not null # committed_at :datetime not null +# deletions :integer not null +# score :integer +# sha :string not null # created_at :datetime not null # updated_at :datetime not null -# score :integer +# coder_id :bigint not null +# repository_id :bigint not null +# +# Indexes +# +# index_commits_on_coder_id (coder_id) +# index_commits_on_repository_id (repository_id) +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) +# fk_rails_... (repository_id => repositories.id) # class Commit < ApplicationRecord belongs_to :coder, validate: true diff --git a/app/models/git_identity.rb b/app/models/git_identity.rb index e5ea01c..c986c97 100644 --- a/app/models/git_identity.rb +++ b/app/models/git_identity.rb @@ -3,11 +3,20 @@ # Table name: git_identities # # id :bigint not null, primary key -# name :string not null # email :string not null -# coder_id :bigint not null +# name :string not null # created_at :datetime not null # updated_at :datetime not null +# coder_id :bigint not null +# +# Indexes +# +# index_git_identities_on_coder_id (coder_id) +# index_git_identities_on_name_and_email (name,email) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) # class GitIdentity < ApplicationRecord belongs_to :coder, validate: true diff --git a/app/models/organisation_member.rb b/app/models/organisation_member.rb index ac365e4..20a86bc 100644 --- a/app/models/organisation_member.rb +++ b/app/models/organisation_member.rb @@ -3,8 +3,12 @@ # Table name: organisation_members # # id :bigint not null, primary key -# organisation :string not null # github_name :string not null +# organisation :string not null +# +# Indexes +# +# index_organisation_members_on_organisation_and_github_name (organisation,github_name) UNIQUE # class OrganisationMember < ApplicationRecord validates :github_name, uniqueness: { scope: :organisation } diff --git a/app/models/repository.rb b/app/models/repository.rb index 8a1e371..b34dcda 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -3,13 +3,17 @@ # Table name: repositories # # id :bigint not null, primary key +# clone_url :string not null +# github_url :string not null # name :string not null +# organisation :string not null # path :string not null -# github_url :string not null -# clone_url :string not null # created_at :datetime not null # updated_at :datetime not null -# organisation :string not null +# +# Indexes +# +# index_repositories_on_organisation_and_name (organisation,name) UNIQUE # class Repository < ApplicationRecord has_many :commits, dependent: :restrict_with_error diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake new file mode 100644 index 0000000..2c54aa3 --- /dev/null +++ b/lib/tasks/annotate_rb.rake @@ -0,0 +1,8 @@ +# This rake task was added by annotate_rb gem. + +# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this +if Rails.env.development? && ENV['ANNOTATERB_SKIP_ON_DB_TASKS'].nil? + require 'annotate_rb' + + AnnotateRb::Core.load_rake_tasks +end diff --git a/test/fixtures/coders.yml b/test/fixtures/coders.yml index 6b9099e..8ca0aec 100644 --- a/test/fixtures/coders.yml +++ b/test/fixtures/coders.yml @@ -3,13 +3,17 @@ # Table name: coders # # id :bigint not null, primary key +# avatar_url :string not null # full_name :string not null # github_name :string not null -# avatar_url :string not null # github_url :string not null # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_coders_on_github_name (github_name) UNIQUE +# one: full_name: Charlotte Van Petegem diff --git a/test/fixtures/commits.yml b/test/fixtures/commits.yml index 0ff0d29..01a4091 100644 --- a/test/fixtures/commits.yml +++ b/test/fixtures/commits.yml @@ -3,15 +3,25 @@ # Table name: commits # # id :bigint not null, primary key -# coder_id :bigint not null -# repository_id :bigint not null -# sha :string not null # additions :integer not null -# deletions :integer not null # committed_at :datetime not null +# deletions :integer not null +# score :integer +# sha :string not null # created_at :datetime not null # updated_at :datetime not null -# score :integer +# coder_id :bigint not null +# repository_id :bigint not null +# +# Indexes +# +# index_commits_on_coder_id (coder_id) +# index_commits_on_repository_id (repository_id) +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) +# fk_rails_... (repository_id => repositories.id) # one: diff --git a/test/fixtures/git_identities.yml b/test/fixtures/git_identities.yml index aae9053..a991730 100644 --- a/test/fixtures/git_identities.yml +++ b/test/fixtures/git_identities.yml @@ -3,11 +3,20 @@ # Table name: git_identities # # id :bigint not null, primary key -# name :string not null # email :string not null -# coder_id :bigint not null +# name :string not null # created_at :datetime not null # updated_at :datetime not null +# coder_id :bigint not null +# +# Indexes +# +# index_git_identities_on_coder_id (coder_id) +# index_git_identities_on_name_and_email (name,email) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) # one: diff --git a/test/fixtures/organisation_members.yml b/test/fixtures/organisation_members.yml index b54916c..05ea17b 100644 --- a/test/fixtures/organisation_members.yml +++ b/test/fixtures/organisation_members.yml @@ -3,8 +3,12 @@ # Table name: organisation_members # # id :bigint not null, primary key -# organisation :string not null # github_name :string not null +# organisation :string not null +# +# Indexes +# +# index_organisation_members_on_organisation_and_github_name (organisation,github_name) UNIQUE # one: diff --git a/test/fixtures/repositories.yml b/test/fixtures/repositories.yml index 10dce21..5d47d9e 100644 --- a/test/fixtures/repositories.yml +++ b/test/fixtures/repositories.yml @@ -3,13 +3,17 @@ # Table name: repositories # # id :bigint not null, primary key +# clone_url :string not null +# github_url :string not null # name :string not null +# organisation :string not null # path :string not null -# github_url :string not null -# clone_url :string not null # created_at :datetime not null # updated_at :datetime not null -# organisation :string not null +# +# Indexes +# +# index_repositories_on_organisation_and_name (organisation,name) UNIQUE # one: diff --git a/test/models/coder_test.rb b/test/models/coder_test.rb index 72d0c0b..e347b77 100644 --- a/test/models/coder_test.rb +++ b/test/models/coder_test.rb @@ -3,13 +3,17 @@ # Table name: coders # # id :bigint not null, primary key +# avatar_url :string not null # full_name :string not null # github_name :string not null -# avatar_url :string not null # github_url :string not null # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_coders_on_github_name (github_name) UNIQUE +# require 'test_helper' class CoderTest < ActiveSupport::TestCase diff --git a/test/models/commit_test.rb b/test/models/commit_test.rb index 5b68a6a..74e954e 100644 --- a/test/models/commit_test.rb +++ b/test/models/commit_test.rb @@ -3,15 +3,25 @@ # Table name: commits # # id :bigint not null, primary key -# coder_id :bigint not null -# repository_id :bigint not null -# sha :string not null # additions :integer not null -# deletions :integer not null # committed_at :datetime not null +# deletions :integer not null +# score :integer +# sha :string not null # created_at :datetime not null # updated_at :datetime not null -# score :integer +# coder_id :bigint not null +# repository_id :bigint not null +# +# Indexes +# +# index_commits_on_coder_id (coder_id) +# index_commits_on_repository_id (repository_id) +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) +# fk_rails_... (repository_id => repositories.id) # require 'test_helper' diff --git a/test/models/git_identity_test.rb b/test/models/git_identity_test.rb index d5dc4b2..c7f51ef 100644 --- a/test/models/git_identity_test.rb +++ b/test/models/git_identity_test.rb @@ -3,11 +3,20 @@ # Table name: git_identities # # id :bigint not null, primary key -# name :string not null # email :string not null -# coder_id :bigint not null +# name :string not null # created_at :datetime not null # updated_at :datetime not null +# coder_id :bigint not null +# +# Indexes +# +# index_git_identities_on_coder_id (coder_id) +# index_git_identities_on_name_and_email (name,email) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (coder_id => coders.id) # require 'test_helper' diff --git a/test/models/organisation_member_test.rb b/test/models/organisation_member_test.rb index 0b7fee4..1ae4abb 100644 --- a/test/models/organisation_member_test.rb +++ b/test/models/organisation_member_test.rb @@ -3,8 +3,12 @@ # Table name: organisation_members # # id :bigint not null, primary key -# organisation :string not null # github_name :string not null +# organisation :string not null +# +# Indexes +# +# index_organisation_members_on_organisation_and_github_name (organisation,github_name) UNIQUE # require 'test_helper' diff --git a/test/models/repository_test.rb b/test/models/repository_test.rb index 810f452..f92cdd6 100644 --- a/test/models/repository_test.rb +++ b/test/models/repository_test.rb @@ -3,13 +3,17 @@ # Table name: repositories # # id :bigint not null, primary key +# clone_url :string not null +# github_url :string not null # name :string not null +# organisation :string not null # path :string not null -# github_url :string not null -# clone_url :string not null # created_at :datetime not null # updated_at :datetime not null -# organisation :string not null +# +# Indexes +# +# index_repositories_on_organisation_and_name (organisation,name) UNIQUE # require 'test_helper'