ota42y/openapi_parser

View on GitHub

Showing 24 of 28 total issues

Avoid too many return statements within this method.
Open

      return [nil, err] if err
Severity: Major
Found in lib/openapi_parser/schema_validator/string_validator.rb - About 30 mins to fix

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

          def validate_datetime_format(value, schema)
            return [value, nil] unless schema.format == 'date-time'
    
            begin
              if @datetime_coerce_class.nil?
    Severity: Minor
    Found in lib/openapi_parser/schema_validator/string_validator.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 validate_schema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def validate_schema(value, schema, **keyword_args)
        return [value, nil] unless schema
    
        if (v = validator(value, schema))
          if keyword_args.empty?
    Severity: Minor
    Found in lib/openapi_parser/schema_validator.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 validate_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate_header(response_headers)
            return unless headers
    
            headers.each do |name, schema|
              next unless response_headers.key?(name)
    Severity: Minor
    Found in lib/openapi_parser/schemas/response.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