CenterForOpenScience/waterbutler

View on GitHub

Showing 92 of 92 total issues

File provider.py has 1001 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import copy
import json
import time
import uuid
import asyncio
Severity: Major
Found in waterbutler/providers/github/provider.py - About 2 days to fix

    File provider.py has 856 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import asyncio
    import hashlib
    import logging
    from typing import Tuple
    Severity: Major
    Found in waterbutler/providers/figshare/provider.py - About 2 days to fix

      File provider.py has 688 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import abc
      import time
      import typing
      import asyncio
      import logging
      Severity: Major
      Found in waterbutler/core/provider.py - About 1 day to fix

        File provider.py has 650 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        import typing
        import asyncio
        import logging
        from http import HTTPStatus
        Severity: Major
        Found in waterbutler/providers/onedrive/provider.py - About 1 day to fix

          File provider.py has 625 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          import hashlib
          import logging
          import functools
          from urllib import parse
          Severity: Major
          Found in waterbutler/providers/s3/provider.py - About 1 day to fix

            File provider.py has 590 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import json
            import base64
            import hashlib
            import logging
            import tempfile
            Severity: Major
            Found in waterbutler/providers/box/provider.py - About 1 day to fix

              File provider.py has 575 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import os
              import json
              import hashlib
              import functools
              from urllib import parse
              Severity: Major
              Found in waterbutler/providers/googledrive/provider.py - About 1 day to fix

                File provider.py has 537 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import os
                import json
                import uuid
                import typing
                import asyncio
                Severity: Major
                Found in waterbutler/providers/osfstorage/provider.py - About 1 day to fix

                  File provider.py has 490 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import json
                  import typing
                  import logging
                  from http import HTTPStatus
                  
                  
                  Severity: Minor
                  Found in waterbutler/providers/dropbox/provider.py - About 7 hrs to fix

                    Function _determine_actions has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _determine_actions(self, resource, provider, request, action=None,
                                               auth_type=AuthType.SOURCE, path='', version=None):
                            """Decide what the user is trying to achieve and what permissions they need to achieve it.
                            Returns two values, ``osf_action`` and ``intended_action``.  ``intended_action`` is a tag
                            that describes what the user is trying to accomplish.  This tag can have many values,
                    Severity: Minor
                    Found in waterbutler/auth/osf/handler.py - About 6 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 2 locations. Consider refactoring.
                    Open

                        @property
                        def created_utc(self):
                            try:
                                return self.raw['created_utc']
                            except KeyError:
                    Severity: Major
                    Found in waterbutler/providers/osfstorage/metadata.py and 1 other location - About 6 hrs to fix
                    waterbutler/providers/osfstorage/metadata.py on lines 38..51

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

                    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

                        @property
                        def modified_utc(self):
                            try:
                                return self.raw['modified_utc']
                            except KeyError:
                    Severity: Major
                    Found in waterbutler/providers/osfstorage/metadata.py and 1 other location - About 6 hrs to fix
                    waterbutler/providers/osfstorage/metadata.py on lines 53..66

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

                    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

                    class BaseDropboxMetadata(metadata.BaseMetadata):
                    
                        def __init__(self, raw, folder):
                            super().__init__(raw)
                            self._folder = folder
                    Severity: Major
                    Found in waterbutler/providers/dropbox/metadata.py and 1 other location - About 6 hrs to fix
                    waterbutler/providers/filesystem/metadata.py on lines 6..20

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

                    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

                    class BaseFileSystemMetadata(metadata.BaseMetadata):
                    
                        def __init__(self, raw, folder):
                            super().__init__(raw)
                            self._folder = folder
                    Severity: Major
                    Found in waterbutler/providers/filesystem/metadata.py and 1 other location - About 6 hrs to fix
                    waterbutler/providers/dropbox/metadata.py on lines 6..20

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

                    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

                    File provider.py has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import time
                    import base64
                    import typing
                    import hashlib
                    import logging
                    Severity: Minor
                    Found in waterbutler/providers/googlecloud/provider.py - About 5 hrs to fix

                      File provider.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import json
                      import typing
                      import logging
                      import mimetypes
                      
                      
                      Severity: Minor
                      Found in waterbutler/providers/gitlab/provider.py - About 5 hrs to fix

                        File provider.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import logging
                        from typing import Tuple
                        from urllib.parse import urlencode
                        
                        from waterbutler.core import exceptions, provider, streams
                        Severity: Minor
                        Found in waterbutler/providers/bitbucket/provider.py - About 5 hrs to fix

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

                                  if auth_hdrs and auth_hdrs.startswith('Bearer '):  # Bearer token
                                      bearer_token = auth_hdrs.split(' ')[1] if auth_hdrs.startswith('Bearer ') else None
                                      logger.debug('>>> RATE LIMITING >>> AUTH:TOKEN >>> {}'.format(bearer_token))
                                      return True, 'TOKEN__{}'.format(self._obfuscate_creds(bearer_token))
                          Severity: Major
                          Found in waterbutler/server/api/v1/provider/ratelimiting.py and 1 other location - About 4 hrs to fix
                          waterbutler/server/api/v1/provider/ratelimiting.py on lines 101..104

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

                                  if auth_hdrs and auth_hdrs.startswith('Basic '):  # Basic auth
                                      basic_creds = auth_hdrs.split(' ')[1] if auth_hdrs.startswith('Basic ') else None
                                      logger.debug('>>> RATE LIMITING >>> AUTH:BASIC >>> {}'.format(basic_creds))
                                      return True, 'BASIC__{}'.format(self._obfuscate_creds(basic_creds))
                          Severity: Major
                          Found in waterbutler/server/api/v1/provider/ratelimiting.py and 1 other location - About 4 hrs to fix
                          waterbutler/server/api/v1/provider/ratelimiting.py on lines 95..98

                          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

                          File provider.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import os
                          import hmac
                          import json
                          import time
                          import asyncio
                          Severity: Minor
                          Found in waterbutler/providers/cloudfiles/provider.py - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language