dszymczuk/dsEventCalendar

View on GitHub

Showing 21 of 21 total issues

File list_event.php has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php defined('C5_EXECUTE') or die('Access denied.');
?>

<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Event Calendar')); ?>

Severity: Minor
Found in single_pages/dashboard/event_calendar/list_event.php - About 7 hrs to fix

    Method view has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function view()
        {
            $db = Loader::db();
            if (!empty($_POST)) {
    
    
    Severity: Major
    Found in controllers/dashboard/event_calendar/event.php - About 3 hrs to fix

      Method installSettings has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function installSettings()
          {
              $db = Loader::db();
      
              //check is settings are duplicate
      Severity: Major
      Found in controller.php - About 2 hrs to fix

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

                    $lang_list = array("ar-ma","ar-sa","ar","bg","ca","cs","da","de-at","de","el","en-au","en-ca","en-gb","es","fa","fi","fr-ca","fr","he","hi","hr","hu","id","is","it","ja","ko","lt","lv","nl","pl","pt-br","pt","ro","ru","sk","sl","sr-cyrl","sr","sv","th","tr","uk","vi","zh-cn","zh-tw");
        Severity: Major
        Found in controllers/dashboard/event_calendar/settings.php and 1 other location - About 2 hrs to fix
        blocks/event_calendar/controller.php on lines 13..13

        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 140.

        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

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

            private $lang_list = array("ar-ma", "ar-sa", "ar", "bg", "ca", "cs", "da", "de-at", "de", "el", "en-au", "en-ca", "en-gb", "es", "fa", "fi", "fr-ca", "fr", "he", "hi", "hr", "hu", "id", "is", "it", "ja", "ko", "lt", "lv", "nl", "pl", "pt-br", "pt", "ro", "ru", "sk", "sl", "sr-cyrl", "sr", "sv", "th", "tr", "uk", "vi", "zh-cn", "zh-tw");
        Severity: Major
        Found in blocks/event_calendar/controller.php and 1 other location - About 2 hrs to fix
        controllers/dashboard/event_calendar/settings.php on lines 54..54

        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 140.

        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

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

            public function view()
            {
                 $db = Loader::db();
                if (!empty($_POST)) {
        
        
        Severity: Minor
        Found in controllers/dashboard/event_calendar/settings.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 view has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function view()
            {
                $db = Loader::db();
                if (!empty($_POST)) {
        
        
        Severity: Minor
        Found in controllers/dashboard/event_calendar/event.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 view has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function view()
            {
                 $db = Loader::db();
                if (!empty($_POST)) {
        
        
        Severity: Minor
        Found in controllers/dashboard/event_calendar/settings.php - About 1 hr to fix

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

              public function updateEvent()
              {
                  if (isset($_POST) && !empty($_POST)) {
                      //if calendarID === 0 -> is bad !!
                      if ($_POST['calendarID'] == 0)
          Severity: Minor
          Found in controllers/dashboard/event_calendar/list_event.php - About 1 hr to fix

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

                public function getEventsFromCalendar($calendarID, $typeID = 0)
                {
                    $db = Loader::db();
            
                    $q = "SELECT ECE.eventID as id,  ";
            Severity: Minor
            Found in libraries/dsEventCalendar.php - About 1 hr to fix

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

                  private function installSP($pkg)
                  {
                      Loader::model('single_page');
              
                      $p1 = SinglePage::add('/dashboard/event_calendar', $pkg);
              Severity: Minor
              Found in controller.php - About 1 hr to fix

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

                    public function view()
                    {
                        $db = Loader::db();
                
                
                
                Severity: Minor
                Found in controllers/dashboard/event_calendar/types.php - About 1 hr to fix

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

                      private function installSettings()
                      {
                          $db = Loader::db();
                  
                          //check is settings are duplicate
                  Severity: Minor
                  Found in controller.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 getEventsFromCalendar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getEventsFromCalendar($calendarID, $typeID = 0)
                      {
                          $db = Loader::db();
                  
                          $q = "SELECT ECE.eventID as id,  ";
                  Severity: Minor
                  Found in libraries/dsEventCalendar.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 view has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function view()
                      {
                          $db = Loader::db();
                  
                  
                  
                  Severity: Minor
                  Found in controllers/dashboard/event_calendar/types.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 updateEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function updateEvent()
                      {
                          if (isset($_POST) && !empty($_POST)) {
                              //if calendarID === 0 -> is bad !!
                              if ($_POST['calendarID'] == 0)
                  Severity: Minor
                  Found in controllers/dashboard/event_calendar/list_event.php - About 45 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 removeEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function removeEvent(){
                          if (isset($_POST) && !empty($_POST)) {
                              $eventID = $this->post('eventID');
                              if(is_numeric($eventID))
                              {
                  Severity: Minor
                  Found in controllers/dashboard/event_calendar/list_event.php - About 45 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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function update($calendar_id)
                      {
                          if (is_numeric($calendar_id)) {
                              $db = Loader::db();
                              $sql = "SELECT * FROM dsEventCalendar WHERE calendarID=" . $calendar_id;
                  Severity: Minor
                  Found in controllers/dashboard/event_calendar/calendar.php - About 45 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 updateDateEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function updateDateEvent(){
                          if (isset($_POST) && !empty($_POST)) {
                              //if calendarID === 0 -> is bad !!
                              if ($_POST['calendarID'] == 0)
                                  die("ERROR");
                  Severity: Minor
                  Found in controllers/dashboard/event_calendar/list_event.php - About 45 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 installSP has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function installSP($pkg)
                      {
                          Loader::model('single_page');
                  
                          $p1 = SinglePage::add('/dashboard/event_calendar', $pkg);
                  Severity: Minor
                  Found in controller.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

                  Severity
                  Category
                  Status
                  Source
                  Language