Showing 167 of 167 total issues
Method setup_repo
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_repo
retry_count ||= 0
if File.directory?(local_folder)
# TODO: test if this crashes if it's not a git directory
begin
Class BuildRunner
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class BuildRunner
include FastlaneCI::Logging
# Reference to the FastlaneCI::Project of this particular build run
attr_reader :project
Method handle_exception
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_exception(ex, console_message: nil, exception_context: {})
unless console_message.nil?
logger.error(console_message)
end
logger.error(ex)
File project.component.spec.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import 'rxjs/add/operator/switchMap';
import {Location} from '@angular/common';
import {DebugElement} from '@angular/core';
import {async, ComponentFixture, fakeAsync, flush, TestBed, tick} from '@angular/core/testing';
Class RemoteRunner
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class RemoteRunner
include FastlaneCI::Logging
# this record separator is used to delimit the history file.
# if for whatever reason, we can't delimit on newlines, consider \30 the Record Separator char.
File build.component.spec.ts
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {DebugElement, Component} from '@angular/core';
import {Location} from '@angular/common';
import {async, ComponentFixture, TestBed, tick, fakeAsync} from '@angular/core/testing';
import {MatCardModule, MatProgressSpinnerModule} from '@angular/material';
import {By} from '@angular/platform-browser';
Method setup_tooling_environment?
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_tooling_environment?
xcode_version_file_path = File.join(repo.local_folder, ".xcode-version")
unless File.exist?(xcode_version_file_path)
logger.debug("No `.xcode-version` file found for repo '#{project.project_name}', " \
"not managing Xcode for this one...")
Method commit_changes!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def commit_changes!(commit_message: nil, push_after_commit: true, files_to_commit: [], repo_auth: self.repo_auth)
git_action_with_queue do
logger.debug("Starting commit_changes! #{git_config.git_url} for #{repo_auth.username}")
commit_message ||= "Automatic commit by fastlane.ci"
- Read upRead up
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe('Repository Model', () => {
it('should convert project response successfully', () => {
const repository = new Repository(mockRepositoryResponse);
expect(repository.fullName).toBe('fastlane/ci');
- Read upRead up
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 75.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe('Artifact Model', () => {
it('should convert build artifact successfully', () => {
const artifact = new Artifact(mockBuildArtifactResponse_log);
expect(artifact.id).toBe('12345');
- Read upRead up
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 75.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method start_workers_for_project_and_credential
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_workers_for_project_and_credential(project: nil, provider_credential: nil, notification_service:)
user_responsible = provider_credential.ci_user
if user_responsible.nil?
name = project.project_name
Method enqueue_builds_for_open_github_prs_with_no_status
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.enqueue_builds_for_open_github_prs_with_no_status(projects: nil, github_service: nil)
logger.debug("Searching for open PRs with no status and starting a build for them")
projects.each do |project|
# Don't enqueue builds for the open pull requests if we don't have a pull request trigger defined for it
next if project.find_triggers_of_type(trigger_type: :pull_request).first.nil?
- Read upRead up
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
Method github_action
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def github_action(client, &block)
if client.kind_of?(Octokit::Client)
# Inject Faraday::Request::Retry to the client if necessary
client = inject_retry_middleware(client)
# `rate_limit_retry_count` retains the variables through iterations so we assign to 0 the first time.
- Read upRead up
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
Method initialize
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(
git_config: nil,
local_folder: nil,
provider_credential: nil,
async_start: false,
Method setup_build_specific_environment_variables
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_build_specific_environment_variables
@environment_variables_set = []
# Set the CI specific Environment variables first
build_url = File.join(
Method run_pending_github_builds
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.run_pending_github_builds(projects: nil, github_service: nil)
logger.debug("Searching all projects for commits with pending status that need a new build")
# For each project, rerun all builds with the status of "pending"
projects.each do |project|
# Don't enqueue builds for the open pull requests if we don't have a pull request trigger defined for it
- Read upRead up
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
Method store!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def store!(artifact:, build:, project:)
raise "Artifact to store was not provided or wrong type provided" unless artifact&.is_a?(Artifact)
raise "Build was not provided or wrong type provided" unless build&.is_a?(Build)
raise "Project was not provided or wrong type provided" unless project&.is_a?(Project)
- Read upRead up
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
Similar blocks of code found in 3 locations. Consider refactoring. Open
dataService = {
getBuild:
jasmine.createSpy().and.returnValue(buildSubject.asObservable()),
getBuildLogs:
jasmine.createSpy().and.returnValue(buildLogsSubject.asObservable())
- Read upRead up
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 70.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
dataService = {
getProject:
jasmine.createSpy().and.returnValue(projectSubject.asObservable()),
rebuild: jasmine.createSpy().and.returnValue(
rebuildSummarySubject.asObservable())
- Read upRead up
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 70.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
dataService = {
addProject:
jasmine.createSpy().and.returnValue(projectSubject.asObservable()),
getRepoLanes:
jasmine.createSpy().and.returnValue(lanesSubject.asObservable())
- Read upRead up
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 70.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76