Add rubocop to travis
This commit is contained in:
20
.rubocop.yml
20
.rubocop.yml
@@ -9,30 +9,12 @@ AllCops:
|
||||
TargetRubyVersion: 2.3
|
||||
TargetRailsVersion: 5.2
|
||||
|
||||
Metrics/AbcSize:
|
||||
Metrics:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ClassLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 20
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 140
|
||||
|
||||
Metrics/MethodLength:
|
||||
Max: 60
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 25
|
||||
|
||||
Rails/ApplicationJob:
|
||||
Enabled: false
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ before_install:
|
||||
- git clone $REDMINE_GIT_REPO $REDMINE_PATH
|
||||
- cd $REDMINE_PATH
|
||||
- if [[ "$REDMINE_VER" != "master" ]]; then git checkout -b $REDMINE_VER origin/$REDMINE_VER; fi
|
||||
- if [[ "$REDMINE_VER" != "master" ]]; then cp $TRAVIS_BUILD_DIR/test/support/Gemfile.local $REDMINE_PATH; fi
|
||||
- ln -s $TRAVIS_BUILD_DIR $REDMINE_PATH/plugins/$PLUGIN_NAME
|
||||
- cp $TRAVIS_BUILD_DIR/test/support/additional_environment.rb $REDMINE_PATH/config/
|
||||
- cp $TRAVIS_BUILD_DIR/test/support/database-$DB-travis.yml $REDMINE_PATH/config/database.yml
|
||||
@@ -43,4 +44,5 @@ before_script:
|
||||
|
||||
script:
|
||||
- export SKIP_COVERAGE=1
|
||||
- if [[ "$REDMINE_VER" != "master" ]] && [[ "$DB" == "postgresql" ]]; then rubocop plugins/$PLUGIN_NAME; fi
|
||||
- bundle exec rake redmine:plugins:test NAME=$PLUGIN_NAME RUBYOPT="-W0"
|
||||
|
||||
@@ -158,9 +158,9 @@ class Messenger
|
||||
escape = true
|
||||
|
||||
if detail.property == 'cf'
|
||||
key = CustomField.find(detail.prop_key).name rescue nil
|
||||
key = CustomField.find(detail.prop_key)&.name
|
||||
title = key
|
||||
field_format = CustomField.find(detail.prop_key).field_format rescue nil
|
||||
field_format = CustomField.find(detail.prop_key)&.field_format
|
||||
elsif detail.property == 'attachment'
|
||||
key = 'attachment'
|
||||
title = I18n.t :label_attachment
|
||||
|
||||
@@ -11,7 +11,8 @@ module RedmineMessenger
|
||||
return unless channels.present? && url && issue.changes.any? && Messenger.setting_for_project(issue.project, :post_updates)
|
||||
return if issue.is_private? && !Messenger.setting_for_project(issue.project, :post_private_issues)
|
||||
|
||||
msg = "[#{Messenger.markup_format(issue.project)}] #{Messenger.markup_format(journal.user.to_s)} updated <#{Messenger.object_url issue}|#{Messenger.markup_format(issue)}>"
|
||||
msg = "[#{Messenger.markup_format(issue.project)}]" \
|
||||
" #{Messenger.markup_format(journal.user.to_s)} updated <#{Messenger.object_url issue}|#{Messenger.markup_format(issue)}>"
|
||||
|
||||
repository = changeset.repository
|
||||
|
||||
@@ -43,7 +44,9 @@ module RedmineMessenger
|
||||
end
|
||||
|
||||
attachment = {}
|
||||
attachment[:text] = ll(Setting.default_language, :text_status_changed_by_changeset, "<#{revision_url}|#{Messenger.markup_format(changeset.comments)}>")
|
||||
attachment[:text] = ll(Setting.default_language,
|
||||
:text_status_changed_by_changeset,
|
||||
"<#{revision_url}|#{Messenger.markup_format(changeset.comments)}>")
|
||||
attachment[:fields] = journal.details.map { |d| Messenger.detail_to_field d }
|
||||
|
||||
Messenger.speak(msg, channels, url, attachment: attachment, project: repository.project)
|
||||
|
||||
3
test/support/Gemfile.local
Normal file
3
test/support/Gemfile.local
Normal file
@@ -0,0 +1,3 @@
|
||||
gem 'rubocop', require: false
|
||||
gem 'rubocop-performance', require: false
|
||||
gem 'rubocop-rails', require: false
|
||||
Reference in New Issue
Block a user