Showing 56 of 95 total issues
Method parse_section
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_section(node)
@current_node = node
section = case node.name.downcase
when 'innlegg', 'hovedinnlegg', 'replikk'
- Read upRead up
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 renderPartyStats
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderPartyStats() {
this.state.parties.sort((a, b) => a[this.props.unit] - b[this.props.unit]);
let topParty = this.state.topParties[this.props.unit];
if (!topParty) {
Method significant_terms_timeline
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def significant_terms_timeline(query = nil, algorithm = :mutual_information, size = 10)
response = client.search(
index: 'hdo-transcripts',
type: 'speech',
body: {
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let services = this.props.services;
if (!services.length) {
return null;
Method build_slug_cache
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_slug_cache
return unless @slug_cache.empty? || @id_to_person.empty?
@logger.info "building name -> slug cache, id -> person cache"
- Read upRead up
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 _buildResponse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_buildResponse(aggResponse) {
let personMap = this._buildPersonMap(
aggResponse.aggregations.filteredPeople.people
);
Method build_slug_cache
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_slug_cache
return unless @slug_cache.empty? || @id_to_person.empty?
@logger.info "building name -> slug cache, id -> person cache"
Function topSearches
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function topSearches(params) {
return getAnalytics()
.then(an => {
return an.data.ga.getAsync({
ids: GA_ID,
Function analytics
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function analytics(state = null, action) {
switch (action.type) {
case SUMMARY:
ga(
'send',
Method initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(options)
@data_dir = data_dir_from(options)
@sessions = options.fetch(:sessions)
@faraday = Faraday.new('http://data.stortinget.no')
@logger = Logger.new(STDOUT)
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.props.visible) {
return null;
}
Method timeline_for
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def timeline_for(word)
response = client.search(
index: 'hdo-transcripts',
type: 'speech',
body: {
Method parse_speech
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_speech(node)
name_nodes = node.css('navn, Navn')
name_str = name_nodes.text
text = clean_text(text_from(node))
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<form className="row" id="search-form" onSubmit={::this.handleSearch}>
<div className="col-md-6 col-md-offset-3">
<div
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let focusedIndex = +this.props.params.focused;
let unit = this.props.params.unit || 'pct';
return (
Method extract_entities
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_entities(section)
r, w = IO.pipe
process = ChildProcess.build("python", NER_SCRIPT)
process.duplex = true
Function renderPeopleStats
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
renderPeopleStats() {
let people = this.state.people[this.props.unit] || [];
let isPct = this.props.unit === 'pct';
people = people.slice(0, 8);
- Read upRead up
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 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
let unit = this.props.unit;
let counts = this.props.counts;
if (this.props.sort) {
- Read upRead up
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 || (window.matchMedia = function() {
"use strict";
// For browsers that support matchMedium api such as IE 9 and webkit
var styleMedia = (window.styleMedia || window.media);
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']