Inspecting 7 files WWWCWCC Offenses: draining_servers.rb:19:57: C: Trailing whitespace detected. # Add or remove servers from draining mode via zookeeper ^ draining_servers.rb:32:8: C: Freeze mutable objects assigned to constants. NAME = "draining_servers" ^^^^^^^^^^^^^^^^^^ draining_servers.rb:32:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. NAME = "draining_servers" ^^^^^^^^^^^^^^^^^^ draining_servers.rb:37:81: C: Line is too long. [124/80] opts.banner = "Usage: ./hbase org.jruby.Main #{NAME}.rb [options] add|remove|list || ..." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:38:81: C: Line is too long. [120/80] opts.separator 'Add remove or list servers in draining mode. Can accept either hostname to drain all region servers' + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:38:120: C: Use \ instead of + or << to concatenate those strings. opts.separator 'Add remove or list servers in draining mode. Can accept either hostname to drain all region servers' + ^ draining_servers.rb:39:81: C: Line is too long. [136/80] 'in that host, a host:port pair or a host,port,startCode triplet. More than one server can be given separated by space' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:53:5: C: Use snake_case for method names. def getServers(admin) ^^^^^^^^^^ draining_servers.rb:54:3: C: Use snake_case for variable names. serverInfos = admin.getClusterStatus().getServers() ^^^^^^^^^^^ draining_servers.rb:54:39: C: Do not use parentheses for method calls with no arguments. serverInfos = admin.getClusterStatus().getServers() ^ draining_servers.rb:54:52: C: Do not use parentheses for method calls with no arguments. serverInfos = admin.getClusterStatus().getServers() ^ draining_servers.rb:56:3: C: Prefer each over for. for server in serverInfos ^^^ draining_servers.rb:57:36: C: Do not use parentheses for method calls with no arguments. servers << server.getServerName() ^ draining_servers.rb:59:3: C: Redundant return detected. return servers ^^^^^^ draining_servers.rb:62:1: C: Assignment Branch Condition size for getServerNames is too high. [16.4/15] def getServerNames(hostOrServers, config) ^^^ draining_servers.rb:62:1: C: Cyclomatic complexity for getServerNames is too high. [7/6] def getServerNames(hostOrServers, config) ^^^ draining_servers.rb:62:1: C: Method has too many lines. [18/10] def getServerNames(hostOrServers, config) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:62:1: C: Perceived complexity for getServerNames is too high. [8/7] def getServerNames(hostOrServers, config) ^^^ draining_servers.rb:62:5: C: Use snake_case for method names. def getServerNames(hostOrServers, config) ^^^^^^^^^^^^^^ draining_servers.rb:62:20: C: Use snake_case for variable names. def getServerNames(hostOrServers, config) ^^^^^^^^^^^^^ draining_servers.rb:65:1: C: Trailing whitespace detected. draining_servers.rb:66:3: C: Prefer each over for. for hostOrServer in hostOrServers ^^^ draining_servers.rb:66:7: C: Use snake_case for variable names. for hostOrServer in hostOrServers ^^^^^^^^^^^^ draining_servers.rb:69:18: C: Do not use parentheses for method calls with no arguments. if parts.size() == 3 ^ draining_servers.rb:71:9: C: Trailing whitespace detected. else ^ draining_servers.rb:72:7: C: Favor unless over if for negative conditions. admin = connection.getAdmin() if not admin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:72:34: C: Do not use parentheses for method calls with no arguments. admin = connection.getAdmin() if not admin ^ draining_servers.rb:72:40: C: Use ! instead of not. admin = connection.getAdmin() if not admin ^^^ draining_servers.rb:75:7: C: Use snake_case for variable names. hostOrServer = hostOrServer.gsub(/:/, ",") ^^^^^^^^^^^^ draining_servers.rb:75:35: C: Use tr instead of gsub. hostOrServer = hostOrServer.gsub(/:/, ",") ^^^^^^^^^^^^^^ draining_servers.rb:75:45: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. hostOrServer = hostOrServer.gsub(/:/, ",") ^^^ draining_servers.rb:76:7: C: Prefer each over for. for server in servers ^^^ draining_servers.rb:76:28: C: Trailing whitespace detected. for server in servers ^ draining_servers.rb:77:9: C: Avoid more than 3 levels of block nesting. ret << server if server.start_with?(hostOrServer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:81:1: C: Trailing whitespace detected. draining_servers.rb:82:14: C: Do not use parentheses for method calls with no arguments. admin.close() if admin ^ draining_servers.rb:83:19: C: Do not use parentheses for method calls with no arguments. connection.close() ^ draining_servers.rb:84:3: C: Redundant return detected. return ret ^^^^^^ draining_servers.rb:87:1: C: Method has too many lines. [12/10] def addServers(options, hostOrServers) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:87:5: C: Use snake_case for method names. def addServers(options, hostOrServers) ^^^^^^^^^^ draining_servers.rb:87:16: W: Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used. def addServers(options, hostOrServers) ^^^^^^^ draining_servers.rb:87:25: C: Use snake_case for variable names. def addServers(options, hostOrServers) ^^^^^^^^^^^^^ draining_servers.rb:88:37: C: Do not use parentheses for method calls with no arguments. config = HBaseConfiguration.create() ^ draining_servers.rb:90:1: C: Trailing whitespace detected. draining_servers.rb:91:72: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^^^^ draining_servers.rb:91:81: C: Line is too long. [95/80] zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^ draining_servers.rb:92:3: C: Use snake_case for variable names. parentZnode = zkw.drainingZNode ^^^^^^^^^^^ draining_servers.rb:93:1: C: Trailing whitespace detected. draining_servers.rb:95:5: C: Prefer each over for. for server in servers ^^^ draining_servers.rb:100:14: C: Do not use parentheses for method calls with no arguments. zkw.close() ^ draining_servers.rb:104:1: C: Method has too many lines. [12/10] def removeServers(options, hostOrServers) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:104:5: C: Use snake_case for method names. def removeServers(options, hostOrServers) ^^^^^^^^^^^^^ draining_servers.rb:104:19: W: Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used. def removeServers(options, hostOrServers) ^^^^^^^ draining_servers.rb:104:28: C: Use snake_case for variable names. def removeServers(options, hostOrServers) ^^^^^^^^^^^^^ draining_servers.rb:105:37: C: Do not use parentheses for method calls with no arguments. config = HBaseConfiguration.create() ^ draining_servers.rb:107:1: C: Trailing whitespace detected. draining_servers.rb:108:72: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^^^^ draining_servers.rb:108:81: C: Line is too long. [95/80] zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^ draining_servers.rb:109:3: C: Use snake_case for variable names. parentZnode = zkw.drainingZNode ^^^^^^^^^^^ draining_servers.rb:110:1: C: Trailing whitespace detected. draining_servers.rb:112:5: C: Prefer each over for. for server in servers ^^^ draining_servers.rb:117:14: C: Do not use parentheses for method calls with no arguments. zkw.close() ^ draining_servers.rb:122:5: C: Use snake_case for method names. def listServers(options) ^^^^^^^^^^^ draining_servers.rb:122:17: W: Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used. You can also write as listServers(*) if you want the method to accept any arguments but don't care about them. def listServers(options) ^^^^^^^ draining_servers.rb:123:37: C: Do not use parentheses for method calls with no arguments. config = HBaseConfiguration.create() ^ draining_servers.rb:124:1: C: Trailing whitespace detected. draining_servers.rb:125:72: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^^^^ draining_servers.rb:125:81: C: Line is too long. [95/80] zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers", nil) ^^^^^^^^^^^^^^^ draining_servers.rb:126:3: C: Use snake_case for variable names. parentZnode = zkw.drainingZNode ^^^^^^^^^^^ draining_servers.rb:129:16: C: Space between { and | missing. servers.each {|server| puts server} ^^ draining_servers.rb:129:37: C: Space missing inside }. servers.each {|server| puts server} ^ draining_servers.rb:132:1: C: Use snake_case for variable names. hostOrServers = ARGV[1..ARGV.size()] ^^^^^^^^^^^^^ draining_servers.rb:132:34: C: Do not use parentheses for method calls with no arguments. hostOrServers = ARGV[1..ARGV.size()] ^ draining_servers.rb:135:1: C: Assignment Branch Condition size for configureLogging is too high. [22.23/15] def configureLogging(options) ^^^ draining_servers.rb:135:5: C: Use snake_case for method names. def configureLogging(options) ^^^^^^^^^^^^^^^^ draining_servers.rb:136:3: C: Use snake_case for variable names. apacheLogger = LogFactory.getLog(NAME) ^^^^^^^^^^^^ draining_servers.rb:138:10: C: Don't use parentheses around the condition of an unless. unless (options[:debug]) ^^^^^^^^^^^^^^^^^ draining_servers.rb:138:27: C: Trailing whitespace detected. unless (options[:debug]) ^ draining_servers.rb:139:48: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. logger = org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase") ^^^^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:141:48: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. logger = org.apache.log4j.Logger.getLogger("org.apache.zookeeper") ^^^^^^^^^^^^^^^^^^^^^^ draining_servers.rb:144:3: C: Redundant return detected. return apacheLogger ^^^^^^ draining_servers.rb:148:1: C: Do not introduce global variables. $LOG = configureLogging(options) ^^^^ draining_servers.rb:150:3: C: Indent when as deep as case. when 'add' ^^^^ draining_servers.rb:156:3: C: Indent when as deep as case. when 'remove' ^^^^ draining_servers.rb:162:3: C: Indent when as deep as case. when 'list' ^^^^ get-active-master.rb:1:1: W: Script file get-active-master.rb doesn't have execute permission. #!/usr/bin/env hbase-jruby ^^^^^^^^^^^^^^^^^^^^^^^^^^ get-active-master.rb:20:13: C: Trailing whitespace detected. include Java ^ get-active-master.rb:37:58: C: Do not use parentheses for method calls with no arguments. puts ServerName.parseFrom(master_address).getHostname() ^ get-active-master.rb:42:11: C: Do not use parentheses for method calls with no arguments. zk.close() ^ get-active-master.rb:44:1: C: 1 trailing blank lines detected. hirb.rb:55:1: C: Use 2 spaces for indentation in a heredoc by using some library(e.g. ActiveSupport's String#strip_heredoc). Usage: shell [OPTIONS] [SCRIPTFILE [ARGUMENTS]] ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:73:1: C: Prefer each over for. for arg in ARGV ^^^ hirb.rb:75:14: C: Avoid the use of Perl-style backrefs. format = $1 ^^ hirb.rb:76:5: C: Use a guard clause instead of wrapping the code inside a conditional expression. if format =~ /^html$/i ^^ hirb.rb:77:7: C: Provide an exception class and message as arguments to raise. raise NoMethodError.new("Not yet implemented") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:77:31: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. raise NoMethodError.new("Not yet implemented") ^^^^^^^^^^^^^^^^^^^^^ hirb.rb:81:7: C: Provide an exception class and message as arguments to raise. raise ArgumentError.new("Unsupported format " + arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:81:31: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. raise ArgumentError.new("Unsupported format " + arg) ^^^^^^^^^^^^^^^^^^^^^ hirb.rb:84:3: C: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead. elsif arg == '-h' || arg == '--help' ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:87:3: C: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead. elsif arg == '-d' || arg == '--debug' ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:89:5: C: Do not introduce global variables. $fullBackTrace = true ^^^^^^^^^^^^^^ hirb.rb:92:10: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. puts "Setting DEBUG log level..." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:93:3: C: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead. elsif arg == '-n' || arg == '--noninteractive' ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:107:15: W: Shadowing outer local variable - arg. found.each { |arg| ARGV.delete(arg) } ^^^ hirb.rb:109:1: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. if @shell_debug ^^ hirb.rb:114:35: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:115:35: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:148:1: C: Assignment Branch Condition size for debug is too high. [23.79/15] def debug ^^^ hirb.rb:148:1: C: Method has too many lines. [12/10] def debug ... ^^^^^^^^^ hirb.rb:158:37: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:159:37: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:159:81: C: Line is too long. [82/80] org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(log_level) ^^ hirb.rb:171:81: C: Line is too long. [98/80] # If script2run, try running it. If we're in interactive mode, will go on to run the shell unless ^^^^^^^^^^^^^^^^^^ hirb.rb:179:11: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. require "irb" ^^^^^ hirb.rb:182:3: C: Missing top-level module documentation comment. module IRB ^^^^^^ hirb.rb:183:5: C: Assignment Branch Condition size for start is too high. [15.3/15] def self.start(ap_path = nil) ^^^ hirb.rb:183:5: C: Method has too many lines. [15/10] def self.start(ap_path = nil) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:184:16: C: Do not use :: for method calls. $0 = File::basename(ap_path, ".rb") if ap_path ^^ hirb.rb:184:36: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. $0 = File::basename(ap_path, ".rb") if ap_path ^^^^^ hirb.rb:189:43: C: Do not introduce global variables. @CONF[:BACK_TRACE_LIMIT] = 0 unless $fullBackTrace ^^^^^^^^^^^^^^ hirb.rb:191:7: C: Use the return of the conditional for variable assignment and comparison. if @CONF[:SCRIPT] ... ^^^^^^^^^^^^^^^^^ hirb.rb:214:13: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. require "irb/ruby-lex" ^^^^^^^^^^^^^^ hirb.rb:215:13: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. require "irb/workspace" ^^^^^^^^^^^^^^^ hirb.rb:216:43: C: Do not use parentheses for method calls with no arguments. workspace = IRB::WorkSpace.new(binding()) ^ hirb.rb:220:5: C: Use 2 (not 3) spaces for indentation. puts(workspace.evaluate(nil, statement, 'stdin', linenum)) ^^^ hirb.rb:224:3: W: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError? rescue Exception => exception ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hirb.rb:228:18: C: Prefer Object#is_a? over Object#kind_of?. if exception.kind_of? java.lang.Exception ^^^^^^^^ hirb.rb:229:20: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. $stderr.puts "java exception" ^^^^^^^^^^^^^^^^ hirb.rb:232:81: C: Line is too long. [82/80] # Include the 'ERROR' string to try to make transition easier for scripts that ^^ hirb.rb:235:5: C: Use a guard clause instead of wrapping the code inside a conditional expression. if $fullBacktrace ^^ hirb.rb:235:8: C: Do not introduce global variables. if $fullBacktrace ^^^^^^^^^^^^^^ region_mover.rb:23:1: C: Do not introduce global variables. $BIN=File.dirname(__FILE__) ^^^^ region_mover.rb:23:5: C: Surrounding space missing for operator =. $BIN=File.dirname(__FILE__) ^ region_mover.rb:24:9: C: Do not introduce global variables. exec "#{$BIN}/hbase org.apache.hadoop.hbase.util.RegionMover #{ARGV.join(' ')}" ^^^^ region_status.rb:23:81: C: Line is too long. [88/80] # ${HBASE_HOME}/bin/hbase org.jruby.Main region_status.rb [wait] [--table ] ^^^^^^^^ region_status.rb:25:1: C: Extra blank line detected. region_status.rb:28:66: C: Use \ instead of + or << to concatenate those strings. usage = 'Usage : ./hbase org.jruby.Main region_status.rb [wait]' + ^ region_status.rb:29:3: C: Align the operands of an expression in an assignment spanning multiple lines. '[--table ]\n' ^^^^^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:33:5: C: Do not introduce global variables. $tablename = tablename ^^^^^^^^^^ region_status.rb:35:56: C: Do not use semicolons to terminate expressions. o.on('-h', '--help', 'Display help message') { puts o; exit } ^ region_status.rb:40:12: C: Use && instead of and. if ARGV[0] and not SHOULD_WAIT ^^^ region_status.rb:40:16: C: Use ! instead of not. if ARGV[0] and not SHOULD_WAIT ^^^ region_status.rb:45:1: C: Extra blank line detected. region_status.rb:64:35: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:65:35: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(log_level) ^^^^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:72:1: C: Use Kernel#loop for infinite loops. while true ^^^^^ region_status.rb:72:7: W: Literal true appeared in a condition. while true ^^^^ region_status.rb:74:32: C: Do not use parentheses for method calls with no arguments. admin = connection.getAdmin() ^ region_status.rb:76:39: W: Useless assignment to variable - e. rescue MasterNotRunningException => e ^ region_status.rb:86:4: C: Do not introduce global variables. if $tablename.nil? ^^^^^^^^^^ region_status.rb:89:3: C: Use snake_case for variable names. tableNameMetaPrefix = $tablename + HConstants::META_ROW_DELIMITER.chr ^^^^^^^^^^^^^^^^^^^ region_status.rb:89:25: C: Do not introduce global variables. tableNameMetaPrefix = $tablename + HConstants::META_ROW_DELIMITER.chr ^^^^^^^^^^ region_status.rb:100:1: W: Useless assignment to variable - table. table = nil ^^^^^ region_status.rb:102:1: C: Use Kernel#loop for infinite loops. while true ^^^^^ region_status.rb:102:7: W: Literal true appeared in a condition. while true ^^^^ region_status.rb:115:39: C: Do not use parentheses for method calls with no arguments. rowid = Bytes.toString(result.getRow()) ^ region_status.rb:116:3: C: Use snake_case for variable names. rowidStr = java.lang.String.new(rowid) ^^^^^^^^ region_status.rb:117:6: C: Use ! instead of not. if not $tablename.nil? and not rowidStr.startsWith(tableNameMetaPrefix) ^^^ region_status.rb:117:10: C: Do not introduce global variables. if not $tablename.nil? and not rowidStr.startsWith(tableNameMetaPrefix) ^^^^^^^^^^ region_status.rb:117:26: C: Use && instead of and. if not $tablename.nil? and not rowidStr.startsWith(tableNameMetaPrefix) ^^^ region_status.rb:117:30: C: Use ! instead of not. if not $tablename.nil? and not rowidStr.startsWith(tableNameMetaPrefix) ^^^ region_status.rb:121:29: C: Do not use :: for method calls. region = MetaTableAccessor::getHRegionInfo(result) ^^ region_status.rb:122:3: C: Favor unless over if for negative conditions. if not region.isOffline ... ^^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:122:6: C: Use ! instead of not. if not region.isOffline ^^^ region_status.rb:130:1: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. if $tablename.nil? ^^ region_status.rb:130:4: C: Do not introduce global variables. if $tablename.nil? ^^^^^^^^^^ region_status.rb:135:1: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. if not $tablename.nil? ^^ region_status.rb:135:1: C: Favor unless over if for negative conditions. if not $tablename.nil? ... ^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:135:4: C: Use ! instead of not. if not $tablename.nil? ^^^ region_status.rb:135:8: C: Do not introduce global variables. if not $tablename.nil? ^^^^^^^^^^ region_status.rb:136:3: C: Do not introduce global variables. $TableName = TableName.valueOf($tablename.to_java_bytes) ^^^^^^^^^^ region_status.rb:136:34: C: Do not introduce global variables. $TableName = TableName.valueOf($tablename.to_java_bytes) ^^^^^^^^^^ region_status.rb:138:1: C: Use Kernel#loop for infinite loops. while true ^^^^^ region_status.rb:138:7: W: Literal true appeared in a condition. while true ^^^^ region_status.rb:139:6: C: Do not introduce global variables. if $tablename.nil? ^^^^^^^^^^ region_status.rb:140:42: C: Do not use parentheses for method calls with no arguments. server_count = admin.getClusterStatus().getRegionsCount() ^ region_status.rb:140:60: C: Do not use parentheses for method calls with no arguments. server_count = admin.getClusterStatus().getRegionsCount() ^ region_status.rb:142:35: C: Do not use :: for method calls. connection = ConnectionFactory::createConnection(config); ^^ region_status.rb:142:61: C: Do not use semicolons to terminate expressions. connection = ConnectionFactory::createConnection(config); ^ region_status.rb:143:37: C: Do not use :: for method calls. server_count = MetaTableAccessor::allTableRegions(connection, $TableName).size() ^^ region_status.rb:143:67: C: Do not introduce global variables. server_count = MetaTableAccessor::allTableRegions(connection, $TableName).size() ^^^^^^^^^^ region_status.rb:143:81: C: Line is too long. [84/80] server_count = MetaTableAccessor::allTableRegions(connection, $TableName).size() ^^^^ region_status.rb:143:83: C: Do not use parentheses for method calls with no arguments. server_count = MetaTableAccessor::allTableRegions(connection, $TableName).size() ^ region_status.rb:146:3: C: Use a guard clause instead of wrapping the code inside a conditional expression. if SHOULD_WAIT and server_count < meta_count ^^ region_status.rb:146:18: C: Use && instead of and. if SHOULD_WAIT and server_count < meta_count ^^^ region_status.rb:147:5: C: Missing space after #. #continue this loop until server & meta count match ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ region_status.rb:153:12: C: Do not use parentheses for method calls with no arguments. admin.close() ^ region_status.rb:154:17: C: Do not use parentheses for method calls with no arguments. connection.close() ^ shutdown_regionserver.rb:30:14: C: Surrounding space missing in default value assignment. def usage(msg=nil) ^ shutdown_regionserver.rb:34:28: C: Favor format over String#%. $stderr.puts 'Error: %s' % msg if msg ^ shutdown_regionserver.rb:38:10: C: Use empty? instead of length < 1. usage if ARGV.length < 1 ^^^^^^^^^^^^^^^ shutdown_regionserver.rb:41:33: C: Favor format over String#%. usage 'Invalid host:port: %s' % x unless x.include? ':' ^ shutdown_regionserver.rb:44:35: C: Do not use parentheses for method calls with no arguments. config = HBaseConfiguration.create() ^ shutdown_regionserver.rb:47:30: C: Do not use parentheses for method calls with no arguments. admin = connection.getAdmin() ^ shutdown_regionserver.rb:55:12: C: Do not use parentheses for method calls with no arguments. admin.close() ^ shutdown_regionserver.rb:56:17: C: Do not use parentheses for method calls with no arguments. connection.close() ^ replication/copy_tables_desc.rb:37:8: C: Freeze mutable objects assigned to constants. NAME = "copy_tables_desc" ^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:37:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. NAME = "copy_tables_desc" ^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:41:81: C: Line is too long. [162/80] puts 'Usage: %s.rb master_zookeeper.quorum.peers:clientport:znode_parent slave_zookeeper.quorum.peers:clientport:znode_parent [table1,table2,table3,...]' % NAME ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:41:157: C: Favor format over String#%. puts 'Usage: %s.rb master_zookeeper.quorum.peers:clientport:znode_parent slave_zookeeper.quorum.peers:clientport:znode_parent [table1,table2,table3,...]' % NAME ^ replication/copy_tables_desc.rb:45:1: C: Assignment Branch Condition size for copy is too high. [19.13/15] def copy (src, dst, table) ^^^ replication/copy_tables_desc.rb:45:1: C: Method has too many lines. [13/10] def copy (src, dst, table) ... ^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:45:9: C: Do not put a space between a method name and the opening parenthesis. def copy (src, dst, table) ^ replication/copy_tables_desc.rb:50:57: C: Favor format over String#%. puts "Source table \"%s\" doesn't exist, skipping." % table ^ replication/copy_tables_desc.rb:58:10: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. puts "Destination table \"%s\" exists in remote cluster, skipping." % table ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:58:73: C: Favor format over String#%. puts "Destination table \"%s\" exists in remote cluster, skipping." % table ^ replication/copy_tables_desc.rb:62:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. puts "Schema for table \"%s\" was succesfully copied to remote cluster." % table ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:62:76: C: Favor format over String#%. puts "Schema for table \"%s\" was succesfully copied to remote cluster." % table ^ replication/copy_tables_desc.rb:62:81: C: Line is too long. [82/80] puts "Schema for table \"%s\" was succesfully copied to remote cluster." % table ^^ replication/copy_tables_desc.rb:65:1: C: Extra blank line detected. replication/copy_tables_desc.rb:66:1: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. if ARGV.size < 2 || ARGV.size > 3 ^^ replication/copy_tables_desc.rb:72:24: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. parts1 = ARGV[0].split(":") ^^^ replication/copy_tables_desc.rb:74:24: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. parts2 = ARGV[1].split(":") ^^^ replication/copy_tables_desc.rb:76:24: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. parts3 = ARGV[2].split(",") unless ARGV[2].nil? ^^^ replication/copy_tables_desc.rb:78:31: C: Do not use parentheses for method calls with no arguments. c1 = HBaseConfiguration.create() ^ replication/copy_tables_desc.rb:80:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. c1.set("hbase.zookeeper.property.clientPort", parts1[1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:84:30: C: Do not use parentheses for method calls with no arguments. admin1 = connection1.getAdmin() ^ replication/copy_tables_desc.rb:86:31: C: Do not use parentheses for method calls with no arguments. c2 = HBaseConfiguration.create() ^ replication/copy_tables_desc.rb:88:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. c2.set("hbase.zookeeper.property.clientPort", parts2[1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ replication/copy_tables_desc.rb:92:30: C: Do not use parentheses for method calls with no arguments. admin2 = connection2.getAdmin() ^ replication/copy_tables_desc.rb:95:24: C: Do not use parentheses for method calls with no arguments. admin1.listTableNames().each do |t| ^ replication/copy_tables_desc.rb:96:40: C: Do not use parentheses for method calls with no arguments. copy(admin1, admin2, t.nameAsString()) ^ replication/copy_tables_desc.rb:104:13: C: Do not use parentheses for method calls with no arguments. admin1.close() ^ replication/copy_tables_desc.rb:105:13: C: Do not use parentheses for method calls with no arguments. admin2.close() ^ replication/copy_tables_desc.rb:106:18: C: Do not use parentheses for method calls with no arguments. connection1.close() ^ replication/copy_tables_desc.rb:107:18: C: Do not use parentheses for method calls with no arguments. connection2.close() ^ 7 files inspected, 226 offenses detected