alientronics/fleetany-web

View on GitHub

Showing 188 of 188 total issues

Function configFromISO has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function configFromISO(config) {
        var i, l,
            string = config._i,
            match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
            allowTime, dateFormat, timeFormat, tzFormat;
Severity: Minor
Found in public/js/moment.js - About 1 hr to fix

    Method testVehiclesStatistics has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testVehiclesStatistics()
        {
            $vehicles = [];
            for ($i = 0; $i < 9; $i++) {
                $vehicles[] = factory(\App\Entities\Vehicle::class)->create([
    Severity: Minor
    Found in tests/unit/DashboardTest.php - About 1 hr to fix

      Function getUserLanguage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getUserLanguage($lang)
          {
              $availableLangs = $this->getAvailableLanguages();
                  
              if (!empty($lang)) {
      Severity: Minor
      Found in app/Entities/User.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 edit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function edit($idPart)
          {
              $part = $this->partRepo->find($idPart);
              $part = $this->partRepo->getInputs($part);
              $this->helper->validateRecord($part);
      Severity: Minor
      Found in app/Http/Controllers/PartController.php - About 1 hr to fix

        Method getTireAndSensorData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getTireAndSensorData($inputs)
            {
                $tire = Part::join('types', 'parts.part_type_id', '=', 'types.id')
                    ->where('parts.position', $inputs['position'])
                    ->where('parts.vehicle_id', $inputs['vehicle_id'])
        Severity: Minor
        Found in app/Repositories/VehicleRepositoryEloquent.php - About 1 hr to fix

          Method testServicesStatistics has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testServicesStatistics()
              {
                  $type = factory(\App\Entities\Type::class)->create([
                      'company_id' => $this->company_id,
                      'entity_key' => 'entry',
          Severity: Minor
          Found in tests/unit/DashboardTest.php - About 1 hr to fix

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

            <?php
            
            return [
                'repair'   => 'repair',
                'calibrationMaintenance' => 'calibration maintenance',
            Severity: Major
            Found in resources/lang/en/setup.php and 1 other location - About 1 hr to fix
            resources/lang/pt-br/setup.php on lines 1..26

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

            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 [
                'repair'   => 'reparo',
                'calibrationMaintenance' => 'manuten&ccedil;&atilde;o de calibragem',
            Severity: Major
            Found in resources/lang/pt-br/setup.php and 1 other location - About 1 hr to fix
            resources/lang/en/setup.php on lines 1..26

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

            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

            Method downloadData has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function downloadData($idPart)
                {
                    ini_set('auto_detect_line_endings', true);
                    $sensor_data = $filters = null;
                    $filters = $this->helper->getFilters(
            Severity: Minor
            Found in app/Http/Controllers/TireController.php - About 1 hr to fix

              Function copyConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function copyConfig(to, from) {
                      var i, prop, val;
              
                      if (!isUndefined(from._isAMomentObject)) {
                          to._isAMomentObject = from._isAMomentObject;
              Severity: Minor
              Found in public/js/moment.js - About 1 hr to fix

                Function validateRecord has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validateRecord($record)
                    {
                        if (empty($record) || $record->company_id != Auth::user()['company_id']) {
                            Redirect::to('/')->with('danger', Lang::get('general.accessdenied'))->send();
                        }
                Severity: Minor
                Found in app/Repositories/HelperRepository.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 results has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function results($filters = [])
                    {
                        $filters = $this->formatFilters($filters);
                        
                        $parts = $this->scopeQuery(function ($query) use ($filters) {
                Severity: Minor
                Found in app/Repositories/PartRepositoryEloquent.php - About 1 hr to fix

                  Method getFleetTireAndSensorData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getFleetTireAndSensorData($updateDatetime = null, $vehicleId = null)
                      {
                          
                          $parts = $this->getFleetTireAndSensorParts($partsData, $vehicleId);
                           
                  Severity: Minor
                  Found in app/Repositories/FleetRepositoryEloquent.php - About 1 hr to fix

                    Function dayOfYearFromWeekInfo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function dayOfYearFromWeekInfo(config) {
                            var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
                    
                            w = config._w;
                            if (w.GG != null || w.W != null || w.E != null) {
                    Severity: Minor
                    Found in public/js/moment.js - About 1 hr to fix

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

                          public function store()
                          {
                              try {
                                  $this->typeRepo->validator();
                                  $inputs = $this->request->all();
                      Severity: Major
                      Found in app/Http/Controllers/TypeController.php and 1 other location - About 1 hr to fix
                      app/Http/Controllers/ModelController.php on lines 54..68

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

                      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 store()
                          {
                              try {
                                  $this->modelRepo->validator();
                                  $inputs = $this->request->all();
                      Severity: Major
                      Found in app/Http/Controllers/ModelController.php and 1 other location - About 1 hr to fix
                      app/Http/Controllers/TypeController.php on lines 49..63

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

                      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 configFromArray has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function configFromArray (config) {
                              var i, date, input = [], currentDate, yearToUse;
                      
                              if (config._d) {
                                  return;
                      Severity: Minor
                      Found in public/js/moment.js - About 1 hr to fix

                        Method results has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function results($filters = [])
                            {
                                $filters = $this->formatFilters($filters);
                                
                                $trips = $this->scopeQuery(function ($query) use ($filters) {
                        Severity: Minor
                        Found in app/Repositories/TripRepositoryEloquent.php - About 1 hr to fix

                          Function vehicleHistory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function vehicleHistory($fleetData, $dateIni, $dateEnd)
                              {
                                  $tireSensorData['positions'] = [];
                                  $partsIds = [];
                                  if (!empty($fleetData['tireData'])) {
                          Severity: Minor
                          Found in app/Http/Controllers/VehicleController.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 getLastDatetimeData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function getLastDatetimeData($tireData)
                              {
                                  $lastData = "";
                                  if (!empty($tireData)) {
                                      foreach ($tireData as $position => $value) {
                          Severity: Minor
                          Found in app/Http/Controllers/VehicleController.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

                          Severity
                          Category
                          Status
                          Source
                          Language