albertyw/ios_config_profile

View on GitHub

Showing 15 of 15 total issues

Assignment Branch Condition size for get_vendor_config is too high. [21.59/15]
Open

    def get_vendor_config
      if vpn_config[:vpn_type] == "L2TP"
        get_l2tp_config
      elsif vpn_config[:vpn_type] == "PPTP"
        raise NotImplementedError

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for get_ipsec_config is too high. [21.24/15]
Open

    def get_ipsec_config
      config = {
        "RemoteAddress" => vpn_config[:remote_address],
        "AuthenticationMethod" => vpn_config[:authentication_method],
        "XAuthName" => vpn_config[:x_auth_name],

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method available_supervised_payloads has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.available_supervised_payloads
      # key => [english description, default, (options)]
      {
        "allowiTunes" => ["Allow iTunes Music Store", true],
        "allowVideoConferencing" => ["Allow video conferencing", true],
Severity: Minor
Found in lib/ios_config_profile/device/restrictions_payload.rb - About 1 hr to fix

    Method available_payloads has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.available_payloads
          # key => [english description, default, (options)]
          {
            "allowAssistant" => ["Allow Siri", true],
            "allowAssistantWhileLocked" => ["Allow Siri while device is locked", true],
    Severity: Minor
    Found in lib/ios_config_profile/device/restrictions_payload.rb - About 1 hr to fix

      Method get_vendor_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_vendor_config
            if vpn_config[:vpn_type] == "L2TP"
              get_l2tp_config
            elsif vpn_config[:vpn_type] == "PPTP"
              raise NotImplementedError
      Severity: Minor
      Found in lib/ios_config_profile/device/vpn_payload.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 generate_restrictions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_restrictions(custom_values)
            if not custom_values.is_a? Hash
              custom_values = Hash.new
            end
            default_payload = restrictions_payload
      Severity: Minor
      Found in lib/ios_config_profile/device/restrictions_payload.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class InstallApplicationPayload < Hash
          include IOSConfigProfile::BasicPayload
      
          attr_accessor :itunes_store_id
      
      
      Severity: Minor
      Found in lib/ios_config_profile/content/install_application_payload.rb and 1 other location - About 15 mins to fix
      lib/ios_config_profile/content/install_market_app_payload.rb on lines 2..19

      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 26.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class InstallProfilePayload < Hash
          include IOSConfigProfile::BasicPayload
      
          attr_accessor :profile
      
      
      Severity: Minor
      Found in lib/ios_config_profile/device/install_profile_payload.rb and 1 other location - About 15 mins to fix
      lib/ios_config_profile/device/clear_passcode_payload.rb on lines 4..20

      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 26.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class InstallMarketAppPayload < Hash
          include IOSConfigProfile::BasicPayload
      
          attr_accessor :manifest_url
      
      
      Severity: Minor
      Found in lib/ios_config_profile/content/install_market_app_payload.rb and 1 other location - About 15 mins to fix
      lib/ios_config_profile/content/install_application_payload.rb on lines 2..19

      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 26.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class ClearPasscodePayload < Hash
          include IOSConfigProfile::BasicPayload
      
          attr_accessor :unlock_token
      
      
      Severity: Minor
      Found in lib/ios_config_profile/device/clear_passcode_payload.rb and 1 other location - About 15 mins to fix
      lib/ios_config_profile/device/install_profile_payload.rb on lines 2..18

      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 26.

      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

      Further Reading

      Add an empty line after magic comments.
      Open

      module IOSConfigProfile
      Severity: Minor
      Found in lib/ios_config_profile/version.rb by rubocop

      Checks for a newline after the final magic comment.

      Example:

      # good
      # frozen_string_literal: true
      
      # Some documentation for Person
      class Person
        # Some code
      end
      
      # bad
      # frozen_string_literal: true
      # Some documentation for Person
      class Person
        # Some code
      end

      Add an empty line after magic comments.
      Open

      lib = File.expand_path("../lib", __FILE__)
      Severity: Minor
      Found in ios_config_profile.gemspec by rubocop

      Checks for a newline after the final magic comment.

      Example:

      # good
      # frozen_string_literal: true
      
      # Some documentation for Person
      class Person
        # Some code
      end
      
      # bad
      # frozen_string_literal: true
      # Some documentation for Person
      class Person
        # Some code
      end

      TODO found
      Open

                       (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
      Severity: Minor
      Found in .rubocop.yml by fixme

      HACK found
      Open

                       (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
      Severity: Minor
      Found in .rubocop.yml by fixme

      FIXME found
      Open

                       (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
      Severity: Minor
      Found in .rubocop.yml by fixme
      Severity
      Category
      Status
      Source
      Language