Skip to content

Commit 3796efb

Browse files
committed
Revert "Rubocop autocorrect unsafe offences"
This reverts commit 3db5af6. Because our unit tests assert that
1 parent 734736d commit 3796efb

10 files changed

+17
-7
lines changed

Diff for: .rubocop.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,8 @@ Rails/EnvironmentVariableAccess:
127127

128128
# Hrack::Server requires the `initialize` method
129129
Style/RedundantInitialize:
130-
Enabled: false
130+
Enabled: false
131+
132+
# Because our unit tests assert that
133+
Rails/RedundantPresenceValidationOnBelongsTo:
134+
Enabled: false

Diff for: app/models/github_comment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ class GithubComment < ActiveRecord::Base
66

77
## Validations
88
validates :github_id, presence: true
9-
validates :journal_id, uniqueness: { scope: :github_id }
9+
validates :journal_id, presence: true, uniqueness: { scope: :github_id }
1010
end

Diff for: app/models/github_issue.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ class GithubIssue < ActiveRecord::Base
66

77
## Validations
88
validates :github_id, presence: true
9-
validates :issue_id, uniqueness: { scope: :github_id }
9+
validates :issue_id, presence: true, uniqueness: { scope: :github_id }
1010
end

Diff for: app/models/gitolite_public_key.rb

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class GitolitePublicKey < ActiveRecord::Base
1616
has_many :repository_deployment_credentials, dependent: :destroy
1717

1818
## Validations
19+
validates :user_id, presence: true
1920

2021
validates :title, presence: true, uniqueness: { case_sensitive: false, scope: :user_id },
2122
length: { maximum: TITLE_LENGTH_LIMIT }, format: /\A[a-z0-9_\-]*\z/i

Diff for: app/models/repository_deployment_credential.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class RepositoryDeploymentCredential < ActiveRecord::Base
1515
belongs_to :user
1616

1717
## Validations
18-
validates :repository_id,
19-
uniqueness: { scope: :gitolite_public_key_id }
18+
validates :repository_id, presence: true,
19+
uniqueness: { scope: :gitolite_public_key_id }
2020

21-
validates :gitolite_public_key_id, exclusion: { in: [-1] }
21+
validates :gitolite_public_key_id, presence: true, exclusion: { in: [-1] }
22+
validates :user_id, presence: true
2223
validates :perm, presence: true,
2324
inclusion: { in: VALID_PERMS }
2425

Diff for: app/models/repository_git_config_key.rb

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class RepositoryGitConfigKey < ActiveRecord::Base
1010
belongs_to :repository
1111

1212
## Validations
13+
validates :repository_id, presence: true
1314
validates :type, presence: true, inclusion: { in: ['RepositoryGitConfigKey::GitConfig', 'RepositoryGitConfigKey::Option'] }
1415
validates :value, presence: true
1516

Diff for: app/models/repository_git_extra.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RepositoryGitExtra < ActiveRecord::Base
2525
belongs_to :repository
2626

2727
## Validations
28-
validates :repository_id, uniqueness: true
28+
validates :repository_id, presence: true, uniqueness: true
2929
validates :default_branch, presence: true
3030
validates :key, presence: true
3131
validates :notification_sender, format: { with: URI::MailTo::EMAIL_REGEXP, allow_blank: true }

Diff for: app/models/repository_mirror.rb

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class RepositoryMirror < ActiveRecord::Base
1515
belongs_to :repository
1616

1717
## Validations
18+
validates :repository_id, presence: true
1819

1920
## Only allow SSH format
2021
## ssh://[email protected]/project1/project2/project3/project4.git

Diff for: app/models/repository_post_receive_url.rb

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class RepositoryPostReceiveUrl < ActiveRecord::Base
1212
belongs_to :repository
1313

1414
## Validations
15+
validates :repository_id, presence: true
1516

1617
# Only allow HTTP(s) format
1718
validates :url, presence: true,

Diff for: app/models/repository_protected_branche.rb

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class RepositoryProtectedBranche < ActiveRecord::Base
1616
has_many :members, through: :protected_branches_members, source: :principal
1717

1818
## Validations
19+
validates :repository_id, presence: true
1920
validates :path, presence: true, uniqueness: { case_sensitive: true, scope: %i[permissions repository_id] }
2021
validates :permissions, presence: true, inclusion: { in: VALID_PERMS }
2122

0 commit comments

Comments
 (0)