condorrocks/condor

View on GitHub

Showing 200 of 200 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

return [

    'account' => [
Severity: Major
Found in resources/lang/en/manage.php and 1 other location - About 1 day to fix
resources/lang/es/manage.php on lines 1..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 400.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

return [

    'account' => [
Severity: Major
Found in resources/lang/es/manage.php and 1 other location - About 1 day to fix
resources/lang/en/manage.php on lines 1..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 400.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

The class UptimeRobot has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
Open

class UptimeRobot
{
    private $base_uri = 'https://api.uptimerobot.com';
    private $apiKey;
    private $noJsonCallback;

The class UptimeRobotTest has 17 public methods. Consider refactoring UptimeRobotTest to keep number of public methods under 10.
Open

class UptimeRobotTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var UptimeRobot
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

return [

    'name' => 'Condor',
Severity: Major
Found in resources/lang/en/app.php and 1 other location - About 2 hrs to fix
resources/lang/es/app.php on lines 1..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

return [

    'name' => 'Condor',
Severity: Major
Found in resources/lang/es/app.php and 1 other location - About 2 hrs to fix
resources/lang/en/app.php on lines 1..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid excessively long variable names like $showMonitorAlertContacts. Keep variable name length under 20.
Open

    public function getMonitors($monitors = null, $customUptimeRatio = null, $logs = 0, $responseTimes = 0, $responseTimesAverage = 0, $alertContacts = 0, $showMonitorAlertContacts = 0, $showTimezone = 0, $search = '')

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

Method editMonitor has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
Severity: Major
Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

    Method newMonitor has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
    Severity: Major
    Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

      Method editMonitor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
          {
              $url = $this->base_uri.'/editMonitor?monitorID='.$monitorId;
      
              if (isset($monitorStatus)) {
      Severity: Minor
      Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

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

            public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
            {
                if (empty($friendlyName) || empty($URL) || empty($type)) {
                    throw new \Exception('Required key "name", "uri" or "type" not specified', 3);
                }
        Severity: Minor
        Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

          Method getMonitors has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function getMonitors($monitors = null, $customUptimeRatio = null, $logs = 0, $responseTimes = 0, $responseTimesAverage = 0, $alertContacts = 0, $showMonitorAlertContacts = 0, $showTimezone = 0, $search = '')
          Severity: Major
          Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

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

                public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
                {
                    if (empty($friendlyName) || empty($URL) || empty($type)) {
                        throw new \Exception('Required key "name", "uri" or "type" not specified', 3);
                    }
            Severity: Minor
            Found in packages/alariva/uptimerobot/src/UptimeRobot.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 editMonitor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
                {
                    $url = $this->base_uri.'/editMonitor?monitorID='.$monitorId;
            
                    if (isset($monitorStatus)) {
            Severity: Minor
            Found in packages/alariva/uptimerobot/src/UptimeRobot.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 __fetch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function __fetch($url)
                {
                    if (empty($url)) {
                        throw new \Exception('Value not specified: url', 1);
                    }
            Severity: Minor
            Found in packages/alariva/uptimerobot/src/UptimeRobot.php - About 1 hr to fix

              Each class must be in a namespace of at least one level (a top-level vendor name)
              Open

              class UptimeRobotTest extends PHPUnit_Framework_TestCase

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function destroy(Account $account)
                  {
                      logger()->info(__METHOD__);
                      logger()->info(sprintf('accountId:%s', $account->id));
              
              
              Severity: Minor
              Found in app/Http/Controllers/Manage/AccountController.php and 1 other location - About 1 hr to fix
              app/Http/Controllers/Manage/BoardController.php on lines 144..158

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 100.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function destroy(Board $board)
                  {
                      logger()->info(__METHOD__);
                      logger()->info(sprintf('boardId:%s', $board->id));
              
              
              Severity: Minor
              Found in app/Http/Controllers/Manage/BoardController.php and 1 other location - About 1 hr to fix
              app/Http/Controllers/Manage/AccountController.php on lines 117..131

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 100.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              The parameter $HTTPUsername is not named in camelCase.
              Open

                  public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
                  {
                      $url = $this->base_uri.'/editMonitor?monitorID='.$monitorId;
              
                      if (isset($monitorStatus)) {

              CamelCaseParameterName

              Since: 0.2

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

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 11 and the first side effect is on line 10.
              Open

              <?php
              Severity
              Category
              Status
              Source
              Language