eventoL/eventoL

View on GitHub

Showing 519 of 519 total issues

Function generic_registration has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def generic_registration(request, event_slug,
                         registration_model, new_role_form,
                         msg_success, msg_error, template):
    event = get_object_or_404(Event, event_slug=event_slug)

Severity: Minor
Found in eventol/manager/views.py - 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

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

        for field in self.fields.keys():
            if field not in self.ordered_field_names:
                new_fields[field] = original_fields.get(field)
Severity: Major
Found in eventol/manager/forms.py and 1 other location - About 1 hr to fix
eventol/manager/forms.py on lines 508..510

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

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

export const getActivitiesFullColumns = totals => {
  const confirmationColumn = getConfirmationColumnsBy(
    totals,
    'activity',
    'activities',
Severity: Minor
Found in eventol/front/src/utils/table.jsx - About 1 hr to fix

    Function ReportTable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const ReportTable = props => {
      const {
        data,
        pages,
        isLoading,
    Severity: Minor
    Found in eventol/front/src/components/ReportTable/index.jsx - About 1 hr to fix

      Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {
            isMobile,
            logoHeader,
            languages,
      Severity: Minor
      Found in eventol/front/src/components/Header/index.jsx - About 1 hr to fix

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

                if self.ticket is None:
                    ticket = Ticket()
                    ticket.save()
                    self.ticket = ticket
                    self.save()
        Severity: Major
        Found in eventol/manager/models.py and 1 other location - About 1 hr to fix
        eventol/manager/models.py on lines 441..445

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

        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

                if self.ticket is None:
                    ticket = Ticket()
                    ticket.save()
                    self.ticket = ticket
                    self.save()
        Severity: Major
        Found in eventol/manager/models.py and 1 other location - About 1 hr to fix
        eventol/manager/models.py on lines 623..627

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

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

        export const parseEvent = (event, eventsPrivateData = []) => {
          const {
            location,
            report: {attendee},
          } = event;
        Severity: Minor
        Found in eventol/front/src/utils/report.js - About 1 hr to fix

          Function parseActivitiesDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const parseActivitiesDetails = allData => {
            const status = new Set();
            const types = new Set();
            const levels = new Set();
            allData.forEach(event => {
          Severity: Minor
          Found in eventol/front/src/utils/report.js - About 1 hr to fix

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

              status.forEach(element => {
                const sum = _.sumBy(allData, `report.activity.status_count.${element}`);
                activityDetail.status[element] = sum;
              });
            Severity: Major
            Found in eventol/front/src/utils/report.js and 2 other locations - About 1 hr to fix
            eventol/front/src/utils/report.js on lines 41..44
            eventol/front/src/utils/report.js on lines 45..48

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

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

              types.forEach(type => {
                const sum = _.sumBy(allData, `report.activity.type_count.${type}`);
                activityDetail.types[type] = sum;
              });
            Severity: Major
            Found in eventol/front/src/utils/report.js and 2 other locations - About 1 hr to fix
            eventol/front/src/utils/report.js on lines 37..40
            eventol/front/src/utils/report.js on lines 45..48

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

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

              levels.forEach(level => {
                const sum = _.sumBy(allData, `report.activity.level_count.${level}`);
                activityDetail.levels[level] = sum;
              });
            Severity: Major
            Found in eventol/front/src/utils/report.js and 2 other locations - About 1 hr to fix
            eventol/front/src/utils/report.js on lines 37..40
            eventol/front/src/utils/report.js on lines 41..44

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

            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 attendance_by_ticket has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def attendance_by_ticket(request, event_slug, ticket_code):
                attendee = Attendee.objects.filter(ticket__code=ticket_code)
                if not attendee:
                    attendee = EventUser.objects.filter(ticket__code=ticket_code)
            
            
            Severity: Minor
            Found in eventol/manager/views.py - 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 attendee_confirm_email has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def attendee_confirm_email(request, event_slug, attendee_id, token):
                attendee = Attendee.objects.get(pk=attendee_id)
                title = _("Email verification")
                message = _(
                    "We've sent you your ticket to your email! In case it doesn't arrive, \
            Severity: Minor
            Found in eventol/manager/views.py - 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 attendee_registration_print_code has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def attendee_registration_print_code(request, event_slug):
                event = get_object_or_404(Event, event_slug=event_slug)
                self_registration_url = request.build_absolute_uri(reverse(
                    'attendee_registration_by_self',
                    args=[event_slug, event.registration_code]
            Severity: Minor
            Found in eventol/manager/views.py - 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 event_add_image has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def event_add_image(request, event_slug):
                event = get_object_or_404(Event, event_slug=event_slug)
                form = EventImageCroppingForm(request.POST or None, request.FILES, instance=event)
                if request.POST:
                    if form.is_valid():
            Severity: Minor
            Found in eventol/manager/views.py - 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 image_cropping has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def image_cropping(request, event_slug, activity_id):
                activity = get_object_or_404(Activity, pk=activity_id)
                form = ImageCroppingForm(request.POST or None, request.FILES, instance=activity)
                if request.POST:
                    if form.is_valid():
            Severity: Minor
            Found in eventol/manager/views.py - 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

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

                    return super() \
                        .get_queryset() \
                        .annotate(attendees_count=models.Count('attendee', distinct=True)) \
                        .annotate(last_date=models.Max('eventdate__date')) \
                        .annotate(activity_proposal_is_open=models.Case(
            Severity: Major
            Found in eventol/manager/models.py and 1 other location - About 1 hr to fix
            eventol/manager/models.py on lines 48..60

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

            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

            @pytest.fixture
            @pytest.mark.django_db
            def attendee_from_event_user2(event_user2, event2):
                yield autofixture.create_one(
                    'manager.Attendee', {
            Severity: Major
            Found in eventol/manager/tests/conftest.py and 1 other location - About 1 hr to fix
            eventol/manager/tests/conftest.py on lines 127..134

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

            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

            @pytest.fixture
            @pytest.mark.django_db
            def attendee_from_event_user1(event_user1, event1):
                yield autofixture.create_one(
                    'manager.Attendee', {
            Severity: Major
            Found in eventol/manager/tests/conftest.py and 1 other location - About 1 hr to fix
            eventol/manager/tests/conftest.py on lines 139..146

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

            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