eventoL/eventoL

View on GitHub

Showing 519 of 519 total issues

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

  $('#contacts-formset').on('formAdded', event => {
    const inputs = $(event.target).find(':input');
    $.each(inputs, (_, input) => {
      const $input = $(input);
      if ($input.attr('type') !== 'button') {
Severity: Major
Found in eventol/front/src/libs/form.js and 1 other location - About 3 hrs to fix
eventol/front/src/libs/form.js on lines 29..37

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

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

Cyclomatic complexity is too high in function attendee_registration. (16)
Open

def attendee_registration(request, event_slug):
    event = get_object_or_404(Event, event_slug=event_slug)

    if not event.registration_is_open or event.registration_closed:
        return render(
Severity: Minor
Found in eventol/manager/views.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Function installation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def installation(request, event_slug):
    installation_form = InstallationForm(
        event_slug, request.POST or None, prefix='installation')
    hardware_form = HardwareForm(request.POST or None, prefix='hardware')
    forms = [installation_form, hardware_form]
Severity: Minor
Found in eventol/manager/views.py - About 3 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

Cyclomatic complexity is too high in function attendee_registration_by_self. (14)
Open

def attendee_registration_by_self(request, event_slug, event_registration_code):
    event_index_url = reverse('index', args=[event_slug])
    event = Event.objects.filter(
        event_slug=event_slug, registration_code=event_registration_code
    ).first()
Severity: Minor
Found in eventol/manager/views.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

      {
        Header: gettext('Speakers'),
        id: 'speakers',
        accessor: ({report: {speakers}}) => speakers,
        total: totals.speakers,
Severity: Major
Found in eventol/front/src/utils/table.jsx and 1 other location - About 3 hrs to fix
eventol/front/src/utils/table.jsx on lines 256..268

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

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

    speakers: {
      Header: gettext('Speakers'),
      id: 'speakers',
      accessor: ({report: {speakers}}) => speakers,
      total: totals.speakers,
Severity: Major
Found in eventol/front/src/utils/table.jsx and 1 other location - About 3 hrs to fix
eventol/front/src/utils/table.jsx on lines 111..123

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

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

const qrcodeInit = readerId => {
  const element = $(`#${readerId}`);
  $.fn.extend({
    html5_qrcode(qrcodeSuccess, qrcodeError, videoError) {
      return element.each(() => {
Severity: Major
Found in eventol/front/src/libs/qrcode.js - About 3 hrs to fix

    Function manage_attendance has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def manage_attendance(request, event_slug):
        attendee_form = AttendeeSearchForm(
            event_slug,
            request.POST or None
        )
    Severity: Minor
    Found in eventol/manager/views.py - About 3 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 attendee_registration has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def attendee_registration(request, event_slug):
        event = get_object_or_404(Event, event_slug=event_slug)
    
        if not event.registration_is_open or event.registration_closed:
            return render(
    Severity: Minor
    Found in eventol/manager/views.py - About 3 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

    Cyclomatic complexity is too high in function attendance_by_autoreadqr. (13)
    Open

    def attendance_by_autoreadqr(request, event_slug):
        event = get_object_or_404(Event, event_slug=event_slug)
        event_index_url = reverse(
            'index',
            args=[event_slug]
    Severity: Minor
    Found in eventol/manager/views.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function talk_registration has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def talk_registration(request, event_slug, proposal_id):
        errors, error = [], False
        event = get_object_or_404(Event, event_slug=event_slug)
        proposal = get_object_or_404(Activity, pk=proposal_id)
        talk_form = ActivityForm(event_slug, request.POST)
    Severity: Minor
    Found in eventol/manager/views.py - 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

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

    @pytest.fixture
    @pytest.mark.django_db
    def event_data2(
            event_tag_2, event2, user2,
            event_user2, attendee_without_user2,
    Severity: Major
    Found in eventol/manager/tests/conftest.py and 1 other location - About 2 hrs to fix
    eventol/manager/tests/conftest.py on lines 298..319

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

    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 event_data1(
            event_tag_1, event1, user1,
            event_user1, attendee_without_user1,
    Severity: Major
    Found in eventol/manager/tests/conftest.py and 1 other location - About 2 hrs to fix
    eventol/manager/tests/conftest.py on lines 323..344

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

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

      render() {
        const {searched, searchUrl} = this.state;
        const {
          user,
          eventolMessage,
    Severity: Major
    Found in eventol/front/src/containers/Home/index.jsx - About 2 hrs to fix

      Cyclomatic complexity is too high in function edit_event. (11)
      Open

      @login_required
      @user_passes_test(is_organizer, 'index')
      def edit_event(request, event_slug):
          event = get_object_or_404(Event, event_slug=event_slug)
          event_form = EventForm(request.POST or None, prefix='event', instance=event)
      Severity: Minor
      Found in eventol/manager/views.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function installation. (11)
      Open

      @login_required
      @user_passes_test(is_installer, 'installer_registration')
      def installation(request, event_slug):
          installation_form = InstallationForm(
              event_slug, request.POST or None, prefix='installation')
      Severity: Minor
      Found in eventol/manager/views.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function add_or_edit_room. (11)
      Open

      @login_required
      @user_passes_test(is_organizer, 'index')
      def add_or_edit_room(request, event_slug, room_id=None):
          event = get_object_or_404(Event, event_slug=event_slug)
          room_form = RoomForm(request.POST or None)
      Severity: Minor
      Found in eventol/manager/views.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function getAssitanceConfirmatedColumns has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getAssitanceConfirmatedColumns = totals => {
        if (!totals.hasOwnProperty('attendees')) return {};
        return {
          Header: gettext('Assistance (confirmed)'),
          columns: [
      Severity: Major
      Found in eventol/front/src/utils/table.jsx - About 2 hrs to fix

        Function add_or_edit_room has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_or_edit_room(request, event_slug, room_id=None):
            event = get_object_or_404(Event, event_slug=event_slug)
            room_form = RoomForm(request.POST or None)
            is_edit = False
            room = None
        Severity: Minor
        Found in eventol/manager/views.py - 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 html5_qrcode has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            html5_qrcode(qrcodeSuccess, qrcodeError, videoError) {
              return element.each(() => {
                let height = element.height();
                let width = element.width();
        
        
        Severity: Major
        Found in eventol/front/src/libs/qrcode.js - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language