Maintenance: Rubocop uses custom inflections

This commit is contained in:
Mantas Masalskis 2021-10-01 11:56:09 +02:00 committed by Thorsten Eckel
parent 489177cca1
commit 9c5a11f36e
7 changed files with 13 additions and 5 deletions

View file

@ -6,6 +6,8 @@ require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-inflector
- ../config/initializers/inflections.rb
- ./rubocop_zammad.rb
inherit_from:

View file

@ -198,6 +198,7 @@ group :development, :test do
gem 'overcommit'
gem 'rubocop'
gem 'rubocop-faker'
gem 'rubocop-inflector'
gem 'rubocop-performance'
gem 'rubocop-rails'
gem 'rubocop-rspec'

View file

@ -512,6 +512,10 @@ GEM
rubocop-faker (1.1.0)
faker (>= 2.12.0)
rubocop (>= 0.82.0)
rubocop-inflector (0.1.1)
activesupport
rubocop
rubocop-rspec
rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
@ -729,6 +733,7 @@ DEPENDENCIES
rszr (= 0.5.2)
rubocop
rubocop-faker
rubocop-inflector
rubocop-performance
rubocop-rails
rubocop-rspec
@ -762,4 +767,4 @@ RUBY VERSION
ruby 2.7.4p191
BUNDLED WITH
2.2.20
2.2.27

View file

@ -21,7 +21,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
# Rails thinks the singularized version of knowledge_bases is knowledge_basis?!
# see: KnowledgeBase.table_name.singularize
inflect.singular(%r{(knowledge_base)s$}i, '\1')
inflect.irregular 'base', 'bases'
inflect.acronym 'SMIME'
inflect.acronym 'GitLab'
inflect.acronym 'GitHub'

View file

@ -4,7 +4,7 @@ class Issue2619KbHeaderLinkColor < ActiveRecord::Migration[6.0]
def up
return if !Setting.exists?(name: 'system_init_done')
add_column :knowledge_bases, :color_header_link, :string, limit: 25, null: false, default: 'hsl(206,8%,50%)' # rubocop:disable Zammad/ExistsResetColumnInformation
add_column :knowledge_bases, :color_header_link, :string, limit: 25, null: false, default: 'hsl(206,8%,50%)'
change_column_default :knowledge_bases, :color_header_link, nil
KnowledgeBase.reset_column_information
end

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe GitHub, type: :integration, required_envs: %w[GITHUB_ENDPOINT GITHUB_APITOKEN] do # rubocop:disable RSpec/FilePath
RSpec.describe GitHub, type: :integration, required_envs: %w[GITHUB_ENDPOINT GITHUB_APITOKEN] do
let(:instance) { described_class.new(ENV['GITHUB_ENDPOINT'], ENV['GITHUB_APITOKEN']) }
let(:issue_data) do

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe GitLab, type: :integration, required_envs: %w[GITLAB_ENDPOINT GITLAB_APITOKEN] do # rubocop:disable RSpec/FilePath
RSpec.describe GitLab, type: :integration, required_envs: %w[GITLAB_ENDPOINT GITLAB_APITOKEN] do
let(:instance) { described_class.new(ENV['GITLAB_ENDPOINT'], ENV['GITLAB_APITOKEN']) }
let(:issue_data) do