ICTU/quality-time

View on GitHub

Showing 142 of 681 total issues

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

export function TrendGraph({ metric, measurements, loading }) {
    const dataModel = useContext(DataModel)
    const darkMode = useContext(DarkMode)
    const chartHeight = 250
    const estimatedTotalChartHeight = chartHeight + 200 // Estimate of the height including title and axis
Severity: Minor
Found in components/frontend/src/metric/TrendGraph.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 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 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 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 sort has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function sort(column, columnType, setColumnType, setSortColumn, setSortDirection, sortColumn, sortDirection) {
        Severity: Major
        Found in components/frontend/src/source/SourceEntities.js - About 50 mins to fix

          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

            Function sortedEntities has a Cognitive Complexity of 8 (exceeds 5 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 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 summarizeReportOnDate has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export function summarizeReportOnDate(dataModel, settings, report, measurements, date, tag) {
            Severity: Minor
            Found in components/frontend/src/report/report_utils.js - About 45 mins to fix

              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 SourceEntity has a Cognitive Complexity of 8 (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 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Minor
                Found in components/collector/src/model/issue_status.py - 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 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 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

                  Severity
                  Category
                  Status
                  Source
                  Language