fedebenelli/PyForFluids

View on GitHub

Showing 11 of 12 total issues

File gerg2008.py has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: MIT License (https://tldrlegal.com/license/mit-license)
# Copyright (c) 2021-2022 Federico Benelli and others.
# All rights reserved.
Severity: Minor
Found in pyforfluids/models/gerg2008.py - About 4 hrs to fix

    File core.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    # License: MIT License (https://tldrlegal.com/license/mit-license)
    # Copyright (c) 2021-2022 Federico Benelli and others.
    # All rights reserved.
    Severity: Minor
    Found in pyforfluids/core.py - About 2 hrs to fix

      Function calculate_properties has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def calculate_properties(
              self, temperature, pressure, density, composition, ideal=False
          ):
              """Calculate the thermodynamic properties of the given fluid.
      
      
      Severity: Minor
      Found in pyforfluids/models/gerg2008.py - About 1 hr to fix

        Function flash_pt has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def flash_pt(
            fluid, pressure, temperature, iterations=50, rtol=1e-5, atol=1e-5
        ):
            """Vapor-Liquid PT flash.
        
        
        Severity: Minor
        Found in pyforfluids/equilibrium/flash.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function density_iterator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def density_iterator(
                self, objective_pressure, vapor_phase=True, liquid_phase=True
            ):
                """With a given pressure and temperature value, get the fluid density.
        
        
        Severity: Minor
        Found in pyforfluids/core.py - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            def __init__(
        Severity: Major
        Found in pyforfluids/models/cubic.py - About 1 hr to fix

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

          def flash_pt(
          Severity: Minor
          Found in pyforfluids/equilibrium/flash.py - About 45 mins to fix

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

                def calculate_properties(
            Severity: Minor
            Found in pyforfluids/models/gerg2008.py - About 35 mins to fix

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

              def update_fluids(liquid, vapor, x, y, pressure):
              Severity: Minor
              Found in pyforfluids/equilibrium/flash.py - About 35 mins to fix

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

                    def calculate_properties(
                Severity: Minor
                Found in pyforfluids/models/cubic.py - About 35 mins to fix

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

                      def validate_ranges(self, temperature, pressure):
                          """Validate fluid temperature and pressure.
                  
                          Verify whether the fluid temperature and pressure values belong to the
                          normal, extended or invalid use range of the GERG2008 equation of
                  Severity: Minor
                  Found in pyforfluids/models/gerg2008.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

                  Severity
                  Category
                  Status
                  Source
                  Language