ICTU/quality-time

View on GitHub

Showing 142 of 681 total issues

Function StringInputWithSuggestions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function StringInputWithSuggestions(props) {
    let { editableLabel, label, error, options, placeholder, required, set_value, warning, ...otherProps } = props
    placeholder = placeholder || "none"
    const initialValue = props.value || ""
    const [stringOptions, setStringOptions] = useState([
Severity: Minor
Found in components/frontend/src/fields/StringInput.js - About 1 hr to fix

    Function labelDetails has 32 lines of code (exceeds 25 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 1 hr to fix

      Function SourceParameter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function SourceParameter({
          help,
          help_url,
          index,
          parameter_key,
      Severity: Minor
      Found in components/frontend/src/source/SourceParameter.js - 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 get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, parameter_key: str, quote: bool = False) -> str | list[str]:
              """Return the parameter with the given key."""
      
              def quote_if_needed(parameter_value: str) -> str:
                  """Quote the string if needed."""
      Severity: Minor
      Found in components/collector/src/model/parameters.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 TargetVisualiser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function TargetVisualiser({ metric }) {
          const dataModel = useContext(DataModel)
          const unit = formatMetricScaleAndUnit(metric, dataModel)
          if (metric.evaluate_targets === false) {
              return (
      Severity: Minor
      Found in components/frontend/src/metric/Target.js - 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 copy_entity_user_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def copy_entity_user_data(self, source: Source) -> None:  # pragma: no feature-test-cover
              """Copy the user entity data of the source to this source."""
              new_entity_keys = {entity["key"] for entity in self.get("entities", [])}
              # Sometimes the key Quality-time generates for entities needs to change, e.g. when it turns out not to be
              # unique. Create a mapping of old keys to new keys so we can move the entity user data to the new keys
      Severity: Minor
      Found in components/shared_code/src/shared/model/source.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 TrendSparkline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function TrendSparkline({ measurements, scale, report_date }) {
          const stroke = useContext(DarkMode) ? "rgba(255, 255, 255, 0.87)" : "black"
          if (scale === "version_number") {
              return null
          }
      Severity: Minor
      Found in components/frontend/src/measurement/TrendSparkline.js - 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 Input has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function Input(props) {
          let { editableLabel, label, error, prefix, required, set_value, warning, ...otherProps } = props
          const initialValue = props.value || ""
          const [value, setValue] = useState(initialValue)
      
      
      Severity: Minor
      Found in components/frontend/src/fields/Input.js - 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 useBoundingBox has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useBoundingBox = () => {
          const ref = useRef()
          const [boundingBox, setBoundingBox] = useState({})
          // As we don't know how long animations after a resize or full screen event take,
          // we schedule several timeouts to recalculate the bounding box:
      Severity: Minor
      Found in components/frontend/src/hooks/boundingbox.js - About 1 hr to fix

        Function sortedEntities has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function sortedEntities(columnType, sortColumn, sortDirection, source) {
            let entities = Array.from(source.entities)
            if (sortColumn !== null) {
                let parse
                if (sortColumn === "entity_status") {
        Severity: Minor
        Found in components/frontend/src/source/SourceEntities.js - About 1 hr to fix

          Function move_item has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def move_item(
              container: Report | Subject | Metric,
              item_to_move: Subject | Metric | Source,
              new_position: Position,
          ) -> tuple[int, int]:
          Severity: Minor
          Found in components/api_server/src/model/actions.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 _sources_to_change has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def _sources_to_change(reports, items, scope: EditScope) -> Iterator:
              """Return the sources to change, given the scope."""
              for report in _reports_to_change(reports, items[-1], scope):
                  for subject_uuid, subject in _subjects_to_change(report, items[2], scope):
                      for metric_uuid, metric in _metrics_to_change(subject, items[1], scope):
          Severity: Minor
          Found in components/api_server/src/model/transformations.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 replace_report_uuids has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def replace_report_uuids(*reports) -> None:
              """Change all uuids in this report."""
              for report in reports:
                  report["report_uuid"] = uuid()
                  for subject_uuid, subject in list(report.get("subjects", {}).items()):
          Severity: Minor
          Found in components/api_server/src/model/transformations.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 check_metric_supports_source has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_metric_supports_source(self) -> None:
                  """Check that the source parameters refer to metrics that list the source as allowed source."""
                  for source_key, source in self.sources.items():
                      for parameter_key, parameter in source.parameters.items():
                          for metric_key in parameter.metrics:
          Severity: Minor
          Found in components/shared_code/src/shared_data_model/meta/data_model.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 create_measurement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def create_measurement(database: Database, measurement_data: dict) -> None:
              """Put the measurement in the database."""
              metric_uuid = measurement_data["metric_uuid"]
              report_uuid = measurement_data["report_uuid"]
              if (metric := latest_metric(database, report_uuid, metric_uuid)) is None:
          Severity: Minor
          Found in components/collector/src/database/measurements.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 SourceStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export function SourceStatus({ metric, measurement_source }) {
              const dataModel = useContext(DataModel)
              // Source may be deleted from report but still referenced in the latest measurement, be prepared:
              if (!Object.keys(metric.sources).includes(measurement_source.source_uuid)) {
                  return null
          Severity: Minor
          Found in components/frontend/src/measurement/SourceStatus.js - 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 ariaChartLabel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function ariaChartLabel(summary) {
              let label = ""
              Object.entries(summary).forEach(([date, count]) => {
                  const nrMetrics = sum(count)
                  const nrMetricsLabel = nrMetrics === 0 ? "no metrics" : pluralize(`${nrMetrics} metric`, nrMetrics)
          Severity: Minor
          Found in components/frontend/src/dashboard/MetricSummaryCard.js - About 1 hr to fix

            Function getMetricResponseOverrun has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getMetricResponseOverrun(metric_uuid, metric, report, measurements, dataModel) {
                const consolidatedMeasurements = getMetricResponseOverruns(metric_uuid, metric, measurements, dataModel)
                const scale = getMetricScale(metric, dataModel)
                let totalOverrun = 0 // Amount of time the desired response time was not achieved for this metric
                const overruns = []
            Severity: Minor
            Found in components/frontend/src/utils.js - About 1 hr to fix

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

                  def check_source_has_parameters_for_each_supported_metric(self) -> None:
                      """Check that the sources have at least one parameter for each metric supported by the source."""
                      for metric_key, metric in self.metrics.items():
                          for source_key in metric.sources:
                              source = self.sources[source_key]
              Severity: Minor
              Found in components/shared_code/src/shared_data_model/meta/data_model.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

              Severity
              Category
              Status
              Source
              Language