krateng/maloja

View on GitHub

Showing 189 of 189 total issues

Function get_scrobbles_of_track has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_scrobbles_of_track(track,since=None,to=None,resolve_references=True,limit=None,reverse=False,dbconn=None):

    if since is None: since=0
    if to is None: to=now()

Severity: Minor
Found in maloja/database/sqldb.py - 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

Function get_token_from_request_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_token_from_request_keys(self,keys):
        if 'token' in keys:
            return keys.get("token").strip()
        if 'Authorization' in keys:
            auth = keys.get("Authorization")
Severity: Minor
Found in maloja/apis/listenbrainz.py - 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

Function get_image_from_cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_image_from_cache(track_id=None,artist_id=None,album_id=None):
    now = int(datetime.datetime.now().timestamp())
    entity_id, table = get_id_and_table(track_id=track_id,artist_id=artist_id,album_id=album_id)

    with engine.begin() as conn:
Severity: Minor
Found in maloja/images.py - 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

Function convert_kwargs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def convert_kwargs(func):

    #params = tuple(p for p in signature(func).parameters)

    def wrapper(*args,albumartist:Multi[str]=[],trackartist:Multi[str]=[],**kwargs):
Severity: Minor
Found in maloja/apis/native_v1.py - 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

Function get_scrobbles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_scrobbles(since=None,to=None,resolve_references=True,limit=None,reverse=False,dbconn=None):


    if since is None: since=0
    if to is None: to=now()
Severity: Minor
Found in maloja/database/sqldb.py - 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

Function createCheckmarks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function createCheckmarks() {
    if (this.readyState == 4) {
        if ((this.status >= 200) && (this.status < 300)) {
            //document.getElementById("checkmark_url").innerHTML = "✔️"
            //document.getElementById("checkmark_key").innerHTML = "✔️"
Severity: Minor
Found in auxiliary/chromium_scrobbler/maloja-scrobbler/settings.js - 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

Function ranges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def ranges(since=None,to=None,within=None,timerange=None,step="month",stepn=1,trail=1,max_=None):

    (firstincluded,lastincluded) = time_stamps(since=since,to=to,within=within,range=timerange)

    d_start = from_timestamp(firstincluded,step)
Severity: Minor
Found in maloja/malojatime.py - 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

Function get_featured has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_featured(dbconn=None):
    # temporary stand-in
    ranges = [
        MTRangeComposite(since=today().next(-14),to=today()),
        MTRangeComposite(since=thisweek().next(-12),to=thisweek()),
Severity: Minor
Found in maloja/database/__init__.py - 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

Function get_scrobbles_of_album has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_scrobbles_of_album(album,since=None,to=None,resolve_references=True,limit=None,reverse=False,dbconn=None):

    if since is None: since=0
    if to is None: to=now()

Severity: Minor
Found in maloja/database/sqldb.py - 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