iterative/dvc

View on GitHub

Showing 148 of 242 total issues

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

def _read_metric(fd, typ=None, xpath=None, fname=None, branch=None):
Severity: Minor
Found in dvc/repo/metrics/show.py - About 35 mins to fix

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

    def open(path, repo_dir=None, remote=None, mode="r", encoding=None):
    Severity: Minor
    Found in dvc/api.py - About 35 mins to fix

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

          def _upload(
      Severity: Minor
      Found in dvc/remote/local/__init__.py - About 35 mins to fix

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

            def status(
        Severity: Minor
        Found in dvc/remote/local/__init__.py - About 35 mins to fix

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

              def _upload(
          Severity: Minor
          Found in dvc/remote/oss.py - About 35 mins to fix

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

            def modify(repo, path, typ=None, xpath=None, delete=False):
            Severity: Minor
            Found in dvc/repo/metrics/modify.py - About 35 mins to fix

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

              def loads_from(stage, s_list, use_cache=True, metric=False, persist=False):
              Severity: Minor
              Found in dvc/output/__init__.py - About 35 mins to fix

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

                    def find_root(cls, root=None):
                        if root is None:
                            root = os.getcwd()
                        else:
                            root = os.path.abspath(os.path.realpath(root))
                Severity: Minor
                Found in dvc/repo/__init__.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

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

                def main(argv=None):
                    """Run dvc CLI command.
                
                    Args:
                        argv: optional list of arguments to parse. sys.argv is used by default.
                Severity: Minor
                Found in dvc/main.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

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

                    def load(self):
                        """Loads state database."""
                        retries = 1
                        while True:
                            assert self.database is None
                Severity: Minor
                Found in dvc/state.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

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

                    def find_outs_by_path(self, path, outs=None, recursive=False):
                        if not outs:
                            # there is no `from_directory=path` argument because some data
                            # files might be generated to an upper level, and so it is
                            # needed to look at all the files (project root_dir)
                Severity: Minor
                Found in dvc/repo/__init__.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

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

                def checkout(self, target=None, with_deps=False, force=False, recursive=False):
                    from dvc.stage import StageFileDoesNotExistError, StageFileBadNameError
                
                    all_stages = self.stages()
                
                
                Severity: Minor
                Found in dvc/repo/checkout.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

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

                    def pull(self, checksum_infos, remote, jobs=None, show_checksums=False):
                        return self._process(
                            checksum_infos,
                            remote,
                Severity: Minor
                Found in dvc/remote/local/__init__.py and 1 other location - About 35 mins to fix
                dvc/remote/local/__init__.py on lines 420..423

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

                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 push(self, checksum_infos, remote, jobs=None, show_checksums=False):
                        return self._process(
                            checksum_infos,
                            remote,
                Severity: Minor
                Found in dvc/remote/local/__init__.py and 1 other location - About 35 mins to fix
                dvc/remote/local/__init__.py on lines 429..432

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

                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

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

                        if from_info.scheme != self.scheme or to_info.scheme != self.scheme:
                            raise NotImplementedError
                Severity: Minor
                Found in dvc/remote/ssh/__init__.py and 1 other location - About 30 mins to fix
                dvc/remote/ssh/__init__.py on lines 174..175

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

                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 isinstance(types, str):
                                types = [t.strip() for t in types.split(",")]
                Severity: Minor
                Found in dvc/remote/local/__init__.py and 1 other location - About 30 mins to fix
                dvc/config.py on lines 40..41

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

                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

                Avoid too many return statements within this function.
                Open

                        return ret
                Severity: Major
                Found in dvc/output/base.py - About 30 mins to fix

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

                          if from_info.scheme != self.scheme or to_info.scheme != self.scheme:
                              raise NotImplementedError
                  Severity: Minor
                  Found in dvc/remote/ssh/__init__.py and 1 other location - About 30 mins to fix
                  dvc/remote/ssh/__init__.py on lines 157..158

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

                  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

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

                  def csv_reader(unicode_csv_data, dialect=None, **kwargs):
                      """csv.reader doesn't support Unicode input, so need to use some tricks
                      to work around this.
                  
                      Source: https://docs.python.org/2/library/csv.html#csv-examples
                  Severity: Minor
                  Found in dvc/utils/compat.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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def init(root_dir=os.curdir, no_scm=False, force=False):
                      """
                      Creates an empty repo on the given directory -- basically a
                      `.dvc` directory with subdirectories for configuration and cache.
                  
                  
                  Severity: Minor
                  Found in dvc/repo/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

                  Severity
                  Category
                  Status
                  Source
                  Language