piotrmurach/github_cli

View on GitHub

Showing 151 of 151 total issues

File cli.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'tty-editor'

require_relative 'vendor'

module GithubCLI
Severity: Minor
Found in lib/github_cli/cli.rb - About 2 hrs to fix

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

          def list
            global_options = options.dup
            params = options[:params].dup
            params["org"]   = options[:org]   if options.key?("org")
            params["user"]  = options[:user]  if options.key?("user")
    Severity: Major
    Found in lib/github_cli/commands/repositories.rb and 1 other location - About 2 hrs to fix
    lib/github_cli/commands/authorizations.rb on lines 60..70

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

    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

          def create
            global_options     = options.dup
            params             = options[:params].dup
            params["scopes"]   = options[:scopes]   if options.key?("scopes")
            params["note"]     = options[:note]     if options.key?("note")
    Severity: Major
    Found in lib/github_cli/commands/authorizations.rb and 1 other location - About 2 hrs to fix
    lib/github_cli/commands/repositories.rb on lines 29..39

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

    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

    Method list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def list
            global_options = options.dup
            params = options[:params].dup
            params["org"]       = options[:org]       if options.key?("org")
            params["user"]      = options[:user]      if options.key?("user")
    Severity: Minor
    Found in lib/github_cli/commands/issues.rb - About 2 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

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

    module GithubCLI
      class Milestone
        extend API
    
        def self.all(user, repo, params, options)
    Severity: Major
    Found in lib/github_cli/apis/milestone.rb and 2 other locations - About 2 hrs to fix
    lib/github_cli/apis/key.rb on lines 5..35
    lib/github_cli/apis/reference.rb on lines 5..35

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

    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 3 locations. Consider refactoring.
    Open

    module GithubCLI
      class Key
        extend API
    
        def self.all(user, repo, params, options)
    Severity: Major
    Found in lib/github_cli/apis/key.rb and 2 other locations - About 2 hrs to fix
    lib/github_cli/apis/milestone.rb on lines 5..35
    lib/github_cli/apis/reference.rb on lines 5..35

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

    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 3 locations. Consider refactoring.
    Open

    module GithubCLI
      class Reference
        extend API
    
        def self.list(user, repo, params, options)
    Severity: Major
    Found in lib/github_cli/apis/reference.rb and 2 other locations - About 2 hrs to fix
    lib/github_cli/apis/key.rb on lines 5..35
    lib/github_cli/apis/milestone.rb on lines 5..35

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

    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

    Method create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def create(args)
            global_options = options.dup
            params = options[:params].dup
            org, params["name"] = Arguments.new(args).parse
            params["org"]                = org if org
    Severity: Minor
    Found in lib/github_cli/commands/repositories.rb - 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

    Method edit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def edit(org)
            global_options = options.dup
            params = options[:params].dup
            params["billing_email"] = options[:billing_email] if options.key?("billing_email")
            params["blog"] = options[:blog] if options.key?("blog")
    Severity: Minor
    Found in lib/github_cli/commands/organizations.rb - 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

    Method edit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def edit(user, repo, name)
            global_options = options.dup
            params = options[:params].dup
            params["name"] = name
            params["description"]        = options["desc"] if options.key?("desc")
    Severity: Minor
    Found in lib/github_cli/commands/repositories.rb - 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

    Method build_output has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def build_output
            if response.respond_to?(:to_ary)
              case transform
              when :horizontal
                array = [flatten_hash(response[0].to_hash).keys]
    Severity: Minor
    Found in lib/github_cli/formatters/table.rb - About 1 hr to fix

      Method configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def configure(options = {})
            api    = Github.new
            config = GithubCLI.config
      
            ssl      = config.fetch('core.ssl')
      Severity: Minor
      Found in lib/github_cli/api.rb - About 55 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 printable_commands has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def printable_commands(all = true, subcommand = false)
            (all ? all_commands : commands).map do |_, command|
              next if command.hidden?
              item = []
              item << banner(command, false, subcommand).gsub(/#{basename} /, '')
      Severity: Minor
      Found in lib/github_cli/thor_ext.rb - About 55 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

            def archive(user, repo)
              global_options = options.dup
              params = options[:params].dup
              params['ref'] = options[:ref] if options[:ref]
              params['archive_format'] = options[:archive_format] if options[:archive_format]
      Severity: Minor
      Found in lib/github_cli/commands/contents.rb and 1 other location - About 55 mins to fix
      lib/github_cli/commands/blobs.rb on lines 32..39

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

      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

            def create(user, repo)
              global_options = options.dup
              params = options[:params].dup
              params['content']  = options[:content]  if options[:content]
              params['encoding'] = options[:encoding] if options[:encoding]
      Severity: Minor
      Found in lib/github_cli/commands/blobs.rb and 1 other location - About 55 mins to fix
      lib/github_cli/commands/contents.rb on lines 138..144

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

      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

      Method format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def format
              output = []
      
              case response
              when Array
      Severity: Minor
      Found in lib/github_cli/formatters/table.rb - 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

      Method all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.all
            commands = []
            Thor::Base.subclasses.each do |klass|
              namespace = extract_namespace(klass)
              next unless is_api_command?(namespace)
      Severity: Minor
      Found in lib/github_cli/command.rb - 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

      Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.get(user, repo, id, params, options)
      Severity: Minor
      Found in lib/github_cli/apis/download.rb - About 35 mins to fix

        Method check has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def self.check(user, repo, assignee, params, options)
        Severity: Minor
        Found in lib/github_cli/apis/assignee.rb - About 35 mins to fix

          Method update has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def self.update(user, repo, name, params, options)
          Severity: Minor
          Found in lib/github_cli/apis/label.rb - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language