src/Controller/SuiteApiController.php
Method postSuiteAction
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function postSuiteAction(Project $project, Campaign $campaign, Request $request)
{
if ($this->isInvalidToken($request, $project->getToken())) {
return $this->getInvalidTokenView();
}
Function postSuiteAction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function postSuiteAction(Project $project, Campaign $campaign, Request $request)
{
if ($this->isInvalidToken($request, $project->getToken())) {
return $this->getInvalidTokenView();
}
- Read upRead up
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
Open
return $suitesEntity;
Avoid too many return
statements within this method. Open
Open
return $this->view($violations, Response::HTTP_BAD_REQUEST);
Line exceeds 120 characters; contains 322 characters Open
Open
* description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1/limits -H "Content-Type: application/json" -H "X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001" -X PUT --data '{"warning":80, "success":95}'</code></pre>",
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
* description="Tests success limit. Integer between 0 and 100 %. Limit defined on project by default."
- Exclude checks
Line exceeds 120 characters; contains 214 characters Open
Open
* description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1 -H "X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001" -X DELETE</code></pre>",
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
Open
* description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites -X GET</code></pre>",
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Open
public function putSuiteLimitsAction(Project $project, Suite $suiteDB, SuiteLimitsDTO $suiteLimitsDTO, Request $request)
- Exclude checks
Line exceeds 120 characters; contains 343 characters Open
Open
* description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/junit -H "X-CIR-TKN: 1f4ffb19e4b9-02278af07b7d-4e370a76f001" -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>",
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
* description="Tests warning limit. Integer between 0 and 100 %. Limit defined on project by default."
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
Open
* description="Example: </br><pre><code>curl https://www.ci-report.io/api/projects/project-one/campaigns/1/suites/1 -X GET</code></pre>",
- Exclude checks