gitshowcase/gitshowcase

View on GitHub

Showing 883 of 883 total issues

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

  create_table "users", force: :cascade do |t|
    t.string   "email",                                           default: "",  null: false
    t.string   "encrypted_password",                              default: "",  null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
Severity: Minor
Found in db/schema.rb 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.

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

  def change
    add_column :users, :name, :string
    add_column :users, :username, :string
    add_column :users, :avatar, :string
    add_column :users, :cover, :string

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

Assignment Branch Condition size for set_user is too high. [24.41/15]
Open

  def set_user
    if params[:username]
      @user = User.find_by_username params[:username].downcase
    else
      @user = User.find_by_domain UrlHelper.extract(request.host)

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

Assignment Branch Condition size for sync is too high. [24.78/15]
Open

  def sync(data = nil)
    raise "Project ##{@project.id} - #{@project.title} does not have a repository to sync" unless @project.repository.present?

    repository = UrlHelper.extract(@project.repository, 'github.com/')
    data = client.repository(repository) if data.nil?

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

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

  context 'enabled' do
    before { allow(DomainService).to receive(:enabled?).and_return(true) }

    context 'without app domain' do
      describe '#initialize' do

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.

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

    authenticated :user do
      # Dashboard
      namespace :dashboard do
        controller :users do
          get '/', action: :home, as: :home
Severity: Minor
Found in config/routes.rb 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.

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

RSpec.describe ProjectInspectorService, type: :service do
  describe '#sync' do
    subject(:service) { ProjectInspectorService.new(project) }

    context 'without homepage' do

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.

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

    context 'with github' do
      let(:user) { FactoryGirl.create(:user, github_uid: 'uid', github_token: 'token') }

      it 'changes attributes' do
        github_user = double(

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.

Assignment Branch Condition size for sync is too high. [20.86/15]
Open

  def sync
    raise "Project ##{@project.id} - #{@project.title} does not have a homepage to sync" unless @project.homepage.present?

    params = {connection_timeout: 5, read_timeout: 3, retries: 0, download_images: false}
    page = MetaInspector.new(@project.homepage, params) rescue nil

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. [15/10]
Open

  def change
    create_table :cities do |t|
      t.references :state, foreign_key: true
      t.references :country, foreign_key: true, null: false
      t.references :timezone, foreign_key: true, null: false

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.

Assignment Branch Condition size for reset is too high. [20/15]
Open

  def reset
    set(:name, @user.name)
    set(:bio, @user.bio)
    set(:role, @user.role)
    set(:location, @user.location)

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. [15/10]
Open

  def change
    create_table :users do |t|
      ## Database authenticatable
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

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.

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

  def create
    @project = Project.new(project_params)
    @project.user_id = current_user.id
    @project.position = 0

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.

Assignment Branch Condition size for create is too high. [19.47/15]
Open

  def create
    @project = Project.new(project_params)
    @project.user_id = current_user.id
    @project.position = 0

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

Cyclomatic complexity for index is too high. [9/6]
Open

  def index
    @levels = levels = User::CompletenessService::LEVELS.keys
    @search_fields = SEARCH_FIELDS

    query = User.order('id DESC')

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.

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

  def set(field, value)
    field = field.to_sym

    field = :socials if User::SOCIALS.key?(field)
    return unless FIELDS.key? field

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.

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

  def sync(data = nil)
    raise "Project ##{@project.id} - #{@project.title} does not have a repository to sync" unless @project.repository.present?

    repository = UrlHelper.extract(@project.repository, 'github.com/')
    data = client.repository(repository) if data.nil?

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.

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

  describe '#sync' do
    subject(:service) { GithubProjectService.new(project) }

    context 'without repository' do
      let(:project) { FactoryGirl.build(:project, repository: '', title: 'title', id: 0) }

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.

Perceived complexity for index is too high. [9/7]
Open

  def index
    @levels = levels = User::CompletenessService::LEVELS.keys
    @search_fields = SEARCH_FIELDS

    query = User.order('id DESC')

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

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

  def update_domain
    old_domain = @user.domain
    new_domain = user_params(:domain)[:domain]

    if old_domain != new_domain

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.

Severity
Category
Status
Source
Language