Did not retrieve data from /rest/schultedev-pmd/latest/pmdJobBuildResult/details.json?buildKey=PROJ-BUILD7-JOB1&buildNumber=49&fileIndex=0&filePartIndex=0.

Issue #3 resolved
Former user created an issue

Violations count works, but detailed report don't work.

PHP basic metrics bundle v. 2.0.10 PHPMD 2.8.1

Comments (13)

  1. Markus Schulte repo owner

    Thanks for reporting this issue!
    Can you please open the URL /rest/schultedev-pmd/latest/pmdJobBuildResult/details.json?buildKey=PROJ-BUILD7-JOB1&buildNumber=49&fileIndex=0&filePartIndex=0 in your environment? An exception stacktrace should be shown, please paste it here.
    And could you please attach the PHPMD violations as .xml file?

  2. Albus Optimus
    17-Jun-2020 12:32:16    Starting task 'Process PMD/PHPMD result' of type 'eu.markusschulte.atlassian.bamboo.plugin.basic-metrics-bundle:pmdPmdJobTask'
    17-Jun-2020 12:32:16    Using /var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/reports/pmd.xml
    17-Jun-2020 12:32:16    Read from reports/pmd.xml, with a total count of 12 errors, auto split by 8000 into 1 part(s).
    17-Jun-2020 12:32:16    Finished task 'Process PMD/PHPMD result' with result: Success
    

    Continuous integration powered by Atlassian Bamboo version 7.0.3 build 70016 - 15 Apr 20

    /rest/schultedev-pmd/latest/pmdJobBuildResult/details.json?buildKey=PROJ-BUILD7-JOB1&buildNumber=51&fileIndex=0&filePartIndex=0

    Page not found

    Sorry, the page you were trying to reach does not exist. Try going back to the dashboard and browse the site to find the page you were looking for.

    Go to...

    Site homepage

    <?xml version="1.0" encoding="UTF-8" ?>
    <pmd version="@project.version@" timestamp="2020-06-17T09:32:13+00:00">
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Audit/Nova/Actions/Send.php">
        <violation beginline="86" endline="130" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="Modules\Audit\Nova\Actions" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" class="Send" method="fields" priority="3">
          The method fields() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
        </violation>
      </file>
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Expertise/Entities/Expertise.php">
        <violation beginline="43" endline="275" rule="TooManyPublicMethods" ruleset="Code Size Rules" package="Modules\Expertise\Entities" externalInfoUrl="https://phpmd.org/rules/codesize.html#toomanypublicmethods" class="Expertise" priority="3">
          The class Expertise has 25 public methods. Consider refactoring Expertise to keep number of public methods under 10.
        </violation>
      </file>
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Expertise/Nova/Resources/Expertise.php">
        <violation beginline="166" endline="414" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Nova\Resources" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" class="Expertise" method="fields" priority="3">
          The method fields() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
        </violation>
        <violation beginline="166" endline="414" rule="ExcessiveMethodLength" ruleset="Code Size Rules" package="Modules\Expertise\Nova\Resources" externalInfoUrl="https://phpmd.org/rules/codesize.html#excessivemethodlength" class="Expertise" method="fields" priority="3">
          The method fields() has 249 lines of code. Current threshold is set to 100. Avoid really long methods.
        </violation>
      </file>
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Expertise/Observers/ApplicationObserver.php">
        <violation beginline="80" endline="196" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Observers" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" class="ApplicationObserver" method="updated" priority="3">
          The method updated() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
        </violation>
        <violation beginline="80" endline="196" rule="ExcessiveMethodLength" ruleset="Code Size Rules" package="Modules\Expertise\Observers" externalInfoUrl="https://phpmd.org/rules/codesize.html#excessivemethodlength" class="ApplicationObserver" method="updated" priority="3">
          The method updated() has 117 lines of code. Current threshold is set to 100. Avoid really long methods.
        </violation>
      </file>
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Expertise/Observers/InvoiceObserver.php">
        <violation beginline="24" endline="81" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Observers" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" class="InvoiceObserver" method="updated" priority="3">
          The method updated() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        </violation>
      </file>
      <file name="/var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-BUILD7-JOB1/Modules/Expertise/Services/ExpertiseFill.php">
        <violation beginline="20" endline="650" rule="TooManyPublicMethods" ruleset="Code Size Rules" package="Modules\Expertise\Services" externalInfoUrl="https://phpmd.org/rules/codesize.html#toomanypublicmethods" class="ExpertiseFill" priority="3">
          The class ExpertiseFill has 12 public methods. Consider refactoring ExpertiseFill to keep number of public methods under 10.
        </violation>
        <violation beginline="20" endline="650" rule="ExcessiveClassComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Services" externalInfoUrl="https://phpmd.org/rules/codesize.html#excessiveclasscomplexity" class="ExpertiseFill" priority="3">
          The class ExpertiseFill has an overall complexity of 110 which is very high. The configured complexity threshold is 50.
        </violation>
        <violation beginline="318" endline="646" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Services" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" class="ExpertiseFill" method="checkConsistence" priority="3">
          The method checkConsistence() has a Cyclomatic Complexity of 66. The configured cyclomatic complexity threshold is 10.
        </violation>
        <violation beginline="318" endline="646" rule="NPathComplexity" ruleset="Code Size Rules" package="Modules\Expertise\Services" externalInfoUrl="https://phpmd.org/rules/codesize.html#npathcomplexity" class="ExpertiseFill" method="checkConsistence" priority="3">
          The method checkConsistence() has an NPath complexity of 4655295614160. The configured NPath complexity threshold is 200.
        </violation>
        <violation beginline="318" endline="646" rule="ExcessiveMethodLength" ruleset="Code Size Rules" package="Modules\Expertise\Services" externalInfoUrl="https://phpmd.org/rules/codesize.html#excessivemethodlength" class="ExpertiseFill" method="checkConsistence" priority="3">
          The method checkConsistence() has 329 lines of code. Current threshold is set to 100. Avoid really long methods.
        </violation>
      </file>
    </pmd>
    

  3. Markus Schulte repo owner

    Thanks for your fast feedback!
    I think it is not a problem that you cannot open (404 not found) /rest/schultedev-pmd/latest/pmdJobBuildResult/details.json?buildKey=PROJ-BUILD7-JOB1&buildNumber=51&fileIndex=0&filePartIndex=0 - though you might try dev console or similar for opening that URL, I am surprised 404 is given, not 5xx.
    Anyhow, usually the .xml file should be enough figuring out the issue.
    I will have time at the beginning of next week probably, so the issue should be fixed until Wednesday (2020-06-24).

  4. Albus Optimus

    I run bamboo in docker, maybe will help fragment of docker-compose.yml file:

    services:
    
      db:
        image: postgres
        restart: always
        volumes:
         - /data/postgres-for-atlassian:/var/lib/postgresql/data
         - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    
      bamboo:
        restart: always
        depends_on:
          - db
        image: atlassian/bamboo-server:7.0.3
        volumes:
          - /data/bamboo/var/atlassian/application-data/bamboo:/var/atlassian/application-data/bamboo
          - /data/bamboo/opt/atlassian/bamboo/temp:/opt/atlassian/bamboo/temp
          - /var/run/docker.sock:/var/run/docker.sock
    

  5. Albus Optimus

    In which directory does plugin save its files? Maybe need declarte this directory as a volume.

  6. Markus Schulte repo owner

    The plugin itself does not save files - as you know, the phpmd.xml (or similar) is being created by another task. The PHPMD task runs afterwards. If the .xml file would not be available when the PHPMD task is running, the build step would fail as part of the build. So I assume everything works fine here.
    For data management, the plugin is using Atlassian SDK APIs - so the Bamboo data management itself is being used.
    I would be surprised, if running Bamboo in Docker is the problem.

  7. Albus Optimus

    Then I have no more ideas what I can still see and what data to provide. FYI: JUnit Parser and Coverage report works ok.

  8. Markus Schulte repo owner

    I have tried to reproduce the issue, but failed. Setup: Bamboo v7.0.3, PHP basic metrics bundle v. 2.0.10, the .xml you provided.

    In the screenshot you submitted when creating this issue, I can see total violations count to be 2584. The .xml file you provided contains only 12 errors. I assume you are sending a subset. I fear the issue is somewhere in the 2572 left errors. Can you please send me the original .xml file to atlassian-marketplace@marqsschulte.de ? I hereby guarantee to delete the file once this issue is solved.

    I am still confused that you are receiving a 404 for

    /rest/schultedev-pmd/latest/pmdJobBuildResult/details.json?buildKey=PROJ-BUILD7-JOB1&buildNumber=51&fileIndex=0&filePartIndex=0 . It should either be 200 (sending the detail data), or 5xx (showing an exception). Do you have (JavaScript blocking) addons installed in your browser? Can you give another browser a try?

  9. Albus Optimus

    I specifically narrowed the scope of checks to get a small file. Link working does not depend on the number of errors found in the report.
    The small file also does not work.

  10. Markus Schulte repo owner

    Ok I see - well done reducing the issue to the small file! Thank for for further investigating.
    So, let’s find out, why you are getting a 404.
    Hmm, difficult. I have not heard of such a problem from any of my Atlassian Bamboo customers yet. Challenge accepted!
    In your Bamboo, please go to “Bamboo administration” → “Manage apps” (/plugins/servlet/upm). Are all 37 modules for the “PHP basic metrics bundle” installed?

    If not every module is enabled, which is not?
    I assume “PHP basic metrics bundle” is the only one of my apps you installed in Bamboo?

    And, ugly, oldy and goldy, did you try to uninstall (and restart Bamboo) and reinstall the app?

  11. Albus Optimus

    It's funny. Restarting the bamboo helped. All other plugins always worked without a restart.

    docker-compose restart bamboo
    

    Thanks! 🙂

  12. Markus Schulte repo owner

    You’re welcome!
    VERY strange - never heard one of my Atlassian Bamboo customers had such a problem .. anyhow, I am glad it is working now 🙂

  13. Log in to comment