holderdeord/hdo-transcript-search

View on GitHub

Showing 95 of 95 total issues

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

                        <div className="col-md-6">
                            <h5>Bunn 20, snitt LIX-score og antall innlegg</h5>

                            <ol>
                                {(bottomRepresentatives
Severity: Major
Found in webapp/src/frontend/components/Lix.js and 1 other location - About 7 hrs to fix
webapp/src/frontend/components/Lix.js on lines 124..144

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

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

                        <div className="col-md-6">
                            <h5>Topp 20, snitt LIX-score og antall innlegg</h5>

                            <ol>
                                {(topRepresentatives
Severity: Major
Found in webapp/src/frontend/components/Lix.js and 1 other location - About 7 hrs to fix
webapp/src/frontend/components/Lix.js on lines 146..166

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

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 search-api.js has 481 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable camelcase */

import Promise from 'bluebird';
import LRU from 'lru-cache';
import es from './es-client';
Severity: Minor
Found in webapp/src/backend/search-api.js - About 7 hrs to fix

    File converter.rb has 420 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'time'
    require 'set'
    require 'hashie/mash'
    require 'hdo/storting_importer'
    require 'childprocess'
    Severity: Minor
    Found in indexer/lib/hdo-transcript-indexer/converter.rb - About 6 hrs to fix

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

          render() {
              const {
                  scoreStats,
                  parties,
                  timeline,
      Severity: Major
      Found in webapp/src/frontend/components/Lix.js - About 5 hrs to fix

        Function getLixStats has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getLixStats() {
                return es
                    .search({
                        index: INDEX_NAME,
                        type: INDEX_TYPE,
        Severity: Major
        Found in webapp/src/backend/search-api.js - About 4 hrs to fix

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

                                      <div
                                          className="row context-links"
                                          style={{ paddingTop: '0.8rem', fontSize: '80%' }}>
                                          <div className="col-xs-1">
                                              <i className="fa fa-comments fa-lg" />
          Severity: Major
          Found in webapp/src/frontend/components/Speech.js and 1 other location - About 4 hrs to fix
          webapp/src/frontend/components/Speech.js on lines 71..86

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

          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

                                  <div
                                      className="row context-links"
                                      style={{ paddingTop: '0.8rem', fontSize: '80%' }}>
                                      <div className="col-xs-1">
                                          <i className="fa fa-external-link fa-lg" />
          Severity: Major
          Found in webapp/src/frontend/components/Speech.js and 1 other location - About 4 hrs to fix
          webapp/src/frontend/components/Speech.js on lines 89..104

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

          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

          app.get('/api/search/hits', (req, res) => {
              if (validQuery(req.query.query)) {
                  api.hits(req.query)
                      .then(results => res.json(results))
                      .catch(errorHandler.bind(res));
          Severity: Major
          Found in webapp/src/backend/app.js and 1 other location - About 4 hrs to fix
          webapp/src/backend/app.js on lines 152..160

          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

          app.get('/api/search/summary', (req, res) => {
              if (validQuery(req.query.query)) {
                  api.summary(req.query)
                      .then(results => res.json(results))
                      .catch(errorHandler.bind(res));
          Severity: Major
          Found in webapp/src/backend/app.js and 1 other location - About 4 hrs to fix
          webapp/src/backend/app.js on lines 162..172

          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

          Method parse_name_string has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

                def parse_name_string(str, person)
                  result = Hashie::Mash.new
                  orig = str
                  str = clean_name_string(str)
          
          
          Severity: Minor
          Found in indexer/lib/hdo-transcript-indexer/converter.rb - 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

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

          function browsers(opts) {
              return getAnalytics().then(an => {
                  return an.data.ga
                      .getAsync({
                          ids: GA_ID,
          Severity: Major
          Found in webapp/src/backend/analytics.js and 1 other location - About 4 hrs to fix
          webapp/src/backend/analytics.js on lines 93..109

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

          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

          function sources(opts) {
              return getAnalytics().then(an => {
                  return an.data.ga
                      .getAsync({
                          ids: GA_ID,
          Severity: Major
          Found in webapp/src/backend/analytics.js and 1 other location - About 4 hrs to fix
          webapp/src/backend/analytics.js on lines 111..127

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

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

              render() {
                  let speech = this.props.speech;
                  let timestamp = TimeUtils.timestampForHit(speech);
                  let title = speech.title;
          
          
          Severity: Major
          Found in webapp/src/frontend/components/Speech.js - About 3 hrs to fix

            Method parse_name_string has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def parse_name_string(str, person)
                    result = Hashie::Mash.new
                    orig = str
                    str = clean_name_string(str)
            
            
            Severity: Major
            Found in indexer/lib/hdo-transcript-indexer/converter.rb - About 3 hrs to fix

              Class Converter has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Converter
                    class << self
                      def parse(file, options = {})
                        case file
                        when /s(\d{2})(\d{2})(\d{2}).*\.xml$/i
              Severity: Minor
              Found in indexer/lib/hdo-transcript-indexer/converter.rb - About 3 hrs to fix

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

                                        bottomRepresentatives: {
                                            terms: {
                                                field: 'name',
                                                size: 20,
                                                order: { avgLixScore: 'asc' },
                Severity: Major
                Found in webapp/src/backend/search-api.js and 1 other location - About 2 hrs to fix
                webapp/src/backend/search-api.js on lines 223..248

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

                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

                                        topRepresentatives: {
                                            terms: {
                                                field: 'name',
                                                size: 20,
                                                order: { avgLixScore: 'desc' },
                Severity: Major
                Found in webapp/src/backend/search-api.js and 1 other location - About 2 hrs to fix
                webapp/src/backend/search-api.js on lines 250..275

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

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

                    render() {
                        let unit = this.props.unit;
                        let counts = this.props.counts;
                
                        if (this.props.sort) {
                Severity: Major
                Found in webapp/src/frontend/components/TopListChart.js - About 2 hrs to fix

                  Function _buildAggregationsQuery has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _buildAggregationsQuery(opts) {
                          var query = this._queryFor(opts.query);
                  
                          var aggregations = {
                              timeline: {
                  Severity: Major
                  Found in webapp/src/backend/search-api.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language