eidng8/sttbot

View on GitHub

Showing 78 of 223 total issues

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

Method stepBestCrew has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        MissionStep $step,
        int $idxStep,
        int $idxMission,
        int $idxEpisode,
        string $type
Severity: Minor
Found in src/Wiki/Analyst.php - About 35 mins to fix

Function stats has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function stats(CrewMember $member)
    {
        foreach ($member->skills as $skill => $val) {
            if (empty($val)) {
                continue;
Severity: Minor
Found in src/Wiki/Templates/CrewList.php - About 35 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

Function parseMWHead has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseMWHead(string $head): array
    {
        $lines = explode("\n", $head);

        $intro = [];
Severity: Minor
Found in src/Wiki/Templates/Mission.php - About 35 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

Function parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse(): array
    {
        parent::parse();
        $mission = [];

Severity: Minor
Found in src/Wiki/Templates/InfoBox.php - About 35 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

Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(string $what = null): array
    {
        if ($this->models) {
            return empty($what) ? $this->models : $this->models[$what];
        }
Severity: Minor
Found in src/Wiki/Templates/MissionList.php - About 35 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

Function dehydrate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function dehydrate(&$title, &$value): void
    {
        $trim = "{}[] \t\r\n\xb\0";
        $title = trim(strtolower($title), $trim);
        switch ($title) {
Severity: Minor
Found in src/Wiki/Templates/InfoBox.php - About 35 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

Avoid too many return statements within this method.
Open

        return true;
Severity: Major
Found in src/Wiki/Models/ReqAndBonus.php - About 30 mins to fix

Function mapMissionAttributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function mapMissionAttributes(array $missions): array
    {
        $ret = [];
        foreach ($missions as $mission) {
            if (empty($mission['steps'])) {
Severity: Minor
Found in src/Wiki/Exporter.php - About 25 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

Function offsetSet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function offsetSet($offset, $value)
    {
        switch (strtolower($offset)) {
            case 'crewname':
                list($this->name, $this->page) = $this->parseName($value);
Severity: Minor
Found in src/Wiki/Models/CrewMember.php - About 25 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

Function fetchCadetCrew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function fetchCadetCrew(array $names, array $cadet)
    {
        foreach ($cadet as $episode => $missions) {
            $this->parse->page($names[$episode], 2);
            preg_match_all(
Severity: Minor
Found in src/Wiki/Templates/MissionList.php - About 25 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

Function canUnlock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function canUnlock(MissionStep $step): bool
    {
        foreach ($step->locks as $lock) {
            if (empty($lock)) {
                continue;
Severity: Minor
Found in src/Wiki/Models/CrewMember.php - About 25 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

Function each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function each(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 25 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

Function parseMissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseMissions(array $missions, string $episode): array
    {
        $info = [];
        $adv = 'adv:' == strtolower(substr($episode, 0, 4));
        foreach ($missions as $mission) {
Severity: Minor
Found in src/Wiki/Templates/MissionList.php - About 25 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

Severity
Category
Status
Source
Language