ICTU/quality-time

View on GitHub

Showing 126 of 683 total issues

Function source_options has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function source_options(reports, dataModel, currentMetricType, currentMetricUuid) {
    const metricSources = dataModel.metrics[currentMetricType].sources
    let options = []
    reports.forEach((report) => {
        Object.values(report.subjects).forEach((subject) => {
Severity: Minor
Found in components/frontend/src/widgets/menu_options.js - About 1 hr to fix

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

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

            export function CardDashboard({ cards, initialLayout, saveLayout }) {
                const cols = 32
                const cardWidth = 4
                const cardHeight = 6
                const [mousePos, setMousePos] = useState([0, 0, 0])
            Severity: Minor
            Found in components/frontend/src/dashboard/CardDashboard.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 create_issue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def create_issue(self, summary: str, description: str = "") -> tuple[str, str]:
                    """Create a new issue and return its key or an error message if creating the issue failed."""
                    project_key = self.issue_parameters.project_key
                    issue_type = self.issue_parameters.issue_type
                    labels = self.issue_parameters.issue_labels
            Severity: Minor
            Found in components/api_server/src/model/issue_tracker.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_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 create_measurement has a Cognitive Complexity of 9 (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 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