eidng8/sttbot

View on GitHub

Showing 223 of 223 total issues

Function validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(): bool
    {
        if (empty($this->names) || !is_array($this->names)) {
            return false;
        }
Severity: Minor
Found in src/Wiki/Models/ReqAndBonus.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

Function testCadetCrew has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function testCadetCrew(array $crew)
    {
        $missions = $this->wiki->missions()->get('cadet');
        foreach ($crew['cadet'] as $idxCh => $challenge) {
            foreach ($challenge as $idxMis => $mission) {
Severity: Minor
Found in tests/AnalystTest.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

Function toArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function toArray(): array
    {
        $skills = [];
        foreach ($this->skills as $skill) {
            $skills[] = $skill->toArray();
Severity: Minor
Found in src/Wiki/Models/MissionStep.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

Function eachAway has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function eachAway(callable $func): void
    {
        foreach ($this->list as $type => $episodes) {
            foreach ($episodes as $episode => $missions) {
                foreach ($missions as $index => $mission) {
Severity: Minor
Found in src/Wiki/Templates/MissionList.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

Function testEpisodeCrew has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function testEpisodeCrew(array $crew)
    {
        $missions = $this->wiki->missions()->get('episodes');
        foreach ($crew['episodes'] as $idxEpi => $episode) {
            foreach ($episode as $idxMis => $mission) {
Severity: Minor
Found in tests/AnalystTest.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

Method validate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validate(): bool
    {
        $result = true;

        // validate cost
Severity: Minor
Found in src/Wiki/Models/Mission.php - About 1 hr to fix

Method fetchPictures has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fetchPictures(array $crew): array
    {
        if (empty($this->query)) {
            return $crew;
        }
Severity: Minor
Found in src/Wiki/Templates/CrewList.php - About 1 hr to fix

Method checkCadetStep1 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetStep1(Mission $model)
    {
        $step = $model->steps[0];
        $this->assertInstanceOf(MissionStep::class, $step);
        $this->assertCount(1, $step->skills);
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Method checkCadetAdvStep1 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetAdvStep1(Mission $model)
    {
        $step = $model->steps[0];
        $this->assertInstanceOf(MissionStep::class, $step);
        $this->assertCount(1, $step->skills);
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Method checkCadetStep5 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetStep5(Mission $model)
    {
        $step = $model->steps[4];
        $this->assertInstanceOf(MissionStep::class, $step);
        $this->assertCount(1, $step->skills);
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Method testRateStepCadet has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testRateStepCadet()
    {
        $analyst
            = new Analyst($this->wiki->missions(), $this->wiki->crew());

Severity: Minor
Found in tests/AnalystTest.php - About 1 hr to fix

Method checkCadetAdvStep5 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetAdvStep5(Mission $model)
    {
        $step = $model->steps[4];
        $this->assertInstanceOf(MissionStep::class, $step);
        $this->assertCount(1, $step->skills);
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Function stepBestCrew has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function stepBestCrew(
        MissionStep $step,
        int $idxStep,
        int $idxMission,
        int $idxEpisode,
Severity: Minor
Found in src/Wiki/Analyst.php - 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

The property $WIDTH_PORTRAIT_2X is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $WIDTH_PORTRAIT_1X5 is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $WIDTH_THUMBNAIL_2X is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $ns. Configured minimum length is 3.
Open

        $ns = '';
Severity: Minor
Found in src/Wiki/Templates/Triple.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The property $WIDTH_THUMBNAIL_1X is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $WIDTH_THUMBNAIL_1X5 is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $WIDTH_PORTRAIT_1X is not named in camelCase.
Open

class Query
{
    use Properties, Cache;

    /**
Severity: Minor
Found in src/Wiki/Api/Query.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Severity
Category
Status
Source
Language