eidng8/sttbot

View on GitHub

Showing 78 of 223 total issues

File MissionListTest.php has 624 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: JC
 * Date: 2016-11-18
Severity: Major
Found in tests/Wiki/Templates/MissionListTest.php - About 1 day to fix

Function imageInfo has a Cognitive Complexity of 29 (exceeds 5 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 4 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

File MissionTest.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: JC
 * Date: 2016-11-28
Severity: Minor
Found in tests/Wiki/Templates/Missions/MissionTest.php - About 3 hrs to fix

CrewMember has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class CrewMember extends Model implements Hyperlink
{
    /**
     * Member name, also used in generating URI & page
     *
Severity: Minor
Found in src/Wiki/Models/CrewMember.php - About 2 hrs to fix

Function parseStep has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseStep(string $text): array
    {
        $columns = [
            'steptitle'  => 'name',
            'choice'     => 'alt',
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 testNew has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testNew()
    {
        $api = $this->newApiInstance();
        $text = (file_get_contents(
            static::DIR_SAMPLE . '/Crew-crew_member_list.txt'
Severity: Major
Found in tests/Wiki/Templates/CrewListTest.php - About 2 hrs to fix

MissionListTest has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class MissionListTest extends TestCase
{
    private $wiki;

    /**
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 2 hrs to fix

Method checkCadetAdvMissionSteps has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetAdvMissionSteps(MissionModel $model)
    {
        $this->checkMissionStep(
            $model->steps[0],
            [
Severity: Major
Found in tests/Wiki/Templates/Missions/MissionTest.php - About 2 hrs to fix

Method checkCadetMissionSteps has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkCadetMissionSteps(MissionModel $model)
    {
        $this->checkMissionStep(
            $model->steps[0],
            [
Severity: Major
Found in tests/Wiki/Templates/Missions/MissionTest.php - About 2 hrs to fix

File MissionList.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

Method parseStepProp has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseStepProp(
        string $key,
        string $values,
        string $advValues
    ) {
Severity: Major
Found in src/Wiki/Templates/Mission.php - About 2 hrs to fix

File Mission.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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
Severity
Category
Status
Source
Language