MITLibraries/timdex

View on GitHub

Showing 20 of 20 total issues

Block has too many lines. [56/25]
Open

field :search, SearchType, null: false,
description: 'Search for timdex records' do
argument :searchterm, String, required: false, default_value: nil, description: 'Query all searchable fields'
argument :citation, String, required: false, default_value: nil, description: 'Search by citation information'
argument :contributors, String, required: false, default_value: nil,
Severity: Minor
Found in app/graphql/types/query_type.rb by rubocop

Cyclomatic complexity for filters is too high. [16/7]
Open

def filters(params)
f = []
 
if params[:contributors_filter].present?
params[:contributors_filter].each do |p|
Severity: Minor
Found in app/models/opensearch.rb by rubocop

Perceived complexity for filters is too high. [16/8]
Open

def filters(params)
f = []
 
if params[:contributors_filter].present?
params[:contributors_filter].each do |p|
Severity: Minor
Found in app/models/opensearch.rb by rubocop

Method has too many lines. [14/10]
Open

def ensure_hash(ambiguous_param)
case ambiguous_param
when String
if ambiguous_param.present?
ensure_hash(JSON.parse(ambiguous_param))

Method has too many lines. [13/10]
Open

def execute
variables = ensure_hash(params[:variables])
query = params[:query]
operation_name = params[:operationName]
context = {

Method construct_query has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

def construct_query(searchterm, citation, contributors, funding_information, geodistance, geobox, identifiers,
locations, subjects, title, source, boolean_type, filters)
Severity: Major
Found in app/graphql/types/query_type.rb - About 1 hr to fix

    Avoid parameter lists longer than 5 parameters. [15/5]
    Open

    def search(searchterm:, citation:, contributors:, funding_information:, geodistance:, geobox:, identifiers:,
    locations:, subjects:, title:, index:, source:, from:, boolean_type:, **filters)
    Severity: Minor
    Found in app/graphql/types/query_type.rb by rubocop

    Avoid parameter lists longer than 5 parameters. [13/5]
    Open

    def construct_query(searchterm, citation, contributors, funding_information, geodistance, geobox, identifiers,
    locations, subjects, title, source, boolean_type, filters)
    Severity: Minor
    Found in app/graphql/types/query_type.rb by rubocop

    Assignment Branch Condition size for collapse_buckets is too high. [<0, 24, 0> 24/17]
    Open

    def collapse_buckets(es_aggs)
    {
    access_to_files: es_aggs['access_to_files']['only_file_access']['access_types']['buckets'],
    contributors: es_aggs['contributors']['contributor_names']['buckets'],
    source: es_aggs['source']['buckets'],
    Severity: Minor
    Found in app/graphql/types/query_type.rb by rubocop

    Use ENV.fetch('JWT_SECRET_KEY') or ENV.fetch('JWT_SECRET_KEY', nil) instead of ENV['JWT_SECRET_KEY'].
    Open

    JWT.encode(payload, ENV['JWT_SECRET_KEY'])
    Severity: Minor
    Found in app/helpers/jwt_wrapper.rb by rubocop

    Omit the hash value.
    Open

    result = TimdexSchema.execute(query, variables: variables,

    Omit the hash value.
    Open

    operation_name: operation_name)

    Assignment Branch Condition size for filters is too high. [<7, 49, 15> 51.72/17]
    Open

    def filters(params)
    f = []
     
    if params[:contributors_filter].present?
    params[:contributors_filter].each do |p|
    Severity: Minor
    Found in app/models/opensearch.rb by rubocop

    Prefer keyword arguments for arguments with a boolean default value; use highlight: false instead of highlight = false.
    Open

    def search(from, params, client, highlight = false, index = nil)
    Severity: Minor
    Found in app/models/opensearch.rb by rubocop

    Use ENV.fetch('JWT_SECRET_KEY') or ENV.fetch('JWT_SECRET_KEY', nil) instead of ENV['JWT_SECRET_KEY'].
    Open

    JWT.decode(token, ENV['JWT_SECRET_KEY']).first
    Severity: Minor
    Found in app/helpers/jwt_wrapper.rb by rubocop

    Assignment Branch Condition size for matches is too high. [<1, 19, 3> 19.26/17]
    Open

    def matches
    m = []
    if @params[:q].present?
    m << {
    multi_match: {
    Severity: Minor
    Found in app/models/opensearch.rb by rubocop

    Use ENV.fetch('PREFERRED_DOMAIN') or ENV.fetch('PREFERRED_DOMAIN', nil) instead of ENV['PREFERRED_DOMAIN'].
    Open

    redirect_to "https://#{ENV['PREFERRED_DOMAIN']}", status: :moved_permanently, allow_other_host: true

    Omit the hash value.
    Open

    record = client.search(index: index, body: f)
    Severity: Minor
    Found in app/models/retrieve.rb by rubocop

    Omit the hash value.
    Open

    context: context,

    Assignment Branch Condition size for construct_query is too high. [<22, 31, 0> 38.01/17]
    Open

    def construct_query(searchterm, citation, contributors, funding_information, geodistance, geobox, identifiers,
    locations, subjects, title, source, boolean_type, filters)
    query = {}
    query[:q] = searchterm
    query[:boolean_type] = boolean_type
    Severity: Minor
    Found in app/graphql/types/query_type.rb by rubocop
    Severity
    Category
    Status
    Source
    Language