ICTU/quality-time

View on GitHub

Showing 126 of 683 total issues

Function SourceEntity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function SourceEntity({
    metric_uuid,
    source_uuid,
    hide_ignored_entities,
    entity,
Severity: Minor
Found in components/frontend/src/source/SourceEntity.js - About 55 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 add_source_parameter_hash_to_latest_measurement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def add_source_parameter_hash_to_latest_measurement(database: Database, report) -> int:
    """Add source parameter hashes to the latest measurements. Return the number of measurements changed."""
    # Added after Quality-time v5.12.0, see https://github.com/ICTU/quality-time/issues/8736
    count = 0
    for subject in subjects(report):
Severity: Minor
Found in components/api_server/src/initialization/migrations.py - About 55 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 check_parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_parameters(self) -> Self:
        """Check that if the source has a landing URL parameter it also has a URL parameter."""
        if "landing_url" in self.parameters and "url" not in self.parameters:
            msg = f"Source {self.name} has a landing URL but no URL"
            raise ValueError(msg)
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/source.py - About 55 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 access_parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def access_parameters(
    metrics: list[str],
    include: dict[str, bool] | None = None,
    source_type: str = "",
    source_type_format: Literal["", "CSV", "HTML", "JSON", "XML"] = "",
Severity: Minor
Found in components/shared_code/src/shared_data_model/parameters.py - About 55 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 verify_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def verify_user(database: Database, username: str, password: str) -> User:
    """Authenticate the user and return whether they are authorized to login and their email address."""
    ldap_config = get_ldap_config(username)
    try:
        ldap_servers = [Server(ldap_url, get_info=ALL) for ldap_url in ldap_config.get("ldap_urls")]
Severity: Minor
Found in components/api_server/src/routes/auth.py - About 55 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 hide_credentials has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def hide_credentials(data_model, *reports) -> None:
    """Hide the credentials in the reports. The data model must be passed so hiding also works when time traveling."""
    for source in iter_sources(*reports):
        for parameter_key in __password_parameter_keys(source, data_model):
            source["parameters"][parameter_key] = CREDENTIALS_REPLACEMENT_TEXT
Severity: Minor
Found in components/api_server/src/model/transformations.py - About 55 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 change_source_parameter has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def change_source_parameter(  # noqa: PLR0913
Severity: Major
Found in components/api_server/src/model/transformations.py - About 50 mins to fix

    Function deltaDescription has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function deltaDescription(dataModel, metric, scale, delta, improved, oldValue, newValue) {
    Severity: Major
    Found in components/frontend/src/subject/SubjectTableRow.js - About 50 mins to fix

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

          def __init__(  # noqa: PLR0913
      Severity: Major
      Found in components/collector/src/model/issue_status.py - About 50 mins to fix

        Function datetime_from_parts has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def datetime_from_parts(  # noqa: PLR0913
        Severity: Major
        Found in components/collector/src/collector_utilities/date_time.py - About 50 mins to fix

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

          function EditableTextInput(props) {
              let { label, required, set_value, ...otherProps } = props
              const initialValue = props.value || ""
              const [text, setText] = useState(initialValue)
          
          
          Severity: Minor
          Found in components/frontend/src/fields/TextInput.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 check_source_configuration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_source_configuration(self, source_key, configuration) -> None:
                  """Check that the metrics listed by the source configuration have the source as supported source."""
                  for configuration_key, configuration_value in configuration.items():
                      for metric_key in configuration_value.metrics:
                          if metric_key not in self.metrics:
          Severity: Minor
          Found in components/shared_code/src/shared_data_model/meta/data_model.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 issuePopupContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function issuePopupContent(issueStatus) {
              let popupContent = <TimeAgoWithDate date={issueStatus.created}>Created</TimeAgoWithDate>
              if (issueStatus.updated) {
                  popupContent = (
                      <>
          Severity: Minor
          Found in components/frontend/src/issue/IssueStatus.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 set_source_entity_attribute has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function set_source_entity_attribute(metric_uuid, source_uuid, entity_key, attribute, value, reload) {
          Severity: Minor
          Found in components/frontend/src/api/source.js - About 45 mins to fix

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

            function summarizeReportsOnDate(reports, measurements, date, tag, hiddenTags, dataModel) {
            Severity: Minor
            Found in components/frontend/src/report/ReportsOverviewDashboard.js - About 45 mins to fix

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

                  def __parse_test_results(self, json) -> Generator:
                      """Yield dicts with test result (applicable/incomplete/violations/passes) as key and rules as values."""
                      if isinstance(json, list):
                          if json and "tags" in json[0]:
                              yield {"violations": json}  # The items in the list are violated rules
              Severity: Minor
              Found in components/collector/src/source_collectors/axe_core/violations.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 labelDetails has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function labelDetails(issueStatus, settings) {
                  let details = [<Label.Detail key="name">{issueStatus.name || "?"}</Label.Detail>]
                  if (issueStatus.summary && settings.showIssueSummary.value) {
                      details.push(<Label.Detail key="summary">{issueStatus.summary}</Label.Detail>)
                  }
              Severity: Minor
              Found in components/frontend/src/issue/IssueStatus.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 sortMetrics has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function sortMetrics(dataModel, metrics, sortDirection, sortColumn, report, measurements) {
              Severity: Minor
              Found in components/frontend/src/subject/Subject.js - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if parameter_info.type == "multiple_choice":
                            # If the user didn't pick any values, select the default value if any, otherwise select all values:
                            default_value = parameter_info.default_value
                            value = self.__parameters.get(parameter_key) or default_value or parameter_info.values or []
                            # Ensure all values picked by the user are still allowed. Remove any values that are no longer allowed:
                Severity: Major
                Found in components/collector/src/model/parameters.py - About 40 mins to fix

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

                  export function metricStatusOnDate(metric_uuid, metric, measurements, date, dataModel) {
                  Severity: Minor
                  Found in components/frontend/src/report/report_utils.js - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language