Showing 54 of 54 total issues
Class Release
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Release < ApplicationRecord
extend ActionView::Helpers::TranslationHelper
include ActionView::Helpers::TranslationHelper
include ReleaseUrl
include ReleaseAuth
Class Manager
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Manager
include Zealot::Backup::Helper
TEMPDIR_PREFIX = 'zealot-backup'
DEFAULT_BACKUP_PATH = 'public/backup'
Method stardford_app
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stardford_app(user)
app_name = t('demo.app_name1')
app_bundle_id = 'com.zealot.app-demo'
channels = %i[Android iOS]
schemes = [
Method perform
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(debug_file, user_id = nil)
parser = AppInfo.parse(debug_file.file.path)
case parser.format
when AppInfo::Format::DSYM
Method convert_changelog
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def convert_changelog
if json_string?(changelog)
self.changelog = JSON.parse(changelog)
elsif changelog.blank?
self.changelog = []
- 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 set_disk_volumes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_disk_volumes
@disks = Sys::Filesystem.mounts.each_with_object([]) do |mount, obj|
mount_options = mount.options.split(',').map(&:strip)
# next if (EXCLUDED_MOUNT_OPTIONS & mount_options).any?
next if (EXCLUDED_MOUNT_TYPES & [mount.mount_type]).any?
- 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 parse_dsym
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_dsym(debug_file, parser)
bundle_ids = debug_file.app.bundle_ids
if bundle_ids.present?
upload_bundle_ids = []
Similar blocks of code found in 2 locations. Consider refactoring. Open
renderSuccess() {
this.button.addClass("btn-success")
.removeClass("btn-primary")
this.button.find("i")
- 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 62.
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
renderUnsupport() {
this.button.addClass("btn-warning")
.removeClass("btn-primary")
this.button.find("i")
- 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 62.
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 process_signature_certs
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_signature_certs(parser, metadata)
metadata.developer_certs = parser.signatures.each_with_object([]) do |sign, certs|
signature = { scheme: sign[:version] }
signature[:verified] = sign[:verified]
signature[:certificates] = sign[:certificates]&.each_with_object([]) do |cert, obj|
Method register_device
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def register_device(udid, name = nil)
if (existed_device = Device.find_by(udid: udid))
return existed_device
end
- 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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
authorize @setting
@title = t('.title')
@value = setting_param[:value]
- 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 fetch_icon
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fetch_icon(parser)
file = case parser.platform
when AppInfo::Platform::IOS
return if parser.icons.blank?
- 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 dump
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dump
FileUtils.rm_f(db_file_name)
compress_rd, compress_wr = IO.pipe
compress_pid = spawn(gzip_cmd, in: compress_rd, out: [db_file_name, 'w', 0600])
Function received
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
received(data) {
if (Zealot.isDevelopment) {
console.debug("Received data", data)
}
Method register_device
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_device(udid, name = nil)
if (existed_device = Device.find_by(udid: udid))
return existed_device
end
Method release_versions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def release_versions(limit = 10)
versions = releases.select(:release_version)
.where.not(release_version: nil)
.group(:release_version)
.map(&:release_version)
- 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 parse_dsym
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_dsym(debug_file, parser)
bundle_ids = debug_file.app.bundle_ids
if bundle_ids.present?
upload_bundle_ids = []
- 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 remove_old
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def remove_old(max_keeps = nil)
logger.debug 'Deleting old backups ... '
Dir.chdir(backup_path) do
max_keeps ||= Setting.backup[:max_keeps]
backup_file_count = backup_file_list.size
- 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
Function dialogElement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
get dialogElement() {
const root = document.createElement("div")
root.id = DIALOG_ID
root.classList.add("modal")
root.classList.add("fade")