fga-gpp-mds/2017.1-OndeE-UnB

View on GitHub

Showing 364 of 364 total issues

Block has too many lines. [30/25]
Open

    namespace :cucumber do
      Cucumber::Rake::Task.new({ ok: 'test:prepare' }, 'Run features that should pass') do |t|
        t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
        t.fork = true # You may get faster startup if you set this to false
        t.profile = 'default'
Severity: Minor
Found in darcyWeb/lib/tasks/cucumber.rake by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if ("origin" in data) {
    FormObj.origin.val(data.origin);
    FormObj.originText.val(data.origin);
  }
Severity: Minor
Found in darcyWeb/app/assets/javascripts/map/routes/index.js and 1 other location - About 40 mins to fix
darcyWeb/app/assets/javascripts/map/routes/index.js on lines 242..245

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if ("destination" in data) {
    FormObj.destination.val(data.destination);
    FormObj.destinationText.val(data.destination);
  }
Severity: Minor
Found in darcyWeb/app/assets/javascripts/map/routes/index.js and 1 other location - About 40 mins to fix
darcyWeb/app/assets/javascripts/map/routes/index.js on lines 238..241

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method valid_schedule_and_room? has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def valid_schedule_and_room?(day_of_week, start_time, end_time, room, classroom)
Severity: Minor
Found in darcyWeb/app/controllers/parser_controller.rb - About 35 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        FormObj.destination.parent().find("button").on("click", function() {
          getLocation("destination");
        });
    Severity: Minor
    Found in darcyWeb/app/assets/javascripts/map/routes/index.js and 1 other location - About 35 mins to fix
    darcyWeb/app/assets/javascripts/map/routes/index.js on lines 158..160

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        FormObj.origin.parent().find("button").on("click", function() {
          getLocation("origin");
        });
    Severity: Minor
    Found in darcyWeb/app/assets/javascripts/map/routes/index.js and 1 other location - About 35 mins to fix
    darcyWeb/app/assets/javascripts/map/routes/index.js on lines 163..165

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Block has too many lines. [27/25]
    Open

          schedules_rows.each do |schedule_row|
            if schedule_row.content.include? 'Total'
              classroom = schedule_row.at_css('td[1] b')
              schedule_row.css('td[4] div').each do |schedule|
                day_of_week = schedule.at_css('b')

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Function copyToClipboard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function copyToClipboard(text) {
      if (window.clipboardData && window.clipboardData.setData) {
        // IE specific code path to prevent textarea being shown while dialog is visible.
        return clipboardData.setData("Text", text);
    
    
    Severity: Minor
    Found in darcyWeb/app/assets/javascripts/map/share_location.js - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Block has too many lines. [26/25]
    Open

        features.each do |feature|
    
          title = ''
          description = ''
          image = ''

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Function translateRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function translateRoute(input) {
      var originalInstr = input;
    
      var translatedInstr = originalInstr;
      for (var englishInstr in routesTranslations) {
    Severity: Minor
    Found in darcyWeb/app/assets/javascripts/map/routes/translations.js - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Put empty method definitions on a single line.
    Open

      def index
      end

    This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

    Note: A method definition is not considered empty if it contains comments.

    Example: EnforcedStyle: compact (default)

    # bad
    def foo(bar)
    end
    
    def self.foo(bar)
    end
    
    # good
    def foo(bar); end
    
    def foo(bar)
      # baz
    end
    
    def self.foo(bar); end

    Example: EnforcedStyle: expanded

    # bad
    def foo(bar); end
    
    def self.foo(bar); end
    
    # good
    def foo(bar)
    end
    
    def self.foo(bar)
    end

    Use %i or %I for an array of symbols.
    Open

      before_action :set_plans, only: [:destroy, :edit, :update]

    This cop can check for array literals made up of symbols that are not using the %i() syntax.

    Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %i[foo bar baz]
    
    # bad
    [:foo, :bar, :baz]

    Example: EnforcedStyle: brackets

    # good
    [:foo, :bar, :baz]
    
    # bad
    %i[foo bar baz]

    Line is too long. [157/100]
    Open

        Schedule.where(room: room, day_of_week: params[:day_of_week], start_time: params[:start_time], end_time: params[:end_time]).first_or_create do |schedule|

    Use next to skip iteration.
    Open

                if valid_schedule_and_room?(day_of_week, start_time, end_time, room, classroom)

    Use next to skip iteration instead of a condition at the end.

    Example: EnforcedStyle: skipmodifierifs (default)

    # bad
    [1, 2].each do |a|
      if a == 1
        puts a
      end
    end
    
    # good
    [1, 2].each do |a|
      next unless a == 1
      puts a
    end
    
    # good
    [1, 2].each do |o|
      puts o unless o == 1
    end

    Example: EnforcedStyle: always

    # With `always` all conditions at the end of an iteration needs to be
    # replaced by next - with `skip_modifier_ifs` the modifier if like
    # this one are ignored: `[1, 2].each { |a| return 'yes' if a == 1 }`
    
    # bad
    [1, 2].each do |o|
      puts o unless o == 1
    end
    
    # bad
    [1, 2].each do |a|
      if a == 1
        puts a
      end
    end
    
    # good
    [1, 2].each do |a|
      next unless a == 1
      puts a
    end

    Extra empty line detected at block body beginning.
    Open

    
          title = ''

    This cops checks if empty lines around the bodies of blocks match the configuration.

    Example: EnforcedStyle: empty_lines

    # good
    
    foo do |bar|
    
      # ...
    
    end

    Example: EnforcedStyle: noemptylines (default)

    # good
    
    foo do |bar|
      # ...
    end

    Unused method argument - resource. If it's necessary, use _ or _resource as an argument name to indicate that it won't be used. You can also write as after_update_path_for(*) if you want the method to accept any arguments but don't care about them.
    Open

      def after_update_path_for(resource)

    This cop checks for unused method arguments.

    Example:

    # bad
    
    def some_method(used, unused, _unused_but_allowed)
      puts used
    end

    Example:

    # good
    
    def some_method(used, _unused, _unused_but_allowed)
      puts used
    end

    Line is too long. [102/100]
    Open

        params.require(:point).permit(:title, :type_point, :description, :latitude, :longitude, :geo_data)

    Use %i or %I for an array of symbols.
    Open

      before_action :set_room_types, :set_plans, only: [:new, :edit, :update, :create]

    This cop can check for array literals made up of symbols that are not using the %i() syntax.

    Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %i[foo bar baz]
    
    # bad
    [:foo, :bar, :baz]

    Example: EnforcedStyle: brackets

    # good
    [:foo, :bar, :baz]
    
    # bad
    %i[foo bar baz]

    Align the parameters of a method call if they span more than one line.
    Open

          notice: helpers.alert_success('Administrador criado com êxito.')

    Here we check if the parameters on a multi-line method call or definition are aligned.

    Example: EnforcedStyle: withfirstparameter (default)

    # good
    
    foo :bar,
        :baz
    
    # bad
    
    foo :bar,
      :baz

    Example: EnforcedStyle: withfixedindentation

    # good
    
    foo :bar,
      :baz
    
    # bad
    
    foo :bar,
        :baz

    Unnecessary spacing detected.
    Open

                },  {

    This cop checks for extra/unnecessary whitespace.

    Example:

    # good if AllowForAlignment is true
    name      = "RuboCop"
    # Some comment and an empty line
    
    website  += "/bbatsov/rubocop" unless cond
    puts        "rubocop"          if     debug
    
    # bad for any configuration
    set_app("RuboCop")
    website  = "https://github.com/bbatsov/rubocop"
    Severity
    Category
    Status
    Source
    Language