Showing 349 of 349 total issues

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

        if kwargs.get('line_number'):
            if len(kwargs.get('line_number').split('-')) == 2:
                form, line_no = kwargs.get('line_number').split('-')
                query = query.filter_by(filing_form=form.upper())
                query = query.filter_by(line_number=line_no)
Severity: Major
Found in webservices/resources/sched_b.py and 1 other location - About 5 hrs to fix
webservices/resources/sched_a.py on lines 81..85

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

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

    query = Search().using(es) \
        .query(Q('bool', must=must_query)) \
        .highlight('text', 'name', 'no', 'summary', 'documents.text', 'documents.description') \
        .highlight_options(require_field_match=False) \
        .source(exclude=['text', 'documents.text', 'sort1', 'sort2']) \
Severity: Major
Found in webservices/resources/legal.py and 1 other location - About 4 hrs to fix
webservices/resources/legal.py on lines 110..117

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

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

    query = Search().using(es) \
        .query(Q('bool', must=must_query)) \
        .highlight('text', 'name', 'no', 'summary', 'documents.text', 'documents.description') \
        .highlight_options(require_field_match=False) \
        .source(exclude=['text', 'documents.text', 'sort1', 'sort2']) \
Severity: Major
Found in webservices/resources/legal.py and 1 other location - About 4 hrs to fix
webservices/resources/legal.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 83.

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

File rest.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
A RESTful web service supporting fulltext and field-specific searches on FEC data. For
full documentation visit: https://api.open.fec.gov/developers.
"""
from webservices.env import env
Severity: Minor
Found in webservices/rest.py - About 4 hrs to fix

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

      switchToDescription: function(e){
        if (e) { e.preventDefault(); }
    
        $('.snippet', $(this.el)).hide();
        $('.description', $(this.el)).show();
    Severity: Major
    Found in swagger-ui/js/view/SignatureView.js and 1 other location - About 4 hrs to fix
    swagger-ui/js/view/SignatureView.js on lines 40..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 124.

    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

      switchToSnippet: function(e){
        if (e) { e.preventDefault(); }
    
        $('.description', $(this.el)).hide();
        $('.snippet', $(this.el)).show();
    Severity: Major
    Found in swagger-ui/js/view/SignatureView.js and 1 other location - About 4 hrs to fix
    swagger-ui/js/view/SignatureView.js on lines 30..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 124.

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

    InlineLexer.prototype.output = function(src) {
      var out = ''
        , link
        , text
        , href
    Severity: Major
    Found in static/swagger-ui/vendor/marked.js - About 4 hrs to fix

      Function submitOperation has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        submitOperation: function(e) {
          var error_free, form, isFileUpload, l, len, len1, len2, m, map, n, o, opts, ref1, ref2, ref3, val;
          if (e !== null) {
            e.preventDefault();
          }
      Severity: Minor
      Found in swagger-ui/js/view/OperationView.js - About 4 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 apply_ao_specific_query_params has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      def apply_ao_specific_query_params(query, **kwargs):
          must_clauses = []
          if kwargs.get('ao_no'):
              must_clauses.append(Q('terms', no=kwargs.get('ao_no')))
      
      
      Severity: Minor
      Found in webservices/resources/legal.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

      File utils.py has 327 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import re
      import functools
      import json
      import logging
      
      
      Severity: Minor
      Found in webservices/utils.py - About 3 hrs to fix

        Function submitOperation has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          submitOperation: function(e) {
            var error_free, form, isFileUpload, l, len, len1, len2, m, map, n, o, opts, ref1, ref2, ref3, val;
            if (e !== null) {
              e.preventDefault();
            }
        Severity: Major
        Found in swagger-ui/js/view/OperationView.js - About 3 hrs to fix

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

          SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({
            initialize: function(){},
          
            render: function(){
              $(this.el).html(Handlebars.templates.response_content_type(this.model));
          Severity: Major
          Found in swagger-ui/js/view/ResponseContentTypeView.js and 2 other locations - About 3 hrs to fix
          swagger-ui/js/view/ContentTypeView.js on lines 3..13
          swagger-ui/js/view/ParameterContentTypeView.js on lines 3..14

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

          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

          SwaggerUi.Views.ContentTypeView = Backbone.View.extend({
            initialize: function() {},
          
            render: function(){
              $(this.el).html(Handlebars.templates.content_type(this.model));
          Severity: Major
          Found in swagger-ui/js/view/ContentTypeView.js and 2 other locations - About 3 hrs to fix
          swagger-ui/js/view/ParameterContentTypeView.js on lines 3..14
          swagger-ui/js/view/ResponseContentTypeView.js on lines 3..13

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

          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

          SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
            initialize: function  () {},
          
            render: function(){
              $(this.el).html(Handlebars.templates.parameter_content_type(this.model));
          Severity: Major
          Found in swagger-ui/js/view/ParameterContentTypeView.js and 2 other locations - About 3 hrs to fix
          swagger-ui/js/view/ContentTypeView.js on lines 3..13
          swagger-ui/js/view/ResponseContentTypeView.js on lines 3..13

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

          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

          class AuditCommitteeSearch(db.Model):
              __tablename__ = 'ofec_committee_fulltext_audit_mv'
          
              idx = db.Column(db.String, primary_key=True)
              id = db.Column(db.String)
          Severity: Major
          Found in webservices/common/models/audit.py and 1 other location - About 3 hrs to fix
          webservices/common/models/audit.py on lines 100..106

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

          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

          def refresh_aos(conn):
              row = conn.execute(RECENTLY_MODIFIED_STARTING_AO).first()
              if row:
                  logger.info("AO found %s modified at %s", row["ao_no"], row["pg_date"])
                  load_advisory_opinions(row["ao_no"])
          Severity: Major
          Found in webservices/tasks/legal_docs.py and 1 other location - About 3 hrs to fix
          webservices/tasks/legal_docs.py on lines 43..49

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

          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

          def refresh_murs(conn):
              row = conn.execute(RECENTLY_MODIFIED_STARTING_MUR).first()
              if row:
                  logger.info("Current MUR found %s modified at %s", row["case_no"], row["pg_date"])
                  load_current_murs(row["case_no"])
          Severity: Major
          Found in webservices/tasks/legal_docs.py and 1 other location - About 3 hrs to fix
          webservices/tasks/legal_docs.py on lines 35..41

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

          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

          class AuditCandidateSearch(db.Model):
              __tablename__ = 'ofec_candidate_fulltext_audit_mv'
          
              idx = db.Column(db.String, primary_key=True)
              id = db.Column(db.String)
          Severity: Major
          Found in webservices/common/models/audit.py and 1 other location - About 3 hrs to fix
          webservices/common/models/audit.py on lines 110..116

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

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

          Parser.prototype.tok = function() {
            switch (this.token.type) {
              case 'space': {
                return '';
              }
          Severity: Major
          Found in static/swagger-ui/vendor/marked.js - About 3 hrs to fix

            Function showStatus has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              showStatus: function(response) {
                var url, content;
                if (response.content === undefined) {
                  content = response.data;
                  url = response.url;
            Severity: Major
            Found in swagger-ui/js/view/OperationView.js - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language