eidng8/sttbot

View on GitHub

Showing 223 of 223 total issues

Function mapTraits has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function mapTraits(array $traits): array
    {
        $ret = [];
        foreach ($traits as $index => $list) {
            if (empty($list)) {
Severity: Minor
Found in src/Wiki/Exporter.php - About 2 hrs 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 parseStepProp has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseStepProp(
        string $key,
        string $values,
        string $advValues
    ) {
Severity: Minor
Found in src/Wiki/Templates/Mission.php - About 2 hrs 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 parseStep has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseStep(string $text): array
    {
        $columns = [
            'steptitle'  => 'name',
            'choice'     => 'alt',
Severity: Major
Found in src/Wiki/Templates/Mission.php - About 2 hrs to fix

File CrewList.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: JC
 * Date: 2016-10-23
Severity: Minor
Found in src/Wiki/Templates/CrewList.php - About 2 hrs to fix

Method checkCadetAdvStep3 has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Method checkCadetStep3 has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function skillValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function skillValue(string $table, array $skills): ?array
    {
        $regex = '/^\s*\|\s*\d+\s*$(.+?)\|[}-].*?$/imsu';
        if (!preg_match_all($regex, $table, $levels)) {
            return null;
Severity: Minor
Found in src/Wiki/Templates/CrewList.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 imageInfo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function imageInfo(array $files, $width = 0): array
    {
        if (empty($files)) {
            return [];
        }
Severity: Minor
Found in src/Wiki/Api/Query.php - About 1 hr to fix

Method checkExportedMissionSteps has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkExportedMissionSteps(array $mission)
    {
        $this->assertArrayHasKey(
            'steps',
            $mission,
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Function fetchImages has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function fetchImages(array $missions): void
    {
        foreach ($missions as $mission) {
            $mission = $mission->get();
            $mission->image = $this->query->imageInfo(
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 flattenSteps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function flattenSteps(array &$mission): void
    {
        foreach ($mission['steps'] as &$step) {
            if (empty($step['locks'])) {
                unset($step['locks']);
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

Method stepBestCrew has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function stepBestCrew(
        MissionStep $step,
        int $idxStep,
        int $idxMission,
        int $idxEpisode,
Severity: Minor
Found in src/Wiki/Analyst.php - About 1 hr to fix

Method createModel has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createModel(): MissionModel
    {
        $model = new MissionModel();
        /* @var InfoBox $info */
        $info = $this->found['info'];
Severity: Minor
Found in src/Wiki/Templates/Mission.php - About 1 hr to fix

Method testModel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testModel()
    {
        $this->assertSame('Changeling Bashir', static::$model['name']);
        $this->assertSame('Changeling Bashir', static::$model['CrewName']);
        $this->assertSame('Changeling%20Bashir', static::$model->uri());
Severity: Minor
Found in tests/Models/CrewMemberTest.php - About 1 hr to fix

Method testExportedCharacters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testExportedCharacters(array $exported)
    {
        $this->assertSame(
            count(static::$wiki->crew()->get()),
            count($exported['crew'])
Severity: Minor
Found in tests/Wiki/ExporterTest.php - About 1 hr to fix

Function fetchPictures has a Cognitive Complexity of 12 (exceeds 5 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

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 validate has a Cognitive Complexity of 12 (exceeds 5 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

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 byName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function byName(string $name, string $epName = null): ?MissionModel
    {
        $search = trim(strtolower($name));
        $epSearch = trim(strtolower($epName));
        foreach ($this->list as $episodes) {
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

Method testEpisodeMission has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testEpisodeMission()
    {
        // @codingStandardsIgnoreStart
        $text
            = <<<'EOT'
Severity: Minor
Found in tests/Wiki/Templates/InfoBoxTest.php - About 1 hr to fix

Method checkCadetAdvStep4 has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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