aureooms/sak

View on GitHub
sak/github.py

Summary

Maintainability
F
4 days
Test Coverage

Function migrateissues has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

def migrateissues(owner, origin, destination, *issuenos, token=None):

    token = lib.github.pat(token)

    print("fetch issues to migrate")
Severity: Minor
Found in sak/github.py - About 5 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

File github.py has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import lib.config
import lib.git
import lib.error
import lib.check
import lib.github
Severity: Minor
Found in sak/github.py - About 5 hrs to fix

    Function archive has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def archive(username, forks=False, gist=True, metadata=True):
        """
                All credits go to Filippo Valsorda (https://filippo.io).
    
                original -> https://filippo.io/archive-your-github-repo-and-data/
    Severity: Minor
    Found in sak/github.py - 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

    Function issues has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def issues(owner=None, repo=None, number=None, user=False, org=None, token=None, milestone=None, filter=None, state=None, creator=None, assignee=None, mentioned=None, labels=None, sort=None, direction=None, since=None):
    Severity: Major
    Found in sak/github.py - About 2 hrs to fix

      Function new has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def new(name, org=None, team_id=None, token=None, auto_init=FALSE, private=FALSE, description=None, homepage=None, has_issues=TRUE, has_wiki=TRUE, has_downloads=TRUE, gitignore_template=None, license_template=None):
      Severity: Major
      Found in sak/github.py - About 1 hr to fix

        Function patch has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def patch(owner, repo, name, token=None, private=FALSE, description=None, homepage=None, has_issues=TRUE, has_wiki=TRUE, has_downloads=TRUE, default_branch=None):
        Severity: Major
        Found in sak/github.py - About 1 hr to fix

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

          def migrateissues(owner, origin, destination, *issuenos, token=None):
          
              token = lib.github.pat(token)
          
              print("fetch issues to migrate")
          Severity: Minor
          Found in sak/github.py - About 1 hr to fix

            Function editissue has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def editissue(owner, repo, number, title=None, body=None, assignee=None, state=None, milestone=None, labels=None, token=None):
            Severity: Major
            Found in sak/github.py - About 1 hr to fix

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

              def download(target=YOU, name=None, t=None, token=None, prompt=True, prefix="", suffix="", regexp="", asuser=None, **kwargs):
              
                  for repo in lib.github.list(target, name, t, token):
              
                      repo = repo["full_name"]
              Severity: Minor
              Found in sak/github.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 download has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def download(target=YOU, name=None, t=None, token=None, prompt=True, prefix="", suffix="", regexp="", asuser=None, **kwargs):
              Severity: Major
              Found in sak/github.py - About 1 hr to fix

                Function createhook has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def createhook(owner, repo, url, name="web", content_type="json", secret=None, insecure_ssl="0", events="push", active=True, token=None):
                Severity: Major
                Found in sak/github.py - About 1 hr to fix

                  Function createissue has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def createissue(owner, repo, title, body=None, assignee=None, milestone=None, labels=None, token=None):
                  Severity: Major
                  Found in sak/github.py - About 1 hr to fix

                    Function updatemilestone has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def updatemilestone(owner, repo, number, title, state=None, description=None, due_on=None, token=None):
                    Severity: Major
                    Found in sak/github.py - About 1 hr to fix

                      Function comments has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def comments(owner, repo, id=None, number=None, sort=None, direction=None, since=None, token=None):
                      Severity: Major
                      Found in sak/github.py - About 1 hr to fix

                        Function milestones has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def milestones(owner, repo, number=None, state=None, sort=None, direction=None, token=None):
                        Severity: Major
                        Found in sak/github.py - About 50 mins to fix

                          Function createmilestone has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def createmilestone(owner, repo, title, state=None, description=None, due_on=None, token=None):
                          Severity: Major
                          Found in sak/github.py - About 50 mins to fix

                            Function updatelabel has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def updatelabel(owner, repo, oldname, newname, color, token=None):
                            Severity: Minor
                            Found in sak/github.py - About 45 mins to fix

                              Function editcomment has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def editcomment(owner, repo, id, body, token=None):
                              Severity: Minor
                              Found in sak/github.py - About 35 mins to fix

                                Function addlabels has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def addlabels(owner, repo, issue, labels=None, token=None):
                                Severity: Minor
                                Found in sak/github.py - About 35 mins to fix

                                  Function migrateissues has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  def migrateissues(owner, origin, destination, *issuenos, token=None):
                                  Severity: Minor
                                  Found in sak/github.py - About 35 mins to fix

                                    Function listforks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    def listforks(owner, repo, sort=NEWEST, token=None, identify=False):
                                    Severity: Minor
                                    Found in sak/github.py - About 35 mins to fix

                                      Function labels has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      def labels(owner, repo, name=None, issue=None, token=None):
                                      Severity: Minor
                                      Found in sak/github.py - About 35 mins to fix

                                        Function notifications has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        def notifications(all=False, participating=False, since=None, before=None, token=None):
                                        Severity: Minor
                                        Found in sak/github.py - About 35 mins to fix

                                          Function list has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          def list(target=YOU, name=None, t=None, format="{full_name}", token=None):
                                          Severity: Minor
                                          Found in sak/github.py - About 35 mins to fix

                                            Function createcomment has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            def createcomment(owner, repo, number, body, token=None):
                                            Severity: Minor
                                            Found in sak/github.py - About 35 mins to fix

                                              Function removelabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                              def removelabel(owner, repo, issue, label, token=None):
                                              Severity: Minor
                                              Found in sak/github.py - About 35 mins to fix

                                                Function updatelabels has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                def updatelabels(owner, repo, issue, labels=None, token=None):
                                                Severity: Minor
                                                Found in sak/github.py - About 35 mins to fix

                                                  Function createlabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                  def createlabel(owner, repo, name, color, token=None):
                                                  Severity: Minor
                                                  Found in sak/github.py - About 35 mins to fix

                                                    Function search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                    def search(what, query, token=None, **kwargs):
                                                    
                                                        response = lib.args.forward(lib.github.search, locals())
                                                    
                                                        for result in response:
                                                    Severity: Minor
                                                    Found in sak/github.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

                                                    There are no issues that match your filters.

                                                    Category
                                                    Status