Showing 62 of 62 total issues
File front_btc.rb
has 562 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'glogin'
require 'obk'
require 'retriable_proxy'
require 'sibit'
require 'sibit/bestof'
File wts.rb
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
$stdout.sync = true
require 'backtrace'
require 'concurrent'
require 'get_process_mem'
Similar blocks of code found in 2 locations. Consider refactoring. Open
function wts_rerate(rate, price, fee) {
'use strict';
var txt = $('#zld').val();
var zld = parseFloat(txt);
if (zld === NaN) {
- 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 133.
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
function wts_rerate(rate, price, fee) {
'use strict';
var txt = $('#zld').val();
var zld = parseFloat(txt);
if (zld === NaN) {
- 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 133.
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 pay_hosting_bonuses
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pay_hosting_bonuses(boss, jid, log)
bonus = Zold::Amount.new(zld: 1.0)
ops(boss, log: log).remove
ops(boss, log: log).pull
latest = boss.wallet(&:txns).reverse.find { |t| t.amount.negative? }
Method svg
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def svg(keys, div, digits, title: '')
sets = {}
min = Time.now
max = Time.now + (STEPS * 24 * 60 * 60)
keys.each do |k|
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def update(max: 400)
if @remotes.all.empty?
@log.debug('The list of remote nodes is empty, can\'t update payables')
return
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 pull
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pull(id = @item.id)
if @user.fake?
@log.info("It is a fake user with wallet ID #{id}, won't PULL from the network")
remove
rsa = OpenSSL::PKey::RSA.new(2048)
Function wts_recalc
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wts_recalc() {
'use strict';
wts_info('Loading rates...')
$.ajax({
dataType: 'json',
Similar blocks of code found in 2 locations. Consider refactoring. Open
unless settings.payouts.allowed?(user.login, amount, limits) || vip?
consumed = settings.payouts.consumed(user.login)
settings.telepost.spam(
"⚠️ The user #{title_md} from #{anon_ip} with #{amount} payment to UpWork just attempted to go",
"over their account limits: \"#{consumed}\", while allowed thresholds are \"#{limits}\";",
- 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 67.
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
unless settings.payouts.allowed?(user.login, amount, limits) || vip?
consumed = settings.payouts.consumed(user.login)
settings.telepost.spam(
"⚠️ The user #{title_md} from #{anon_ip} with #{amount} payment to PayPal just attempted to go",
"over their account limits: \"#{consumed}\", while allowed thresholds are \"#{limits}\";",
- 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 67.
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 update
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(max: 400)
if @remotes.all.empty?
@log.debug('The list of remote nodes is empty, can\'t update payables')
return
end
Method markdown
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def markdown
price = @sibit.price
rate = WTS::Rate.new(@toggles).to_f
coverage = @ticks.latest('Coverage') / 100_000_000
deficit = @ticks.latest('Deficit') / 100_000_000
Method svg
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def svg(keys, div, digits, title: '')
sets = {}
min = Time.now
max = Time.now + (STEPS * 24 * 60 * 60)
keys.each do |k|
Similar blocks of code found in 2 locations. Consider refactoring. Open
limits = settings.toggles.get('system-limits', '512/2048/8196')
unless settings.payouts.safe?(amount, limits) || vip?
consumed = settings.payouts.system_consumed
settings.telepost.spam(
"⚠️ The user #{title_md} from #{anon_ip} with #{amount} payment to UpWork just attempted to go",
- 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 63.
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
limits = settings.toggles.get('system-limits', '512/2048/8196')
unless settings.payouts.safe?(amount, limits) || vip?
consumed = settings.payouts.system_consumed
settings.telepost.spam(
"⚠️ The user #{title_md} from #{anon_ip} with #{amount} payment to PayPal just attempted to go",
- 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 63.
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
Function wts_step4
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wts_step4(token) {
'use strict';
$.ajax({
dataType: 'text',
url: '/confirmed?noredirect=1',
Method monitor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def monitor(seen, max: 1)
raise "Wrong BTC address '#{seen}'" unless seen.length == 64
nxt = @sibit.next_of(seen)
return seen if nxt.nil?
return seen unless nxt.start_with?('00000000')
- 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 start
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def start(id, seconds = 60, pause: 5)
@threads[id] = Thread.new do
sleep(pause) # to let the main script load all Ruby methods
loop do
sleep([[seconds - age(id), 0].max, 5 * 60].min)
- 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 pay
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pay(keygap, bnf, amount, details)
raise WTS::UserError, 'E187: Payment amount can\'t be zero' if amount.zero?
raise WTS::UserError, 'E188: Payment amount can\'t be negative' if amount.negative?
raise "The user #{@user.login} is not registered yet" unless @item.exists?
raise "The account #{@user.login} is not confirmed yet" unless @user.confirmed?