airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function load_contents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def load_contents(load_test_data: bool = False) -> dict[str, Any]:
    """Traverse configs directory and load contents"""
    root = files("superset") / "examples/configs"
    resource_names = (files("superset") / str(root)).iterdir()
    queue = [root / str(resource_name) for resource_name in resource_names]
Severity: Minor
Found in superset/examples/utils.py - About 45 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 findNonTabChildChartIds has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function findNonTabChildChartIds({ id, layout }) {
  const chartIds = [];
  function recurseFromNode(node) {
    if (node && node.type === CHART_TYPE) {
      if (node.meta && node.meta.chartId) {
Severity: Minor
Found in superset-frontend/src/dashboard/util/logging/findNonTabChildChartIds.js - About 45 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 parse_querystring has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def parse_querystring(qs):
    d = {}
    for k, v in parse.parse_qsl(qs):
        if k not in d:
            d[k] = v

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

Avoid deeply nested control flow statements.
Open

                            if sample.tzinfo:
                                tz = sample.tzinfo
                                series = pd.Series(array[column])
                                series = pd.to_datetime(series)
                                pa_data[i] = pa.Array.from_pandas(
Severity: Major
Found in superset/result_set.py - About 45 mins to fix

    Function downgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def downgrade():
        bind = op.get_bind()
        session = db.Session(bind=bind)
    
        for slc in session.query(Slice).all():
    Severity: Minor
    Found in superset/migrations/versions/2019-10-10_13-52_1495eb914ad3_time_range.py - About 45 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

    Avoid deeply nested control flow statements.
    Open

                        if child["filterType"] == "filter_select":
                            for parent in filter_by_key_and_field[str(other.id)].values():
                                if (
                                    parent["filterType"] in {"filter_select", "filter_time"}
                                    and parent["id"] not in child["cascadeParentIds"]
    Severity: Major
    Found in superset/migrations/shared/native_filters.py - About 45 mins to fix

      Function upgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def upgrade():
          op.add_column(
              "datasources", Column("schema_perm", String(length=1000), nullable=True)
          )
          op.add_column("slices", Column("schema_perm", String(length=1000), nullable=True))

      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

      Avoid deeply nested control flow statements.
      Open

                              for key in keys:
                                  val = filters[key]
                                  __from = val.pop("__from", "")
                                  __to = val.pop("__to", "")
                                  # if user already defined __time_range,

        Function create_tag_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_tag_relationship(
                objects_to_tag: list[tuple[ObjectType, int]],
                tag: Tag,
                bulk_create: bool = False,
            ) -> None:
        Severity: Minor
        Found in superset/daos/tag.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                            if getattr(record, col.name) == "":
                                setattr(record, col.name, None)
        
        

          Avoid deeply nested control flow statements.
          Open

                              while has_wide_columns:
                                  col_ids = get_wide_column_ids(item["children"], root)
                                  idx = 0
                                  # need 2nd loop since same column may reduce multiple times
                                  while idx < len(col_ids) and current_width > GRID_COLUMN_COUNT:

            Avoid deeply nested control flow statements.
            Open

                                if is_physical and drivername:
                                    quoted_expression = get_identifier_quoter(drivername)(
                                        column_name
                                    )
                                    if quoted_expression != column_name:

              Function downgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def downgrade():
                  bind = op.get_bind()
                  session = db.Session(bind=bind)
              
                  for slc in paginated_update(

              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 extra_validator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def extra_validator(value: str) -> str:
                  """
                  Validate that extra is a valid JSON string, and that metadata_params
                  keys are on the call signature for SQLAlchemy Metadata
                  """
              Severity: Minor
              Found in superset/databases/schemas.py - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                  if config["column"] == field:
                                      fltr.update(
                                          {
                                              "controlValues": {
                                                  "defaultToFirstItem": False,
              Severity: Major
              Found in superset/migrations/shared/native_filters.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if value is not None and re.search(r"^\s+|\s+$", value):
                                        setattr(record, col.name, value.strip())
                
                

                  Avoid deeply nested control flow statements.
                  Open

                                      if value is not None and value.strip() == "":
                                          setattr(record, col.name, None)
                  
                  
                  Severity: Major
                  Found in superset/migrations/versions/2019-03-21_10-22_d94d33dbe938_form_strip.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if how:
                                                params["resample_method"] = how
                    
                    
                    Severity: Major
                    Found in superset/migrations/versions/2019-06-28_13-17_ab8c66efdd01_resample.py - About 45 mins to fix

                      Function put has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def put(self, pk: int) -> Response:
                              """Update a database.
                              ---
                              put:
                                summary: Change a database
                      Severity: Minor
                      Found in superset/databases/api.py - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                              if fill_method:
                                                  params["resample_method"] = fill_method
                      
                                          # Ensure that the resample logic is fully defined.
                                          if "resample_method" not in params:
                      Severity: Major
                      Found in superset/migrations/versions/2019-06-28_13-17_ab8c66efdd01_resample.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language