ErrorsController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 66.67 %

Importance

Changes 0
Metric Value
dl 14
loc 21
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A not_found() 0 3 1
A unauthorized() 4 4 1
A internal_error() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
# frozen_string_literal: true
2
3
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4
#
5
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
6
#
7
# This program is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU Lesser General Public License as published by the Free Software
9
# Foundation; either version 3.0 of the License, or (at your option) any later
10
# version.
11
#
12
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
#
16
# You should have received a copy of the GNU Lesser General Public License along
17
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
19
class ErrorsController < ApplicationController
20
  def not_found
21
    render "greenlight_error", status: 404, formats: :html
22
  end
23
24 View Code Duplication
  def internal_error
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
25
    render "errors/greenlight_error", status: 500, formats: :html,
26
      locals: {
27
        status_code: 500,
28
        message: I18n.t("errors.internal.message"),
29
        help: I18n.t("errors.internal.help"),
30
        display_back: true,
31
        report_issue: true
32
      }
33
  end
34
35 View Code Duplication
  def unauthorized
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
36
    render "errors/greenlight_error", status: 401, formats: :html, locals: { status_code: 401,
37
      message: I18n.t("errors.unauthorized.message"), help: I18n.t("errors.unauthorized.help"), display_back: true }
38
  end
39
end
40