d4l3k/WebSync

View on GitHub

Showing 192 of 366 total issues

Method upload_html has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def upload_html html
          dom = Nokogiri::HTML(content)
          upload_list = []
          dom.css("img[src]").each do |img|
            path = img.attr("src").split("/").last
Severity: Minor
Found in lib/routes/upload_download.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

Method document_auth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def document_auth doc_id=nil
      doc_id ||= params[:doc]
      doc_id = doc_id.decode62 if doc_id.is_a? String

      doc = WSFile.get doc_id
Severity: Minor
Found in lib/helpers.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

Avoid too many return statements within this function.
Open

  return g_left_delimiters
[ v_token ] ;
Severity: Major
Found in assets/lib/display-latex.user.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return g_right_delimiters
    [ v_token ] ;
    Severity: Major
    Found in assets/lib/display-latex.user.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return g_operator_symbols
      [ v_token ] ;
      Severity: Major
      Found in assets/lib/display-latex.user.js - About 30 mins to fix

        Function v_font_to_mathml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function v_font_to_mathml (tokens , v_font_name ) {
         if( ( tokens.list[tokens.index] != "{" ) ) {
          var v_result = result_element( "mi" , 1
        , "mathvariant" , v_font_name , tokens.list[tokens.index] ) ;
          if( ( v_font_name == "normal" ) ) {
        Severity: Minor
        Found in assets/lib/display-latex.user.js - About 25 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

        Function Out has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                Out: function(a) {
                    return a < 1 / 2.75 ? 7.5625 * a * a : a < 2 / 2.75 ? 7.5625 * (a -= 1.5 / 2.75) * a + 0.75 : a < 2.5 / 2.75 ? 7.5625 * (a -= 2.25 / 2.75) * a + 0.9375 : 7.5625 * (a -= 2.625 / 2.75) * a + 0.984375
                },
        Severity: Minor
        Found in assets/lib/tween.min.js - About 25 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

        Function v_collect_precedence_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function v_collect_precedence_group (tokens , v_operators , v_stop_tokens , v_reader ) {
         var v_result = v_reader (tokens , v_stop_tokens ) ;
         var v_mrow = null ;
         while( ( ( tokens.list[tokens.index] != null )  &&  !( ( tokens.list[tokens.index] in v_stop_tokens ) )  &&  ( tokens.list[tokens.index] in v_operators ) ) ) {
          if( ( v_mrow == null ) ) {
        Severity: Minor
        Found in assets/lib/display-latex.user.js - About 25 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

        Function InOut has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                InOut: function(a) {
                    return 0 === a ? 0 : 1 === a ? 1 : 1 > (a *= 2) ? 0.5 * Math.pow(1024, a - 1) : 0.5 * (-Math.pow(2, -10 * (a - 1)) + 2)
                }
        Severity: Minor
        Found in assets/lib/tween.min.js - About 25 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

        Function Linear has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            Linear: function(a, c) {
                var b = a.length - 1,
                    d = b * c,
                    e = Math.floor(d),
                    g = TWEEN.Interpolation.Utils.Linear;
        Severity: Minor
        Found in assets/lib/tween.min.js - About 25 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 put has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def put(request, response)
              if not @file
                parts = @local_path.split("/")
                file = WSFile.all(parent: nil, name: parts[1])[0]
                endd = parts.last=="" ? -3 : -2
        Severity: Minor
        Found in lib/webdav.rb - About 25 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 editor! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def editor! doc
              if doc.default_level == "owner" or doc.default_level == "editor"
                return
              else
                perm = doc.permissions(user: current_user)
        Severity: Minor
        Found in lib/helpers.rb - About 25 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