yourkarma/JWT

View on GitHub

Showing 13 of 18 total issues

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

class KeysGenerator
    module FileFormatsModule
        def only_name(name)
            # remove extension
            Pathname.new(name).basename
Severity: Minor
Found in Scripts/generate_ec_curved_keys.rb - About 3 hrs to fix

    File generate_ec_curved_keys.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'optparse'
    require 'shellwords'
    require 'pathname'
    class ShellExecutor
        @@dry_run = false
    Severity: Minor
    Found in Scripts/generate_ec_curved_keys.rb - About 2 hrs to fix

      Function decode has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func decode(token: String?, object: TokenDecoderDataTransferObjectProtocol) -> JWTCodingResultType? {
              print("JWT ENCODED TOKEN \(String(describing: token))")
              let algorithmName = object.algorithmName
              let skipVerification = object.shouldSkipSignatureVerification
              print("JWT Algorithm NAME \(algorithmName)")

        Function reloadData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func reloadData() {
                self.cachedResultArray = nil
                self.cachedErrorDictionary = nil
                if let resultType = self.resultType {
                    if let successResult = resultType.successResult, let dictionary = successResult.headerAndPayloadDictionary {

          Function decode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              func decode(token: String?, object: TokenDecoderDataTransferObjectProtocol) -> JWTCodingResultType? {
                  print("JWT ENCODED TOKEN \(String(describing: token))")
                  let algorithmName = object.algorithmName
                  let skipVerification = object.shouldSkipSignatureVerification
                  print("JWT Algorithm NAME \(algorithmName)")

          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 generated has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def generated(type, parameters, private_key_pem, public_key_pem, certificate_request, certificate, p12, p12_password)
          Severity: Major
          Found in Scripts/generate_ec_curved_keys.rb - About 1 hr to fix

            Function reloadData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                func reloadData() {
                    self.cachedResultArray = nil
                    self.cachedErrorDictionary = nil
                    if let resultType = self.resultType {
                        if let successResult = resultType.successResult, let dictionary = successResult.headerAndPayloadDictionary {
            Severity: Minor
            Found in Example/JWTDesktopSwift/JWTDesktopSwift/DecriptedViewController.swift - 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 decode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                func decode(token: String?, object: TokenDecoderDataTransferObjectProtocol) -> JWTCodingResultType? {
                    // do work here.
                    print("JWT ENCODED TOKEN \(String(describing: token))")
                    let algorithmName = object.algorithmName
                    let skipVerification = object.shouldSkipSignatureVerification

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

                def fix_options(the_options)
                    options = the_options
                    options[:result_directory] ||= '../Tests/Resources/Certs/'
                    if options[:test]
                        options[:algorithm_type] ||= KeyParameters::TYPES.first
            Severity: Minor
            Found in Scripts/generate_keys.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 nil

              Avoid too many return statements within this function.
              Open

                      return string

                Avoid too many return statements within this function.
                Open

                            return result

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

                      def generated(type, parameters, private_key_pem, public_key_pem, certificate_request, certificate, p12, p12_password)
                          the_private_key_pem ||= FileFormats.to_pem private_key_pem
                          the_public_key_pem ||= FileFormats.to_pem public_key_pem
                          the_certificate_request ||= FileFormats.to_certificate_request certificate_request
                          the_certificate ||= FileFormats.to_certificate certificate
                  Severity: Minor
                  Found in Scripts/generate_ec_curved_keys.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