From 758c3ecdd7c6a709af449e2fc78571e28c7fe508 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Tue, 25 Aug 2020 17:41:46 +0200 Subject: [PATCH] Tests: add ruby style and code checks via rubocop At the moment all plugins fail the test out of various reasons. Thus they are exempted from causing test failures. But future (new) plugins will fail the test and thus indicate the relevant steps to fix issues before a plugin is included. --- .travis.yml | 1 + t/test-exception-wrapper.expected-failures | 33 ++++++++++++++++++++++ t/test.t | 21 ++++++++++---- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index eafd3de9..abad2157 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: - zsh - pylint - shellcheck + - rubocop - pkg-config - libdb-dev - libvirt-dev diff --git a/t/test-exception-wrapper.expected-failures b/t/test-exception-wrapper.expected-failures index 5f298af6..b0bdca69 100644 --- a/t/test-exception-wrapper.expected-failures +++ b/t/test-exception-wrapper.expected-failures @@ -30,6 +30,7 @@ plugins/bind/bind9_socket_stats plugins/bsd/df_abs_bsd plugins/bsd/df_bsd plugins/bsd/freebsd_hdd_power_state +plugins/bsd/netstat_bsd_m_ plugins/bsd/spamd-blacklist-bsd plugins/bsd/spamd-tarpit-bsd plugins/cacti/cacti-host @@ -90,6 +91,7 @@ plugins/dspam/dspam_activity plugins/dvb/2wcomdsr_ plugins/dvb/femon plugins/ejabberd/ejabberd_resources_ +plugins/ejabberd/ejabberd_scanlog plugins/emc/emc_vnx_block_lun_perfdata plugins/emc/emc_vnx_file_ plugins/fan/dell_fans @@ -148,11 +150,14 @@ plugins/harddisks/powered_up_ plugins/horde/horde plugins/http/http_pagespeed plugins/http/http_responsecode +plugins/http/mongrel_memory +plugins/http/mongrel_process_memory plugins/http/vhost_requests_ plugins/http/wget_page plugins/i2p/i2p_ plugins/icecast/icecast_ plugins/icecast/icecast2 +plugins/icecast/icecast2_simple plugins/icecast/icecast2_stats_ plugins/imapproxy/imapproxy_multi plugins/ip6/ip6_ @@ -187,7 +192,9 @@ plugins/memory/kmemsum plugins/memory/multimemory plugins/memory/proc_mem plugins/memory/proc_memory_status +plugins/minecraft/minecraft-users plugins/mixminion/mixminion +plugins/moblock/moblock_connections plugins/mod_jk/mod_jk plugins/moinmoin/moinoin_pages plugins/mongodb/mongo_btree @@ -197,6 +204,10 @@ plugins/mongodb/mongo_lag plugins/mongodb/mongo_lock plugins/mongodb/mongo_mem plugins/mongodb/mongo_ops +plugins/mssql/microsoft-sql +plugins/mssql/microsoft-sql-buffer-cache-hit-ratio +plugins/mssql/microsoft-sql-data-file-sizes +plugins/mssql/microsoft-sql-log-file-size plugins/mumble/mumble_users plugins/mumble/murmur-stats plugins/munin/healthcheck_log @@ -220,6 +231,7 @@ plugins/network/fwbuilder_ plugins/network/hfsc plugins/network/hfsc_sep plugins/network/host_traffic +plugins/network/http__tp_link plugins/network/if1sec_ plugins/network/ifem_ plugins/network/if_uptime @@ -235,6 +247,7 @@ plugins/network/mtr100_ plugins/network/netatalk plugins/network/netatalk3 plugins/network/net_hosts_ +plugins/network/netstat_s_ plugins/network/nsd3 plugins/network/olsrd plugins/network/packetloss @@ -270,20 +283,27 @@ plugins/ntp/ntp_pool_score_ plugins/openntpd/openntp_offset plugins/openvz/openvz_ plugins/oracle/oracle_connections +plugins/oracle/oracle-pga-monitor +plugins/oracle/oracle-sga plugins/oracle/oracle_sysstat plugins/ossec/ossec_active_response plugins/ossec/ossec_agents plugins/ossec/ossec_alerts plugins/other/beanstalkd plugins/other/cm2 +plugins/other/delayed_jobs_queue_size plugins/other/earthquakes-stronger-than-m4-and-m5-plus-solar-act plugins/other/foldingathome_activecpu plugins/other/globesurfer plugins/other/hookbox plugins/other/listeners plugins/other/pid +plugins/other/port_ plugins/other/s9y plugins/other/services +plugins/passenger/passenger_memory +plugins/passenger/passenger_processes +plugins/passenger/passenger_status plugins/pdns/pdns_errors plugins/pdns/pdns_queries plugins/pdns/pdns_rec_qtypes @@ -298,6 +318,7 @@ plugins/php/eaccelerator-python plugins/php/php5-fpm_status plugins/php/php_apc_ plugins/php/php-cgi +plugins/php/php_eaccelerator plugins/php/php_errors_ plugins/php/php_opcache plugins/php/php_sessions @@ -354,6 +375,7 @@ plugins/printer/toshiba_5520c_scan_ plugins/printer/xerox-wc3220 plugins/printer/xerox-wc7232-consumables plugins/puma/puma_ +plugins/puppet/puppet_runtime plugins/qmail/qmailconn plugins/qmail/queuestats plugins/qmail/spamdyke @@ -373,17 +395,20 @@ plugins/rethinkdb/rethinkdb_node_io plugins/riak/riak_fsm_time_95 plugins/riak/riak_memory plugins/riak/riak_node +plugins/router/ag241-adsl plugins/router/arris-tm502g_ plugins/router/bbox plugins/router/cisco-epc3010_ plugins/router/conexant_adsl plugins/router/dartybox +plugins/router/d-link-dir-655-router-statistics-plugin plugins/router/dsl-connection-speed plugins/router/dsl-stats plugins/router/freeboxuptime plugins/router/motorola_sb6141 plugins/router/snmp__juniper plugins/router/snmp__juniper_spu +plugins/router/snmp__linksys_poe plugins/router/speedport_300 plugins/rsync/rsyncd_bytes plugins/rsync/rsyncd_count @@ -405,6 +430,7 @@ plugins/smstools/smstools_ plugins/snmp/snmp___bri_se_ plugins/snmp/snmp__brocade_ifs plugins/snmp/snmp__fn +plugins/snmp/snmp_room_alert_ plugins/snmp/snmp__webthermometer plugins/solaris/io_disk plugins/solaris/zones_cpu @@ -414,6 +440,7 @@ plugins/sphinx/sphinx_documents plugins/squid/squid_efficiency plugins/squid/squid_times plugins/ssh/openssh-denyhosts +plugins/ssh/sshd_invalid_countries_ruby plugins/ssh/sshd_log plugins/streaming/packetship_ plugins/swift/swift-async_ @@ -426,6 +453,9 @@ plugins/system/file_length_ plugins/tarsnap/tarsnap plugins/tcp/tcp-retransmissions plugins/tcp/tcp-states +plugins/thin/thin_memory +plugins/thin/thins_peak_memory +plugins/thin/thin_threads plugins/tinydns/tinydns plugins/tinydns/tinydns_err plugins/tor/tor_traffic @@ -433,6 +463,8 @@ plugins/trafic_ro/trafic_ro_24h plugins/tv/hdhomerun_ plugins/twemproxy/nutcracker_requests_ plugins/unicorn/unicorn_ +plugins/unicorn/unicorn_memory_status +plugins/unicorn/unicorn_status plugins/user/membyuser plugins/user/multipsu plugins/user/system_users @@ -442,6 +474,7 @@ plugins/vmware/esxcli_env_ plugins/vmware/esxi plugins/vmware/esxi__sensors plugins/vmware/vm_cpu_load +plugins/voldemort/voldemort plugins/vpn/openvpn_as_mtime plugins/vpn/openvpn_as_traffic plugins/vpn/openvpn_as_ttime diff --git a/t/test.t b/t/test.t index 205ac5d4..45182f66 100644 --- a/t/test.t +++ b/t/test.t @@ -192,12 +192,21 @@ sub process_file { ); } elsif ( $interpreter =~ m{j?ruby} ) { - run_check( - { command => [ 'ruby', '-cw', $file ], - description => 'ruby syntax check', - filename => $filename - } - ); + subtest $filename => sub { + plan tests => 2; + run_check( + { command => [ 'ruby', '-cw', $file ], + description => 'ruby syntax check', + filename => $filename + } + ); + run_check( + { command => [ 'rubocop', $file ], + description => 'ruby style and syntax check', + filename => $filename + } + ); + } } elsif ( $interpreter =~ m{gawk} ) { run_check(