3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

Liquid::Drops::BillingAddress#country has the variable name 'c'
Open

    if c = ::Country.find_by_code(@account.billing_address.country)

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Gitlab::Testing::RequestInspectorMiddleware#call has the variable name 'b'
Open

        body.each { |b| full_body << b }

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

DeveloperPortal::Admin::ApplicationsController#update has the variable name 'f'
Open

      respond_with(application) do | f |
        f.js { render js: "jQuery.flash.notice('#{flash[:notice]}');" }
      end
    else
      respond_with(application) do | f |

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Arel::Visitors#visit_Arel_Nodes_In has the parameter name 'o'
Open

      def visit_Arel_Nodes_In(o, collector)
Severity: Minor
Found in lib/arel/visitors/oracle12_hack.rb by reek

An Uncommunicative Parameter Name is a parameter name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Liquid::Drops::Fields#self.builtin_fields has the variable name 'f'
Open

        fields = object.defined_fields.select do |f|

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Liquid::Drops::Fields#self.extra_fields has the variable name 'f'
Open

        fields = object.defined_fields.select do |f|

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Arel::Visitors#visit_Arel_Nodes_NotIn has the name 'visit_Arel_Nodes_NotIn'
Open

      def visit_Arel_Nodes_NotIn(o, collector)
Severity: Minor
Found in lib/arel/visitors/oracle12_hack.rb by reek

An Uncommunicative Method Name is a method name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Liquid::Drops::ServiceContract#service has the variable name 's'
Open

        if s = find_service

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Gitlab::Testing::RequestInspectorMiddleware#http_headers_env has the variable name 'k'
Open

                .collect { |k, v| [k.split('-').collect(&:upcase).join('_'), v] }
                .collect { |k, v| [k.prepend('HTTP_'), v] }

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Liquid::Tags::Email#unquote_array has the variable name 'v'
Open

      values.flatten.map{|v| unquote(v) }.select{|v| v.respond_to?(:to_str)}

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Liquid::Tags::Form#render has the variable name 'v'
Open

        form = form_class.new(context, @object_name,  @html_attributes.inject({}){|result, (k,v)| result[k] = v.render(context); result} )

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Gitlab::Testing::RequestInspectorMiddleware#env_http_headers has the variable name 'v'
Open

        Hash[*env.select { |k, v| k.start_with? 'HTTP_' }
                .collect { |k, v| [k.sub(/^HTTP_/, ''), v] }
                .collect { |k, v| [k.split('_').collect(&:capitalize).join('-'), v] }

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Arel::Visitors#visit_Arel_Nodes_In has the name 'visit_Arel_Nodes_In'
Open

      def visit_Arel_Nodes_In(o, collector)
Severity: Minor
Found in lib/arel/visitors/oracle12_hack.rb by reek

An Uncommunicative Method Name is a method name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Gitlab::Testing::RequestInspectorMiddleware#env_http_headers has the variable name 'k'
Open

        Hash[*env.select { |k, v| k.start_with? 'HTTP_' }
                .collect { |k, v| [k.sub(/^HTTP_/, ''), v] }
                .collect { |k, v| [k.split('_').collect(&:capitalize).join('-'), v] }

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

CallbackDebugging#debug_callback has the variable name 'e'
Open

        rescue => e
Severity: Minor
Found in config/initializers/debug_callbacks.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

RailsSQLiFix#action_controller_parameters_in? has the variable name 'v'
Open

    ActionController::Parameters === attributes || attributes.any?{|_k,v| ActionController::Parameters === v }
Severity: Minor
Found in config/initializers/rails_sqli.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

ThreeScale::Upgrades::From21To22 has the name 'From21To22'
Open

    class From21To22

An Uncommunicative Module Name is a module name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Array#to_xml has the variable name 'e'
Open

    options[:root]     ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.underscore.pluralize.tr('/', '-') : "records"
Severity: Minor
Found in config/initializers/array_hacks.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

OpenSSL::Digest::MD5 has the name 'MD5'
Open

    class MD5; end
Severity: Minor
Found in config/initializers/ssl.rb by reek

An Uncommunicative Module Name is a module name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Quote this to prevent word splitting.
Open

exec ${RAILS} runner $(readlink -f $(dirname $0))/3scale $*
Severity: Minor
Found in script/runner by shellcheck

Quote this to prevent word splitting

Problematic code:

ls -l $(getfilename)

Correct code:

# getfilename outputs 1 file
ls -l "$(getfilename)"

# getfilename outputs multiple files, linefeed separated
getfilename | while IFS='' read -r line
do
  ls -l "$line"
done

Rationale:

When command expansions are unquoted, word splitting and globbing will occur. This often manifests itself by breaking when filenames contain spaces.

Trying to fix it by adding quotes or escapes to the data will not work. Instead, quote the command substitution itself.

If the command substitution outputs multiple pieces of data, use a loop instead.

Exceptions

In rare cases you actually want word splitting, such as in

gcc $(pkg-config --libs openssl) client.c

This is because pkg-config outputs -lssl -lcrypto, which you want to break up by spaces into -lssl and -lcrypto. An alternative is to put the variables to an array and expand it:

args=( $(pkg-config --libs openssl) )
gcc "${args[@]}" client.c

The power of using an array becomes evident when you want to combine, for example, the command result with user-provided arguments:

compile () {
    args=( $(pkg-config --libs openssl) "${@}" )
    gcc "${args[@]}" client.c
}
compile -DDEBUG
+ gcc -lssl -lcrypto -DDEBUG client.c

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Severity
Category
Status
Source
Language