neelxie/ireport-api

View on GitHub

Showing 16 of 16 total issues

Function add_user has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add_user(self, first_name, last_name, other_name, phone_number,
Severity: Major
Found in app/db/ireporter_db.py - About 1 hr to fix

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

    @redflag_bp.route('/red-flags/<int:incident_id>/status', methods=['PATCH'])
    @token_required
    @admin_route
    def change_status(incident_id):
        """ This is an Admin only route to change record red flag status.
    Severity: Major
    Found in app/views/redflag_views.py and 3 other locations - About 45 mins to fix
    app/views/intervention_views.py on lines 52..58
    app/views/user_views.py on lines 48..54
    app/views/user_views.py on lines 57..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 35.

    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

    @auth_bp.route('/users/<int:user_id>/interventions', methods=['GET'])
    @token_required
    @admin_route
    def interventions_of_single_user(user_id):
        """ Method route to retrieve all interventions created by a single user.
    Severity: Major
    Found in app/views/user_views.py and 3 other locations - About 45 mins to fix
    app/views/intervention_views.py on lines 52..58
    app/views/redflag_views.py on lines 58..64
    app/views/user_views.py on lines 48..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    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

    @auth_bp.route('/users/<int:user_id>/red-flags', methods=['GET'])
    @token_required
    @admin_route
    def user_redflags(user_id):
        """ Method route to retrieve all redflags from a single user.
    Severity: Major
    Found in app/views/user_views.py and 3 other locations - About 45 mins to fix
    app/views/intervention_views.py on lines 52..58
    app/views/redflag_views.py on lines 58..64
    app/views/user_views.py on lines 57..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 35.

    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

    @intervention_bp.route('/interventions/<int:incident_id>/status', methods=['PATCH'])
    @token_required
    @admin_route
    def change_status(incident_id):
        """ This is an Admin only route to change record intervention status.
    Severity: Major
    Found in app/views/intervention_views.py and 3 other locations - About 45 mins to fix
    app/views/redflag_views.py on lines 58..64
    app/views/user_views.py on lines 48..54
    app/views/user_views.py on lines 57..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 35.

    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 add_incident has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_incident(self, table_name, created_by,
    Severity: Minor
    Found in app/db/ireporter_db.py - About 45 mins to fix

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

      @intervention_bp.route('/interventions/<int:incident_id>', methods=['GET'])
      @token_required
      def get_specific_intervention(incident_id):
          """ This route fetchs a single intervention.
          """
      Severity: Major
      Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @redflag_bp.route('/red-flags/<int:incident_id>', methods=['GET'])
      @token_required
      def get_specific_redflag(incident_id):
          """ This route fetchs a single red flag.
          """
      Severity: Major
      Found in app/views/redflag_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @intervention_bp.route('/interventions/<int:incident_id>/location', methods=['PATCH'])
      @token_required
      def new_location(incident_id):
          """ App Route to edit a intervention location.
          """
      Severity: Major
      Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @intervention_bp.route('/interventions/<int:incident_id>', methods=["DELETE"])
      @token_required
      def delete_record(incident_id):
          """ Route to delete a intervention.
          """
      Severity: Major
      Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @intervention_bp.route('/interventions/<int:incident_id>/comment', methods=['PATCH'])
      @token_required
      def edit_record_comment(incident_id):
          """ This route changes record comment of a single interventions.
          """
      Severity: Major
      Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @redflag_bp.route('/red-flags/<int:incident_id>/comment', methods=['PATCH'])
      @token_required
      def edit_record_comment(incident_id):
          """ This route changes record comment of a single red flag.
          """
      Severity: Major
      Found in app/views/redflag_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 67..72

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

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

      @redflag_bp.route('/red-flags/<int:incident_id>/location', methods=['PATCH'])
      @token_required
      def new_location(incident_id):
          """ App Route to edit a red flag location.
          """
      Severity: Major
      Found in app/views/redflag_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 50..55
      app/views/redflag_views.py on lines 67..72

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

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

      @redflag_bp.route('/red-flags/<int:incident_id>', methods=["DELETE"])
      @token_required
      def delete_record(incident_id):
          """ Route to delete a red flag.
          """
      Severity: Major
      Found in app/views/redflag_views.py and 7 other locations - About 40 mins to fix
      app/views/intervention_views.py on lines 28..33
      app/views/intervention_views.py on lines 36..41
      app/views/intervention_views.py on lines 44..49
      app/views/intervention_views.py on lines 61..66
      app/views/redflag_views.py on lines 34..39
      app/views/redflag_views.py on lines 42..47
      app/views/redflag_views.py on lines 50..55

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

      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 incident["status"] != 'Draft':
                  return jsonify({
                      "error": "Can only edit location when red flag status is Draft.",
                      'status': 400
                  }), 400
      Severity: Minor
      Found in app/controller/incident_controller.py and 1 other location - About 30 mins to fix
      app/controller/incident_controller.py on lines 184..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 32.

      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 incident["status"]!= 'Draft':
                  return jsonify({
                      "error": "Can only edit comment when red flag status is Draft.",
                      'status': 400
                  }), 400
      Severity: Minor
      Found in app/controller/incident_controller.py and 1 other location - About 30 mins to fix
      app/controller/incident_controller.py on lines 149..153

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

      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