holderdeord/hdo-transcript-search

View on GitHub

Showing 95 of 95 total issues

Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        let unit = this.props.unit;
        let counts = this.props.counts;

        if (this.props.sort) {
Severity: Minor
Found in webapp/src/frontend/components/TopListChart.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function matchMedia has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    window.matchMedia = function(media) {
        var mql         = localMatchMedia(media),
            listeners   = [],
            index       = 0;

Severity: Minor
Found in webapp/public/matchMedia.addListener.js - About 1 hr to fix

    Method index_file has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def index_file(file)
            transcript_id = file.basename.to_s.sub(file.extname, '')
            data          = JSON.parse(file.read)
            presidents    = data['presidents'].map { |e| {name: e, external_id: @slug_cache[e]} }
            session       = data['session']
    Severity: Minor
    Found in indexer/lib/hdo-transcript-indexer.rb - About 1 hr to fix

      Function matchMedia has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      window.matchMedia || (window.matchMedia = function() {
          "use strict";
      
          // For browsers that support matchMedium api such as IE 9 and webkit
          var styleMedia = (window.styleMedia || window.media);
      Severity: Minor
      Found in webapp/public/matchMedia.js - About 1 hr to fix

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

                        <span>
                            <a href="#" onClick={::this.handleTwitterShare}>
                                <i className="fa fa-twitter-square fa-2x" />
                            </a>
                        </span>
        Severity: Major
        Found in webapp/src/frontend/components/SharingLinks.js and 1 other location - About 1 hr to fix
        webapp/src/frontend/components/SharingLinks.js on lines 12..16

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

        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

                        <span>
                            <a href="#" onClick={::this.handleFacebookShare}>
                                <i className="fa fa-facebook-square fa-2x" />
                            </a>
                        </span>
        Severity: Major
        Found in webapp/src/frontend/components/SharingLinks.js and 1 other location - About 1 hr to fix
        webapp/src/frontend/components/SharingLinks.js on lines 18..22

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

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

          def significant_terms(query = nil, algorithm = :mutual_information, size = 10)
            response = client.search(
              index: 'hdo-transcripts',
              type: 'speech',
              body: {
        Severity: Minor
        Found in scripts/significant_terms.rb - About 1 hr to fix

          Function renderQueries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              renderQueries() {
                  // see chartist.scss for colors
                  var queries = this.state.queries.map((q, i) => {
                      let className = Colors.colorAt(i);
                      let query;
          Severity: Minor
          Found in webapp/src/frontend/components/Timeline.js - About 1 hr to fix

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

                      data['representanter_liste'].each do |rep|
                        full_name = rep.values_at('fornavn', 'etternavn').join(' ')
            
                        @slug_cache[full_name] = rep['id']
                        @id_to_person[rep['id']] = {
            Severity: Minor
            Found in indexer/lib/hdo-transcript-indexer.rb and 1 other location - About 50 mins to fix
            indexer/lib/hdo-transcript-indexer.rb on lines 195..203

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

            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

                    data['dagensrepresentanter_liste'].each do |rep|
                      full_name = rep.values_at('fornavn', 'etternavn').join(' ')
                      @slug_cache[full_name] = rep['id']
            
                      @id_to_person[rep['id']] = {
            Severity: Minor
            Found in indexer/lib/hdo-transcript-indexer.rb and 1 other location - About 50 mins to fix
            indexer/lib/hdo-transcript-indexer.rb on lines 181..189

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

            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

                                        <input
                                            type="button"
                                            value="Prosent"
                                            className={`btn ${
                                                this.props.unit === 'pct'
            Severity: Minor
            Found in webapp/src/frontend/components/Timeline.js and 1 other location - About 50 mins to fix
            webapp/src/frontend/components/Timeline.js on lines 128..136

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

            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

                                        <input
                                            type="button"
                                            value="Absolutt"
                                            className={`btn ${
                                                this.props.unit === 'count'
            Severity: Minor
            Found in webapp/src/frontend/components/Timeline.js and 1 other location - About 50 mins to fix
            webapp/src/frontend/components/Timeline.js on lines 118..126

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

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

                render() {
                    let speeches = this.props.speeches;
            
                    if (!speeches.length) {
                        return null;
            Severity: Minor
            Found in webapp/src/frontend/components/SpeechInContext.js - About 45 mins 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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                render() {
                    if (this.state.queries.length) {
                        this.chartOptions.axisY.onlyInteger = this.props.unit === 'count';
            
                        return (
            Severity: Minor
            Found in webapp/src/frontend/components/Timeline.js - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                formatValue(value) {
                    return this.props.unit === 'pct'
                        ? `${value.toFixed(2).replace('.', ',')}%`
                        : value;
                }
            Severity: Minor
            Found in webapp/src/frontend/components/Timeline.js and 1 other location - About 45 mins to fix
            webapp/src/frontend/components/TopListChart.js on lines 99..103

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    if (typeof value === 'number') {
                        return this.props.unit === 'pct'
                            ? `${value.toFixed(2).replace('.', ',')}%`
                            : value;
                    } else {
            Severity: Minor
            Found in webapp/src/frontend/components/TopListChart.js and 1 other location - About 45 mins to fix
            webapp/src/frontend/components/Timeline.js on lines 213..217

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

            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 result-box result-box-header text-center">
                                    <div className="col-md-12">
                                        <h4>Andre tjenester fra Holder de ord</h4>
                                    </div>
                                </div>
            Severity: Minor
            Found in webapp/src/frontend/components/RelatedServices.js and 1 other location - About 40 mins to fix
            webapp/src/frontend/components/App.js on lines 61..67

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

            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="m-t-1">
                                    <div className="alert alert-info">
                                        <strong>Holder de ord</strong> legges ned i løpet av
                                        2020. Denne tjenesten blir fortsatt oppdatert daglig frem
                                        til da.
            Severity: Minor
            Found in webapp/src/frontend/components/App.js and 1 other location - About 40 mins to fix
            webapp/src/frontend/components/RelatedServices.js on lines 24..28

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

            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

                                <span>
                                    {first.name} {first.party ? `(${first.party})` : ''}
                                </span>
            Severity: Minor
            Found in webapp/src/frontend/components/SpeechInContext.js and 1 other location - About 35 mins to fix
            webapp/src/frontend/components/SpeechInContext.js on lines 41..43

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

            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

                                <span>
                                    {last.name} {last.party ? `(${last.party})` : ''}
                                </span>
            Severity: Minor
            Found in webapp/src/frontend/components/SpeechInContext.js and 1 other location - About 35 mins to fix
            webapp/src/frontend/components/SpeechInContext.js on lines 29..31

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

            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