jacquev6/LowVoltage

View on GitHub

Showing 329 of 329 total issues

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

    def provisioned_throughput(self, read_capacity_units, write_capacity_units):
        """
        Set the read and write provisioned throughput for the table or the active index.

        See :meth:`range_key`, :meth:`global_secondary_index` or :meth:`local_secondary_index` for examples.
Severity: Minor
Found in LowVoltage/actions/create_table.py and 1 other location - About 30 mins to fix
LowVoltage/actions/update_table.py on lines 209..217

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 {"BS": [base64.b64encode(b).decode("utf8") for b in value]}
Severity: Major
Found in LowVoltage/actions/conversion.py - About 30 mins to fix

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

        def test_return_consumed_capacity_indexes(self):
            self.assertEqual(Query("Aaa").return_consumed_capacity_indexes().payload, {"TableName": "Aaa", "ReturnConsumedCapacity": "INDEXES"})
    Severity: Major
    Found in LowVoltage/actions/query.py and 9 other locations - About 30 mins to fix
    LowVoltage/actions/query.py on lines 587..588
    LowVoltage/actions/query.py on lines 590..591
    LowVoltage/actions/query.py on lines 593..594
    LowVoltage/actions/query.py on lines 605..606
    LowVoltage/actions/query.py on lines 611..612
    LowVoltage/actions/scan.py on lines 333..334
    LowVoltage/actions/scan.py on lines 336..337
    LowVoltage/actions/scan.py on lines 348..349
    LowVoltage/actions/scan.py on lines 351..352

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

        def test_return_consumed_capacity_none(self):
            self.assertEqual(Query("Aaa").return_consumed_capacity_none().payload, {"TableName": "Aaa", "ReturnConsumedCapacity": "NONE"})
    Severity: Major
    Found in LowVoltage/actions/query.py and 9 other locations - About 30 mins to fix
    LowVoltage/actions/query.py on lines 587..588
    LowVoltage/actions/query.py on lines 590..591
    LowVoltage/actions/query.py on lines 593..594
    LowVoltage/actions/query.py on lines 605..606
    LowVoltage/actions/query.py on lines 608..609
    LowVoltage/actions/scan.py on lines 333..334
    LowVoltage/actions/scan.py on lines 336..337
    LowVoltage/actions/scan.py on lines 348..349
    LowVoltage/actions/scan.py on lines 351..352

    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 {"NS": [str(n) for n in value]}
    Severity: Major
    Found in LowVoltage/actions/conversion.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return set(value["SS"])
      Severity: Major
      Found in LowVoltage/actions/conversion.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return None
        Severity: Major
        Found in LowVoltage/actions/conversion.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return [_convert_db_to_value(v) for v in value["L"]]
          Severity: Major
          Found in LowVoltage/actions/conversion.py - About 30 mins to fix

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

            def _table_is_fully_active(table):
                if table.global_secondary_indexes is not None:
                    for gsi in table.global_secondary_indexes:
                        if gsi.index_status != "ACTIVE":
                            return False
            Severity: Minor
            Found in LowVoltage/compounds/wait_for_table_activation.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