Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138846

QDoc: Make warning paths relative to a configured project root

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • None
    • Build tools: qdoc
    • DaVinci 122, DaVinci 123, DaVinci 124

      QDoc warning messages currently include absolute file paths emitted by the Location class (location.h/.cpp). The same source file therefore appears with different prefixes on different machines (for example, /Users/developer/project/src/myclass.cpp:42 on a laptop and /home/ci/workspace/src/myclass.cpp:42 in CI). These machine-specific paths make warning logs non-portable, undermine automated comparison of the logwarnings output between local and CI runs, and prevent meaningful trend tracking in version control without brittle path-normalization.

      Proposal

      Introduce a .qdocconf option named projectroot (alternatively repositoryroot). QDoc will resolve this setting to an absolute path internally. When it is present, the Location class should format warning messages using paths relative to this root; when it is absent, QDoc should keep the current absolute-path behavior. The implementation must integrate with the existing warning infrastructure, preserve line/column accuracy, and behave sensibly when a referenced file lies outside the configured root (e.g., by falling back to the absolute path). Interactions with existing path-related options such as sourcedirs and headerdirs should be considered to avoid surprises.

      Current vs. expected output

      Current:

      {{/Users/developer/project/src/myclass.cpp:42: (qdoc) warning: Undocumented parameter 'value'
      /home/ci/workspace/src/myclass.cpp:42: (qdoc) warning: Undocumented parameter 'value'}}

      Expected when projectroot is set:

      src/myclass.cpp:42: (qdoc) warning: Undocumented parameter 'value'

      Acceptance & documentation

      This change is complete when .qdocconf accepts the projectroot option; warnings use paths relative to that root across subdirectories; files outside the root continue to show absolute paths; accuracy of file, line, and column information is unchanged; and the QDoc documentation explains the new option and the fallback behavior.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            paulwicking Paul Wicking
            paulwicking Paul Wicking
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes