Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace checks #1127

Merged
merged 2 commits into from Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespell.exclude
Expand Up @@ -11,7 +11,7 @@ Stig Sandbeck Mathisen, E<lt>ssm@fnord.noE<gt>
Copyright 2009 Tim Small <tim@seoss.co.uk>
# Linjen som grep'es ut kan se ut som dette:
Mo Amini, Diyar Amin and Younes Hajji, Høgskolen i Oslo/Oslo
uses code written by Mo Amini, Diyar Amin and Younes Hajji,
uses code written by Mo Amini, Diyar Amin and Younes Hajji,
Christian Loos (5):
Tim Besard (3):
diSabler (1):
Expand Down
6 changes: 3 additions & 3 deletions Checklist
Expand Up @@ -3,7 +3,7 @@ This is a pre-release checklist for the maintainer.
* is there any "FIX" in: ChangeLog, INSTALL, Announce?

* Is .htaccess installed?
* rm -f /etc/munin/plugins/*
* rm -f /etc/munin/plugins/*
Does munin-node-configure -d show any autoconf errors?
Does munin-node-configure --debug run nicely or do we get perl errors?

Expand All @@ -12,8 +12,8 @@ This is a pre-release checklist for the maintainer.
1. cd plugins

2. Figure out which r the previous tag was at and do this (r910 was
1.3.2 and r1234 is head)
svn --verbose log -r910:1234 | fgrep node.d | grep -w A |
1.3.2 and r1234 is head)
svn --verbose log -r910:1234 | fgrep node.d | grep -w A |
cut -d/ -f 4- | sed 's/^node\.d\.//'

3. Check if the listed plugins are still present (or moved):
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Expand Up @@ -63,9 +63,10 @@ apply-formatting:
@# format munin libraries
find lib/ -type f -exec perltidy {} \;

.PHONY: lint lint-munin lint-plugins lint-spelling
.PHONY: lint lint-munin lint-plugins lint-spelling lint-whitespace

lint: lint-munin lint-plugins lint-spelling lint-whitespace

lint: lint-munin lint-plugins lint-spelling
lint-munin:
# Scanning munin code
perlcritic --profile .perlcriticrc lib/ script/
Expand Down Expand Up @@ -116,6 +117,18 @@ lint-spelling:
| grep --null-data -vE '\.(svg|png|gif|ico|css|woff|woff2|ttf|eot)$$' \
| xargs -0 -r codespell --exclude-file=.codespell.exclude

lint-whitespace: FILES_WITH_TRAILING_WHITESPACE = $(shell grep -r -l --binary-files=without-match \
--exclude-dir=.git --exclude-dir=sandbox '\s$$' . \
| grep -vE '/(blib|build|_build|web/static)/' \
| grep -vE '/logo\.eps$$')

lint-whitespace:
@if [ -n "$(FILES_WITH_TRAILING_WHITESPACE)" ]; then \
echo 'Files containing trailing whitespace or non-native line endings:'; \
printf '\t%s\n' $(FILES_WITH_TRAILING_WHITESPACE); \
false; fi 2>&1


.PHONY: clean
clean: $(BUILD_SCRIPT)
"$(BUILD_SCRIPT)" realclean
Expand Down
26 changes: 13 additions & 13 deletions contrib/munin-node-debug
@@ -1,8 +1,8 @@
#! /usr/bin/perl
# Munin node that presents as many virtual hosts, plugins & fields
# as needed to be able to :
# Munin node that presents as many virtual hosts, plugins & fields
# as needed to be able to:
# - emulate a HUGE network to stress the munin-master server
# - serve as a basis for protocol debugging
# - serve as a basis for protocol debugging
#
# Copyright (C) 2010 Steve Schnepp
#
Expand Down Expand Up @@ -45,7 +45,7 @@ my $arg_ret = GetOptions(
"startint-port|p=i" => \$starting_port,

"listen=s" => \$listen,

"update-rate=i" => \$update_rate,
"spoolfetch" => \$spoolfetch,
"spoolfetch-rate=i" => \$spoolfetch_rate,
Expand All @@ -68,19 +68,19 @@ Options:
-v --nb-servers-port <int> Number of virtual servers per port [1]
-p --start-port <int> Starting TCP listening port [24949]

-n --nb-plugins <int> Number of plugins per server [30]
-n --nb-plugins <int> Number of plugins per server [30]
-f --nb-fields <int> Number of fields per plugins [5]
--update-rate <int> Update rate of plugins (in seconds) [10]

--listen <host> Which IP to bind [localhost].
--listen <host> Which IP to bind [localhost].
Use '' or '*' to bind to every interface.

--spoolfetch Be spoolfetch capable
--starting-epoch Starting epoch: no data will available before.
Can be relative to now if negative [-3600]
Can be relative to now if negative [-3600]

-d --dump Only dump a generated munin.conf part [no]
--debug Print debug information [no]
--debug Print debug information [no]

};
exit 0;
Expand All @@ -104,7 +104,7 @@ if ($dump_config) {
print "\n";
}
}

# Only dump config
exit;
}
Expand Down Expand Up @@ -217,7 +217,7 @@ sub service

# Sends spools strictly > LastSpooled
for (my $epoch = ($timestamp - $timestamp % $update_rate + $update_rate);
$epoch < time; $epoch += $update_rate) {
$epoch < time; $epoch += $update_rate) {
for (my $plugin_number = 0; $plugin_number < $nb_plugins; $plugin_number ++) {
my $plugin_name = get_service($plugin_number);
print $client "multigraph $plugin_name\n";
Expand Down Expand Up @@ -253,16 +253,16 @@ sub service
}
}

sub get_plugin_number
sub get_plugin_number
{
my $plugin_name = shift;
my $plugin_number = $services{$plugin_name};
return $plugin_number || 0;
}

sub debug
sub debug
{
print join(" ", @_) . "\n" if $is_debug;
print join(" ", @_) . "\n" if $is_debug;
}

sub _get_from_array
Expand Down
6 changes: 3 additions & 3 deletions contrib/percentile
Expand Up @@ -30,7 +30,7 @@ Remember to supply config for these data series in the usual way.

=item 95 is the percentile to compute

=back
=back

The returned value is stuffed in in95th(day|week|month|year).value and
the value is graphed as usual.
Expand Down Expand Up @@ -61,7 +61,7 @@ sub percentile($;$$) {
# duration should be 1day, 1week, 1month or 1year.
$duration ||= "1week";
$n_th ||= 95; # can't have 0th percentile
my ($start,$step,$names,$data) =
my ($start,$step,$names,$data) =
RRDs::fetch($rrdfile,"MAX","-s","-$duration");
my @sums = ();
my $timestamp = $start;
Expand All @@ -75,7 +75,7 @@ sub percentile($;$$) {
push(@sums,$sum);
}
my $which = int(scalar(@sums)*($n_th)/100);
@sums = sort{$a<=>$b}(@sums);
@sums = sort{$a<=>$b}(@sums);
return $sums[$which];
}

Expand Down
2 changes: 1 addition & 1 deletion contrib/plugin-gallery/INSTALL
Expand Up @@ -51,7 +51,7 @@ Media links within the templates are absolute (e.g. /static/...) - thus you need
3. Setup a daily cronjob
------------------------

Place a file with content like this under /etc/cron.d/
Place a file with content like this under /etc/cron.d/

------ 8< ------
# Create fresh build of the Munin Plugin Gallery
Expand Down
6 changes: 3 additions & 3 deletions contrib/plugin-gallery/static/gallery-intro-contrib.html
Expand Up @@ -22,7 +22,7 @@ <h3>Increase usability in 3rd-Party Collection</h3>
</pre>

<p>It is great (!) to have so many plugins, graph images and pages already, but it will need a lot of work
to fill missing pages and upload images for useful plugins, that are
to fill missing pages and upload images for useful plugins, that are
not well presented in the gallery at the time. We will be happy if you help by adding info in perldoc format
and representative example graph images to the contrib repo.
The more descriptive content is there, the more helpful the Plugin Gallery will be ~</p>
Expand All @@ -33,9 +33,9 @@ <h3>Increase usability in 3rd-Party Collection</h3>
Have a look at our list of <a href="http://guide.munin-monitoring.org/en/latest/reference/graph-category.html#well-known-categories"><em>well-known-categories</em></a>,
and choose an appropriate category to present your plugin in the gallery.</p>

<p>Users can always change the category to adapt their personal view by changing the plugins sourcecode
<p>Users can always change the category to adapt their personal view by changing the plugins sourcecode
before distributing it on their servers or by configuration setting on the Munin masters side (munin.conf).</p>

<p>Our well-known-category list is a proposal and can be discussed on our
<p>Our well-known-category list is a proposal and can be discussed on our
<a href="https://lists.sourceforge.net/lists/listinfo/munin-users">user mailing list</a>.</p>
</div>
2 changes: 1 addition & 1 deletion contrib/python-plugin/arp
Expand Up @@ -31,7 +31,7 @@ for line in open("/proc/net/arp").readlines():
p[dev].value = 0
p[dev].label = dev
p[dev].draw = "AREA"

p[dev].value += 1

# Run it!
Expand Down
28 changes: 14 additions & 14 deletions contrib/rrdcopy
Expand Up @@ -4,13 +4,13 @@
# Copyright (C) 2009-2011 Steve Schnepp <steve.schnepp@pwkf.org>
#
# License: LGPL
#
#
# Usage : rrdcopy <src.rrd> <dst.rrd>
#
# Both RRD have to exist and have the same DS (DataSource).
#
# Both RRD have to exist and have the same DS (DataSource).
# The tool copies all the datasources from the sources into the destination
# like you mean it:
# - start is the oldest value from src
# like you mean it:
# - start is the oldest value from src
# (but cannot be younger than the youngest from dst)
# - stop is the youngest value from src
# - asks src for the AVERAGED value on each step time.
Expand All @@ -24,11 +24,11 @@
# RRA:AVERAGE:0.5:1:115200 \
# RRA:MIN:0.5:1:115200 \
# RRA:MAX:0.5:1:115200
#
# It doesn't do any MIN/MAX replication since this information
#
# It doesn't do any MIN/MAX replication since this information
# is usually not accurate at all when resampling.
#
# The environmment variable DEBUG is used like :
# The environmment variable DEBUG is used like:
# 0/absent - no debug
# 1 - emit to stdout all the updates to dst
# 2 - emit also the data that try
Expand All @@ -37,7 +37,7 @@
# XXX - It depends on RRDs.pm ...
# ... as I'm waiting for a patch to use the plain rrdtool cli :-)
#
# It was known as the rrdmove tool from the pmptools project.
# It was known as the rrdmove tool from the pmptools project.
# - I changed its name (as data is copied, not moved)
# - I changed its hosting (way more useful for munin than for pmptools)

Expand Down Expand Up @@ -67,7 +67,7 @@ $stop = $infos_src->{'last_update'};

my @rra_names;
foreach my $key (keys %$infos_dst) {
if ($key =~ /^rra\[(\w+)\]\.cf$/) {
if ($key =~ /^rra\[(\w+)\]\.cf$/) {
push @rra_names, $1;
}
}
Expand All @@ -82,12 +82,12 @@ foreach my $rra_name (sort {$a <=> $b} @rra_names) {
}

print "rra[$rra_name]:$rra_start("
. (scalar localtime($rra_start))
. (scalar localtime($rra_start))
. "):$start("
. (scalar localtime($start))
.")\n" if $ENV{DEBUG} && $ENV{DEBUG} >= 2;
}

# Converting
my ($step_sample) = $step * 128;
for (my $epoch = $start; $epoch <= $stop; $epoch += $step_sample) {
Expand Down Expand Up @@ -135,15 +135,15 @@ for (my $epoch = $start; $epoch <= $stop; $epoch += $step_sample) {
for ( my $ds_idx = 0; $ds_idx < scalar @$line; $ds_idx ++) {
my $name = $names->[$ds_idx];
my $value = $line->[$ds_idx];
$current_data{$name} = $value;
$current_data{$name} = $value;
}

# Create the template
my @values = map { defined $current_data{$_} ? $current_data{$_} : "U" } @ds_names;

# Ignore lines with all values set to "U"
next unless grep { $_ ne "U" } @values;

my $current_epoch = $fetched_epoch;
while ( $current_epoch < $fetched_epoch + $fetched_step ) {
push @rrd_updates, "$current_epoch:" . join(':', @values);
Expand Down
12 changes: 6 additions & 6 deletions contrib/rtbtrace.pl
Expand Up @@ -10,7 +10,7 @@

use strict;
use warnings;

use Curses;
use Time::HiRes qw(sleep);

Expand All @@ -30,7 +30,7 @@
my $last_tstp = 0;
my $tstp_step = 1 / 25; # 25 Hz

# use non-blocking IO on stdin.
# use non-blocking IO on stdin.
# Otherwise when there is no activity, the drawing is stalled
use IO::Handle;
STDIN->blocking(0);
Expand Down Expand Up @@ -65,19 +65,19 @@
} continue {
}

sub draw
sub draw
{
my $io_ops = shift;

use Term::Size;

my ($columns, $rows) = Term::Size::chars *STDOUT{IO};
$rows --; # last row is status row

my $nb_chars = $columns * $rows;
my $blocks_per_char = int ($nb_blocks_1k * 2 / $nb_chars) + 1;
# Each frame we redraw everything

# Each frame we redraw everything
$win->clear();

# Update the status line
Expand Down
2 changes: 1 addition & 1 deletion doc/architecture/munin-c.rst
Expand Up @@ -56,6 +56,6 @@ What plugins are included?
Install
=======

After compiling there will be a binary named ``munin-plugins-c``. You can just replace the symlinks in ``/etc/munin/plugins/`` with symlinks to this binary.
After compiling there will be a binary named ``munin-plugins-c``. You can just replace the symlinks in ``/etc/munin/plugins/`` with symlinks to this binary.

Note that the C version of the plugins do not need the C version of the node. It is just recommended as it gives you the full benefits at no added cost.
2 changes: 1 addition & 1 deletion doc/develop/plugins/plugin-concise.rst
Expand Up @@ -207,7 +207,7 @@ To run a plugin with an additional group:
[example]
group somegroup


Environment variables
---------------------

Expand Down
2 changes: 1 addition & 1 deletion doc/develop/plugins/plugin-gallery.rst
Expand Up @@ -68,7 +68,7 @@ To make sure that we can auto-generate the portrait pages for each plugin please
Current state of the project
============================

We have `scripts to auto-generate the HTML presentation called "Munin Plugin Gallery" <https://github.com/munin-monitoring/munin/tree/master/contrib/plugin-gallery>`_ per daily cronjob.
We have `scripts to auto-generate the HTML presentation called "Munin Plugin Gallery" <https://github.com/munin-monitoring/munin/tree/master/contrib/plugin-gallery>`_ per daily cronjob.

ToDo
----
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/plugin.rst
Expand Up @@ -46,7 +46,7 @@ Global attributes
:Attribute: **graph_category**
:Value: string (Allowed characters: [a-z0-9-.])
:Type: optional
:Description:
:Description:
| Name of the category used to sort the graphs on the generated index web page.
| Lower case string as we like a consistent view and want to avoid duplicates.
| No whitespace as this makes the build of Munin Gallery a lot easier.
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/nagios.rst
Expand Up @@ -48,7 +48,7 @@ The ``nagios.cmd`` is a named pipe on which Nagios accepts external input.
Configuring NSCA, server side
-----------------------------

NSCA is run through some kind of (x)inetd.
NSCA is run through some kind of (x)inetd.

Using inetd
++++++++++++
Expand Down