korolvs/thatsaboy

View on GitHub
api/app/infrastructure/core/filter/error_renderer.rb

Summary

Maintainability
A
0 mins
Test Coverage

Assignment Branch Condition size for around is too high. [26/15]
Open

    def around(controller)
      @controller = controller
      yield
    rescue Core::Errors::BadRequest => e
      render 400, JSON.generate(error: e.message || 'Bad Request')

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [16/10]
Open

    def around(controller)
      @controller = controller
      yield
    rescue Core::Errors::BadRequest => e
      render 400, JSON.generate(error: e.message || 'Bad Request')

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for around is too high. [7/6]
Open

    def around(controller)
      @controller = controller
      yield
    rescue Core::Errors::BadRequest => e
      render 400, JSON.generate(error: e.message || 'Bad Request')

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

There are no issues that match your filters.

Category
Status