eidng8/sttbot

View on GitHub

Showing 78 of 223 total issues

Method export has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function export(): array
    {
        $epi = 0;
        $episodes = [];
        $missions = [];
Severity: Minor
Found in src/Wiki/Templates/MissionList.php - About 1 hr to fix

Method parse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in src/Wiki/Templates/InfoBox.php - About 1 hr to fix

Method testTuvix has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testTuvix()
    {
        $crew = $this->wiki->crew();
        $member = $crew->byName('Tuvix');
        $this->assertInstanceOf(CrewMember::class, $member);
Severity: Minor
Found in tests/Wiki/Templates/CrewListTest.php - About 1 hr to fix

Method parse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse()
    {
        preg_match('/\{\{currency\|([^}]+)}}\s*(.+)/iu', $this->found, $found);
        if (!$found || !$found[0]) {
            throw new EmptyTemplateException();
Severity: Minor
Found in src/Wiki/Templates/MissionCost.php - About 1 hr to fix

Method testCadetCrew has 28 lines of code (exceeds 25 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

Method toArray has 28 lines of code (exceeds 25 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

Method parse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse(): array
    {
        $this->name = [];
        $this->found = [];
        $parts = explode('|', trim($this->wikiText, "{ }\t\n\r\0\xb"));
Severity: Minor
Found in src/Wiki/Templates/Triple.php - About 1 hr to fix

Method checkExportedStepRequirements has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkExportedStepRequirements(
        array $step,
        int $idx,
        string $mission
    ) {
Severity: Minor
Found in tests/Wiki/Templates/MissionListTest.php - About 1 hr to fix

Method testRateStep has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

Method testEpisodeCrew has 28 lines of code (exceeds 25 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

Method testExportedMissions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testExportedMissions(array $exported)
    {
        $this->removeMissionTraitRich();

        $idx = 0;
Severity: Minor
Found in tests/Wiki/ExporterTest.php - About 1 hr to fix

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

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