jfx/ci-report

View on GitHub
src/Controller/SuiteApiController.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method postSuiteAction has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function postSuiteAction(Project $project, Campaign $campaign, Request $request)
    {
        if ($this->isInvalidToken($request, $project->getToken())) {
            return $this->getInvalidTokenView();
        }
Severity: Major
Found in src/Controller/SuiteApiController.php - About 2 hrs to fix

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

        public function postSuiteAction(Project $project, Campaign $campaign, Request $request)
        {
            if ($this->isInvalidToken($request, $project->getToken())) {
                return $this->getInvalidTokenView();
            }
    Severity: Minor
    Found in src/Controller/SuiteApiController.php - 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

    Avoid too many return statements within this method.
    Open

            return $suitesEntity;
    Severity: Major
    Found in src/Controller/SuiteApiController.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return $this->view($violations, Response::HTTP_BAD_REQUEST);
      Severity: Major
      Found in src/Controller/SuiteApiController.php - About 30 mins to fix

        Line exceeds 120 characters; contains 322 characters
        Open

             *     description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1/limits -H &quot;Content-Type: application/json&quot; -H &quot;X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001&quot; -X PUT --data '{&quot;warning&quot;:80, &quot;success&quot;:95}'</code></pre>",

        Line exceeds 120 characters; contains 122 characters
        Open

             *                description="Tests success limit. Integer between 0 and 100 %. Limit defined on project by default."

        Line exceeds 120 characters; contains 214 characters
        Open

             *     description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1 -H &quot;X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001&quot; -X DELETE</code></pre>",

        Line exceeds 120 characters; contains 144 characters
        Open

             *     description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites -X GET</code></pre>",

        Line exceeds 120 characters; contains 124 characters
        Open

            public function putSuiteLimitsAction(Project $project, Suite $suiteDB, SuiteLimitsDTO $suiteLimitsDTO, Request $request)

        Line exceeds 120 characters; contains 343 characters
        Open

             *     description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/junit -H &quot;X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001&quot; -X POST -F warning=80 -F success=95 -F 'junitfile=@/path/to/junit.xml'</code></pre><p>(@ symbol is mandatory at the beginning of the file path)</p>",

        Line exceeds 120 characters; contains 122 characters
        Open

             *                description="Tests warning limit. Integer between 0 and 100 %. Limit defined on project by default."

        Line exceeds 120 characters; contains 146 characters
        Open

             *     description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1 -X GET</code></pre>",

        There are no issues that match your filters.

        Category
        Status