peterhudec/authomatic

View on GitHub
authomatic/providers/oauth2.py

Summary

Maintainability
F
1 wk
Test Coverage

File oauth2.py has 1561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
|oauth2| Providers
-------------------

Severity: Major
Found in authomatic/providers/oauth2.py - About 4 days to fix

    Function login has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def login(self):
    
            # get request parameters from which we can determine the login phase
            authorization_code = self.params.get('code')
            error = self.params.get('error')
    Severity: Minor
    Found in authomatic/providers/oauth2.py - About 4 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 create_request_elements has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_request_elements(
                cls, request_type, credentials, url, method='GET', params=None,
                headers=None, body='', secret=None, redirect_uri='', scope='',
                csrf='', user_state=''
        ):
    Severity: Minor
    Found in authomatic/providers/oauth2.py - About 3 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 access has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def access(self, url, **kwargs):
            # https://developer.github.com/v3/#user-agent-required
            # GitHub requires that all API requests MUST include a valid ``User-Agent`` header.
            headers = kwargs["headers"] = kwargs.get("headers", {})
            if not headers.get("User-Agent"):
    Severity: Minor
    Found in authomatic/providers/oauth2.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 create_request_elements has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create_request_elements(
    Severity: Major
    Found in authomatic/providers/oauth2.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if authorization_code or not self.user_authorization_url:
      
                  if authorization_code:
                      # =============================================================
                      # Phase 2 after redirect with success
      Severity: Critical
      Found in authomatic/providers/oauth2.py - About 1 hr to fix

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

            def _x_user_parser(user, data):
                emails = data.get('emails', [])
                if emails:
                    user.email = emails[0].get('value')
                    for email in emails:
        Severity: Minor
        Found in authomatic/providers/oauth2.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 _x_user_parser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _x_user_parser(user, data):
        
                _resp = data.get('response', {})
                _user = _resp.get('user', {})
        
        
        Severity: Minor
        Found in authomatic/providers/oauth2.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 _x_user_parser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _x_user_parser(user, data):
                _birth_date = data.get('birthday')
                if _birth_date:
                    try:
                        user.birth_date = datetime.datetime.strptime(_birth_date,
        Severity: Minor
        Found in authomatic/providers/oauth2.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

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

            supported_user_attributes = core.SupportedUserAttributes(
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 1941..1941

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

        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

            supported_user_attributes = core.SupportedUserAttributes(
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 914..914

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

        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

            def __init__(self, *args, **kwargs):
                super(Bitly, self).__init__(*args, **kwargs)
        
                if self.offline:
                    if 'grant_type' not in self.access_token_params:
        Severity: Major
        Found in authomatic/providers/oauth2.py and 2 other locations - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 804..809
        authomatic/providers/oauth2.py on lines 1649..1655

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

        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

            def __init__(self, *args, **kwargs):
                super(Reddit, self).__init__(*args, **kwargs)
        
                if self.offline:
                    if 'duration' not in self.user_authorization_params:
        Severity: Major
        Found in authomatic/providers/oauth2.py and 2 other locations - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 696..701
        authomatic/providers/oauth2.py on lines 804..809

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

        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

            def __init__(self, *args, **kwargs):
                super(DeviantART, self).__init__(*args, **kwargs)
        
                if self.offline:
                    if 'grant_type' not in self.access_token_params:
        Severity: Major
        Found in authomatic/providers/oauth2.py and 2 other locations - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 696..701
        authomatic/providers/oauth2.py on lines 1649..1655

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

        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

            @staticmethod
            def _x_user_parser(user, data):
                user.username = data.get('login')
                user.picture = data.get('avatar_url')
                user.link = data.get('html_url')
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 2 hrs to fix
        authomatic/providers/oauth1.py on lines 1103..1108

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

        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 __init__(self, *args, **kwargs):
                super(VK, self).__init__(*args, **kwargs)
        
                if self.offline:
                    if 'offline' not in self.scope:
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 1882..1887

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

        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 __init__(self, *args, **kwargs):
                super(WindowsLive, self).__init__(*args, **kwargs)
        
                if self.offline:
                    if 'wl.offline_access' not in self.scope:
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 2 hrs to fix
        authomatic/providers/oauth2.py on lines 1803..1808

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

        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

                try:
                    user.birth_date = datetime.datetime.strptime(
                        data.get('birthday'), "%Y-%m-%d")
                except ValueError:
                    user.birth_date = data.get('birthday')
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 1999..2003

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

        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

                try:
                    user.birth_date = datetime.datetime.strptime(
                        _user.get('birth_date'), "%B %d")
                except ValueError:
                    user.birth_date = _user.get('birth_date')
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 2068..2072

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

        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

            supported_user_attributes = core.SupportedUserAttributes(
        Severity: Major
        Found in authomatic/providers/oauth2.py and 1 other location - About 1 hr to fix
        authomatic/providers/oauth1.py on lines 914..914

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer_token':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 864..868
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

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

            @classmethod
            def _x_credentials_parser(cls, credentials, data):
                if data.get('token_type') == 'bearer':
                    credentials.token_type = cls.BEARER
                return credentials
        Severity: Major
        Found in authomatic/providers/oauth2.py and 7 other locations - About 1 hr to fix
        authomatic/providers/oauth2.py on lines 592..596
        authomatic/providers/oauth2.py on lines 1210..1214
        authomatic/providers/oauth2.py on lines 1520..1524
        authomatic/providers/oauth2.py on lines 1657..1661
        authomatic/providers/oauth2.py on lines 1701..1705
        authomatic/providers/oauth2.py on lines 1889..1893
        authomatic/providers/oauth2.py on lines 2052..2056

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

        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

                    if response.status != 200 or not access_token:
                        raise FailureError(
                            'Failed to obtain OAuth 2.0 access token from {0}! '
                            'HTTP status: {1}, message: {2}.'.format(
                                self.access_token_url,
        Severity: Minor
        Found in authomatic/providers/oauth2.py and 1 other location - About 55 mins to fix
        authomatic/providers/oauth1.py on lines 495..505

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

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

            supported_user_attributes = core.SupportedUserAttributes(
        Severity: Major
        Found in authomatic/providers/oauth2.py and 3 other locations - About 40 mins to fix
        authomatic/providers/oauth1.py on lines 591..591
        authomatic/providers/oauth1.py on lines 756..756
        authomatic/providers/oauth1.py on lines 1208..1208

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

        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

        There are no issues that match your filters.

        Category
        Status