Covivo/mobicoop

View on GitHub

Showing 1,607 of 1,615 total issues

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

  if (err) {
    console.error(kuler('Cannot copy to specified path!\n', 'red'));
    console.error(err);
    process.exit(0);
  }
Severity: Minor
Found in bin/helpers/createFrontCanvas.js and 1 other location - About 35 mins to fix
bin/helpers/createFrontCanvas.js on lines 73..77

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

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 4 locations. Consider refactoring.
Open

        if (in_array('communityId', array_keys($fields))) {
            if (null === $fields['communityId']) {
                $event->setCommunity(null);
            } elseif ($community = $this->communityRepository->find($fields['communityId'])) {
                // set the new community
Severity: Major
Found in api/src/Event/Admin/Service/EventManager.php and 3 other locations - About 35 mins to fix
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 155..164
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 167..176
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 179..188

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

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 4 locations. Consider refactoring.
Open

    public function getRandomTime(string $start, string $end)
    {
        $start = \DateTime::createFromFormat('H:i', $start);
        $end = \DateTime::createFromFormat('H:i', $end);
        $randomTimestamp = mt_rand($start->getTimestamp(), $end->getTimestamp());
Severity: Major
Found in api/src/Import/Controller/FakeUserController.php and 3 other locations - About 35 mins to fix
api/src/Import/Controller/FakeUserController.php on lines 262..270
api/src/Import/Service/FakeManager.php on lines 389..397
api/src/Import/Service/FakeManager.php on lines 399..407

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

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 4 locations. Consider refactoring.
Open

        if (in_array('relayPointTypeId', array_keys($fields))) {
            if (null === $fields['relayPointTypeId']) {
                $relayPoint->setRelayPointType(null);
            } elseif ($type = $this->relayPointTypeRepository->find($fields['relayPointTypeId'])) {
                // set the new type
Severity: Major
Found in api/src/RelayPoint/Admin/Service/RelayPointManager.php and 3 other locations - About 35 mins to fix
api/src/Event/Admin/Service/EventManager.php on lines 135..144
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 167..176
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 179..188

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

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 4 locations. Consider refactoring.
Open

        if (in_array('structureId', array_keys($fields))) {
            if (null === $fields['structureId']) {
                $relayPoint->setStructure(null);
            } elseif ($structure = $this->structureRepository->find($fields['structureId'])) {
                // set the new structure
Severity: Major
Found in api/src/RelayPoint/Admin/Service/RelayPointManager.php and 3 other locations - About 35 mins to fix
api/src/Event/Admin/Service/EventManager.php on lines 135..144
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 155..164
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 167..176

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

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 4 locations. Consider refactoring.
Open

    public function getRandomDate(string $start, string $end)
    {
        $start = \DateTime::createFromFormat('Y-m-d', $start);
        $end = \DateTime::createFromFormat('Y-m-d', $end);
        $randomTimestamp = mt_rand($start->getTimestamp(), $end->getTimestamp());
Severity: Major
Found in api/src/Import/Service/FakeManager.php and 3 other locations - About 35 mins to fix
api/src/Import/Controller/FakeUserController.php on lines 262..270
api/src/Import/Controller/FakeUserController.php on lines 272..280
api/src/Import/Service/FakeManager.php on lines 399..407

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

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 4 locations. Consider refactoring.
Open

    public function getRandomTime(string $start, string $end)
    {
        $start = \DateTime::createFromFormat('H:i', $start);
        $end = \DateTime::createFromFormat('H:i', $end);
        $randomTimestamp = mt_rand($start->getTimestamp(), $end->getTimestamp());
Severity: Major
Found in api/src/Import/Service/FakeManager.php and 3 other locations - About 35 mins to fix
api/src/Import/Controller/FakeUserController.php on lines 262..270
api/src/Import/Controller/FakeUserController.php on lines 272..280
api/src/Import/Service/FakeManager.php on lines 389..397

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

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 4 locations. Consider refactoring.
Open

    public function getRandomDate(string $start, string $end)
    {
        $start = \DateTime::createFromFormat('Y-m-d', $start);
        $end = \DateTime::createFromFormat('Y-m-d', $end);
        $randomTimestamp = mt_rand($start->getTimestamp(), $end->getTimestamp());
Severity: Major
Found in api/src/Import/Controller/FakeUserController.php and 3 other locations - About 35 mins to fix
api/src/Import/Controller/FakeUserController.php on lines 272..280
api/src/Import/Service/FakeManager.php on lines 389..397
api/src/Import/Service/FakeManager.php on lines 399..407

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

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 4 locations. Consider refactoring.
Open

        if (in_array('communityId', array_keys($fields))) {
            if (null === $fields['communityId']) {
                $relayPoint->setCommunity(null);
            } elseif ($community = $this->communityRepository->find($fields['communityId'])) {
                // set the new community
Severity: Major
Found in api/src/RelayPoint/Admin/Service/RelayPointManager.php and 3 other locations - About 35 mins to fix
api/src/Event/Admin/Service/EventManager.php on lines 135..144
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 155..164
api/src/RelayPoint/Admin/Service/RelayPointManager.php on lines 179..188

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

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

                if (Criteria::FREQUENCY_PUNCTUAL == $matching['request']->getProposalRequest()->getCriteria()->getFrequency()) {
                    $item->setDate($matching['request']->getProposalRequest()->getCriteria()->getFromDate());
                } else {
                    $regularDayInfos = $this->getMatchingRegularDayAsOffer($matching['request'], $item);
                    $item = $regularDayInfos['item'];
Severity: Minor
Found in api/src/Carpool/Service/ResultManager.php and 1 other location - About 35 mins to fix
api/src/Carpool/Service/ResultManager.php on lines 1455..1461

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

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

                if (Criteria::FREQUENCY_PUNCTUAL == $matching['offer']->getProposalOffer()->getCriteria()->getFrequency()) {
                    $item->setDate($matching['offer']->getProposalOffer()->getCriteria()->getFromDate());
                } else {
                    $regularDayInfos = $this->getMatchingRegularDayAsRequest($matching['offer'], $item);
                    $item = $regularDayInfos['item'];
Severity: Minor
Found in api/src/Carpool/Service/ResultManager.php and 1 other location - About 35 mins to fix
api/src/Carpool/Service/ResultManager.php on lines 903..909

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

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

        if ($criteria->isTueCheck() && !is_null($criteria->getTueTime())) {
            if (is_null($schedule['outwardTime'])) {
                $schedule['outwardTime'] = $criteria->getTueTime()->format('H:i');
            } elseif ($schedule['outwardTime'] !== $criteria->getTueTime()->format('H:i')) {
                $schedule['outwardTime'] = 'multiple';
Severity: Minor
Found in api/src/Carpool/Service/MyAdManager.php and 1 other location - About 35 mins to fix
api/src/Carpool/Service/MyAdManager.php on lines 447..453

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

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

            if ($returnCriteria->isTueCheck() && !is_null($returnCriteria->getTueTime())) {
                if (is_null($schedule['returnTime'])) {
                    $schedule['returnTime'] = $returnCriteria->getTueTime()->format('H:i');
                } elseif ($schedule['returnTime'] !== $returnCriteria->getTueTime()->format('H:i')) {
                    $schedule['returnTime'] = 'multiple';
Severity: Minor
Found in api/src/Carpool/Service/MyAdManager.php and 1 other location - About 35 mins to fix
api/src/Carpool/Service/MyAdManager.php on lines 400..406

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

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

        foreach ($rewards as $reward) {
            $string .= $reward.',';
            ++$i;
            if ($i >= 1250) {
                $string = substr($string, 0, -1);
Severity: Minor
Found in api/src/Gamification/Service/RetroactivelyRewardService.php and 1 other location - About 35 mins to fix
api/src/Gamification/Service/RetroactivelyRewardService.php on lines 380..392

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

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

        foreach ($rewardSteps as $rewardStep) {
            $string .= $rewardStep.',';
            ++$i;
            if ($i >= 1250) {
                $string = substr($string, 0, -1);
Severity: Minor
Found in api/src/Gamification/Service/RetroactivelyRewardService.php and 1 other location - About 35 mins to fix
api/src/Gamification/Service/RetroactivelyRewardService.php on lines 403..415

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

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

  if (err) {
    process.stderr.write(kuler('Path specified does not exists or is not a directory! \n', 'red'))
    console.error(err);
    process.exit(0);
  }
Severity: Minor
Found in bin/helpers/linkBundle.js and 1 other location - About 35 mins to fix
bin/helpers/linkBundle.js on lines 43..47

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

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

  if (err) {
    process.stderr.write(kuler('Cannot create symlink bundle\n', 'red'))
    console.error(err);
    process.exit(0);
  }
Severity: Minor
Found in bin/helpers/linkBundle.js and 1 other location - About 35 mins to fix
bin/helpers/linkBundle.js on lines 30..34

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

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 4 locations. Consider refactoring.
Open

    public function supports($data, array $context = []): bool
    {
        if ($data instanceof Event) {
            switch ($context) {
                case isset($context['collection_operation_name']):
Severity: Major
Found in api/src/Event/DataPersister/EventPostDataPersister.php and 3 other locations - About 30 mins to fix
api/src/CarpoolStandard/DataPersister/BookingDataPersister.php on lines 49..71
api/src/CarpoolStandard/DataPersister/BookingFromExternalDataPersister.php on lines 54..76
api/src/User/Admin/DataPersister/IdentityProofDataPersister.php on lines 41..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 91.

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 4 locations. Consider refactoring.
Open

    public function supports($data, array $context = []): bool
    {
        if ($data instanceof IdentityProof) {
            switch ($context) {
                case isset($context['collection_operation_name']):
api/src/CarpoolStandard/DataPersister/BookingDataPersister.php on lines 49..71
api/src/CarpoolStandard/DataPersister/BookingFromExternalDataPersister.php on lines 54..76
api/src/Event/DataPersister/EventPostDataPersister.php on lines 39..61

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

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 4 locations. Consider refactoring.
Open

    public function supports($data, array $context = []): bool
    {
        if ($data instanceof Booking) {
            switch ($context) {
                case isset($context['collection_operation_name']):
Severity: Major
Found in api/src/CarpoolStandard/DataPersister/BookingDataPersister.php and 3 other locations - About 30 mins to fix
api/src/CarpoolStandard/DataPersister/BookingFromExternalDataPersister.php on lines 54..76
api/src/Event/DataPersister/EventPostDataPersister.php on lines 39..61
api/src/User/Admin/DataPersister/IdentityProofDataPersister.php on lines 41..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 91.

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

Severity
Category
Status
Source
Language