eduardosasso/bullish

View on GitHub

Showing 6 of 8 total issues

Class Edition has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Edition
    include Widgets

    attr_writer :day_of_the_week

Severity: Minor
Found in editions/edition.rb - About 3 hrs to fix

    Class Ticker has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Ticker
        attr_writer :request, :name, :price
        attr_reader :symbol, :key
    
        ALIAS = {
    Severity: Minor
    Found in services/ticker.rb - About 2 hrs to fix

      Function handler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.handler = async event => {
        const key = process.env["MAILERLITE_API_KEY"];
        const request = require("axios");
      
        const Sentry = require("@sentry/node");
      Severity: Minor
      Found in site/subscribe.js - About 1 hr to fix

        Method post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def post
            return unless edition.send?
        
            retries ||= 0
        
        
        Severity: Minor
        Found in bullish.rb - About 55 mins to fix

        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 variant1 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def variant1(stock)
              variant = ''
        
              stock.stats.each do |key, value|
                next if value == '—'
        Severity: Minor
        Found in services/twitter.rb - About 55 mins to fix

        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 build_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_index(filename = 'index.html')
              s3 = Services::S3.new(@bucket)
        
              archive = s3.list({ prefix: FOLDER }).map do |file|
                next if file.key == "#{FOLDER}/index.html"
        Severity: Minor
        Found in services/archive.rb - About 35 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language