Skip to content

Commit

Permalink
Tests: add ruby style and code checks via rubocop
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sumpfralle committed Aug 25, 2020
1 parent 809639a commit 758c3ec
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ addons:
- zsh
- pylint
- shellcheck
- rubocop
- pkg-config
- libdb-dev
- libvirt-dev
Expand Down
33 changes: 33 additions & 0 deletions t/test-exception-wrapper.expected-failures
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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_
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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_
Expand All @@ -426,13 +453,18 @@ 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
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
Expand All @@ -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
Expand Down
21 changes: 15 additions & 6 deletions t/test.t
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 758c3ec

Please sign in to comment.