Skip to content

Commit

Permalink
Merge pull request #2533 from DavidKang/indent_array
Browse files Browse the repository at this point in the history
[ci] Enable Style/IndentArray
  • Loading branch information
ChrisBr committed Jan 9, 2017
2 parents baa2876 + 6b66e30 commit 919f034
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 36 deletions.
4 changes: 4 additions & 0 deletions src/api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Style/HashSyntax:
Style/IfInsideElse:
Enabled: true

# Checks the indentation of the first element in an array
Style/IndentArray:
Enabled: true

# Checks the indentation of the first line of the right-hand-side of a multi-line assignment.
Style/IndentAssignment:
Enabled: true
Expand Down
12 changes: 0 additions & 12 deletions src/api/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -501,18 +501,6 @@ Style/IdenticalConditionalBranches:
Style/IfUnlessModifier:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Style/IndentArray:
Exclude:
- 'app/controllers/statistics_controller.rb'
- 'app/models/user.rb'
- 'app/models/user_ldap_strategy.rb'
- 'config/initializers/hoptoad.rb'
- 'test/unit/package_test.rb'

# Offense count: 40
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/controllers/statistics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class StatisticsController < ApplicationController
validate_action redirect_stats: {method: :get, response: :redirect_stats}

before_action :get_limit, only: [
:highest_rated, :most_active_packages, :most_active_projects, :latest_added, :latest_updated,
:latest_built, :download_counter
:highest_rated, :most_active_packages, :most_active_projects, :latest_added, :latest_updated,
:latest_built, :download_counter
]

def index
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,8 @@ def user_relevant_packages_for_status
packages = Package.joins("LEFT OUTER JOIN relationships ON (relationships.package_id = packages.id AND relationships.role_id = #{role_id})")
# No maintainers
packages = packages.where([
'(relationships.user_id = ?) OR '\
'(relationships.user_id is null AND packages.project_id in (?) )', id, projects_ids])
'(relationships.user_id = ?) OR '\
'(relationships.user_id is null AND packages.project_id in (?) )', id, projects_ids])
packages.pluck(:id)
end

Expand Down
12 changes: 6 additions & 6 deletions src/api/app/models/user_ldap_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def self.update_entry_ldap(login, newlogin, newemail, newpassword)

# Update mail/password info
entry = [
LDAP.mod(LDAP::LDAP_MOD_REPLACE, CONFIG['ldap_mail_attr'], [newemail])
LDAP.mod(LDAP::LDAP_MOD_REPLACE, CONFIG['ldap_mail_attr'], [newemail])
]
if newpassword
case CONFIG['ldap_auth_mech']
Expand Down Expand Up @@ -112,10 +112,10 @@ def self.new_entry_ldap(login, password, mail)
ldap_password = "{MD5}" + Base64.b64encode(Digest::MD5.digest(password)).chomp
end
entry = [
LDAP.mod(LDAP::LDAP_MOD_ADD, 'objectclass', CONFIG['ldap_object_class']),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_name_attr'], [login]),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_auth_attr'], [ldap_password]),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_mail_attr'], [mail])
LDAP.mod(LDAP::LDAP_MOD_ADD, 'objectclass', CONFIG['ldap_object_class']),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_name_attr'], [login]),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_auth_attr'], [ldap_password]),
LDAP.mod(LDAP::LDAP_MOD_ADD, CONFIG['ldap_mail_attr'], [mail])
]
# Added required sn attr
if CONFIG.has_key('ldap_sn_attr_required') && CONFIG['ldap_sn_attr_required'] == :on
Expand Down Expand Up @@ -327,7 +327,7 @@ def self.change_password_ldap(login, password)
ldap_password = "{MD5}" + Base64.b64encode(Digest::MD5.digest(password)).chomp
end
entry = [
LDAP.mod(LDAP::LDAP_MOD_REPLACE, CONFIG['ldap_auth_attr'], [ldap_password])
LDAP.mod(LDAP::LDAP_MOD_REPLACE, CONFIG['ldap_auth_attr'], [ldap_password])
]
begin
ldap_con.modify(dn, entry)
Expand Down
22 changes: 11 additions & 11 deletions src/api/config/initializers/hoptoad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
end

config.ignore_only = %w{
ActiveRecord::RecordNotFound
ActionController::InvalidAuthenticityToken
CGI::Session::CookieStore::TamperedWithCookie
ActionController::UnknownAction
AbstractController::ActionNotFound
ActionView::MissingTemplate
Timeout::Error
Net::HTTPBadResponse
WebuiMatcher::InvalidRequestFormat
ActionController::UnknownFormat
ActivXML::Transport::NotFoundError
ActiveRecord::RecordNotFound
ActionController::InvalidAuthenticityToken
CGI::Session::CookieStore::TamperedWithCookie
ActionController::UnknownAction
AbstractController::ActionNotFound
ActionView::MissingTemplate
Timeout::Error
Net::HTTPBadResponse
WebuiMatcher::InvalidRequestFormat
ActionController::UnknownFormat
ActiveXML::Transport::NotFoundError
}

config.ignore_by_filter do |exception_data|
Expand Down
6 changes: 3 additions & 3 deletions src/api/test/unit/package_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def test_activity

test 'is_binary_file?' do
file_paths = [
'/tmp/some/file',
'/srv/www/another_file_',
'/var/lib/cache/file with spaces'
'/tmp/some/file',
'/srv/www/another_file_',
'/var/lib/cache/file with spaces'
]

filename = ''
Expand Down

0 comments on commit 919f034

Please sign in to comment.