devicekit/DeviceKit

View on GitHub

Showing 11 of 18 total issues

File gyb.py has 981 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# GYB: Generate Your Boilerplate (improved names welcome; at least
# this one's short).  See -h output for instructions

from __future__ import print_function
Severity: Major
Found in Utils/gyb.py - About 2 days to fix

    File Device.generated.swift has 724 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #if os(watchOS)
    import WatchKit
    #else
    import UIKit
    #endif
    Severity: Major
    Found in CocoaPodsVerification/Pods/DeviceKit/Source/Device.generated.swift - About 1 day to fix

      Function token_generator has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def token_generator(self, base_tokens):
              r"""Given an iterator over (kind, text, match) triples (see
              tokenize_template above), return a refined iterator over
              token_kinds.
      
      
      Severity: Minor
      Found in Utils/gyb.py - About 3 hrs 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 mapToDevice has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity
          #if os(iOS)
            switch identifier {
            case "iPod5,1": return iPodTouch5
            case "iPod7,1": return iPodTouch6
      Severity: Major
      Found in CocoaPodsVerification/Pods/DeviceKit/Source/Device.generated.swift - About 2 hrs to fix

        Function tokenize_template has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def tokenize_template(template_text):
            r"""Given the text of a template, returns an iterator over
            (tokenType, token, match) tuples.
        
            **Note**: this is template syntax tokenization, not Python
        Severity: Minor
        Found in Utils/gyb.py - About 1 hr 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 split_gyb_lines has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def split_gyb_lines(source_lines):
            r"""Return a list of lines at which to split the incoming source
        
            These positions represent the beginnings of python line groups that
            will require a matching %end construct if they are to be closed.
        Severity: Minor
        Found in Utils/gyb.py - About 1 hr 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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, context):
        
                source = ''
                source_line_count = 0
        
        
        Severity: Minor
        Found in Utils/gyb.py - About 45 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 tokenize_python_to_unmatched_close_curly has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def tokenize_python_to_unmatched_close_curly(source_text, start, line_starts):
            """Apply Python's tokenize to source_text starting at index start
            while matching open and close curly braces.  When an unmatched
            close curly brace is found, return its index.  If not found,
            return len(source_text).  If there's a tokenization error, return
        Severity: Minor
        Found in Utils/gyb.py - About 45 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 append_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def append_text(self, text, file, line):
                # see if we need to inject a line marker
                if self.line_directive:
                    if (file, line) != self.last_file_line:
                        # We can only insert the line directive at a line break
        Severity: Minor
        Found in Utils/gyb.py - About 45 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def execute(self, context):
                # Save __children__ from the local bindings
                save_children = context.local_bindings.get('__children__')
                # Execute the code with our __children__ in scope
                context.local_bindings['__children__'] = self.children
        Severity: Minor
        Found in Utils/gyb.py - 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

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

          public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity
            #if os(iOS)
              switch identifier {
              case "iPod5,1": return iPodTouch5
              case "iPod7,1": return iPodTouch6
        Severity: Minor
        Found in CocoaPodsVerification/Pods/DeviceKit/Source/Device.generated.swift - 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