Showing 5 of 25 total issues
Method service_data
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.service_data(env = ENV)
if env["TRAVIS"]
{
name: "travis-ci",
branch: env["TRAVIS_BRANCH"],
Method service_data
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.service_data(env = ENV)
if env["TRAVIS"]
{
name: "travis-ci",
branch: env["TRAVIS_BRANCH"],
- 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 to_payload
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_payload(result)
totals = Hash.new(0)
source_files = result.files.map do |file|
totals[:total] += file.lines.count
totals[:covered] += file.covered_lines.count
Method validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate
raise InvalidPayload, "A git commit sha was not found in the test report payload" unless commit_sha
raise InvalidPayload, "A git commit timestamp was not found in the test report payload" unless committed_at
raise InvalidPayload, "A run at timestamp was not found in the test report payload" unless run_at
raise InvalidPayload, "No source files were found in the test report payload" unless source_files?
- 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 batch_post_results
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def batch_post_results(files)
uri = URI.parse("#{host}/test_reports/batch")
http = http_client(uri)
boundary = SecureRandom.uuid