-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Roman Morandell <46994680+rmorandell-pgum@users.noreply.github.com> Co-authored-by: sfarouq-ext <116093375+sfarouq-ext@users.noreply.github.com>
- Loading branch information
1 parent
62f3860
commit 3953f8d
Showing
36 changed files
with
85,087 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,62 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Test::Spelling; | ||
use List::MoreUtils qw(uniq); | ||
|
||
# the command must have at least one argument | ||
if (!@ARGV) { | ||
die "Usage: perl pod_spell_check.t module.pm stopwords.t"; | ||
} | ||
# the first argument is the module to check | ||
my $module_to_check = $ARGV[0]; | ||
|
||
# the second (optional) argument is the additional dictionary | ||
my $stopword_filename='tests/resources/spellcheck/stopwords.txt'; | ||
if(defined($ARGV[1])){ | ||
$stopword_filename=$ARGV[1]; | ||
} | ||
open(FILE, "<", $stopword_filename) | ||
or die "Could not open $stopword_filename"; | ||
printf("Using dictionary: ".$stopword_filename." \n"); | ||
|
||
add_stopwords(<FILE>); | ||
close(FILE); | ||
set_spell_cmd('hunspell -l'); | ||
all_pod_files_spelling_ok($ARGV[0]); | ||
# get_stopwords(): reads the text file and returns its content as an array or strings | ||
sub get_stopwords { | ||
my ($file) = @_; | ||
|
||
open(FILE, "<", $stopword_filename) | ||
or die "Could not open $stopword_filename"; | ||
printf("Using dictionary: ".$stopword_filename." \n"); | ||
my @stop_words; | ||
for my $line (<FILE>) { | ||
chomp $line; | ||
push @stop_words, $line; | ||
} | ||
close(FILE); | ||
|
||
return @stop_words; | ||
} | ||
|
||
# get_module_options(): reads the Perl module file's POD and returns all the encountered --options | ||
sub get_module_options { | ||
my ($module) = @_; | ||
|
||
my @cmd_result = `perldoc -T $module_to_check`; | ||
my @new_words; | ||
|
||
for my $pod_line (@cmd_result) { | ||
chomp $pod_line; | ||
my @parsed_options = $pod_line =~ /(--[\w-]+){1,}\s?/mg or next; | ||
push @new_words, @parsed_options; | ||
} | ||
|
||
return uniq(sort(@new_words)); | ||
} | ||
|
||
my @known_words = get_stopwords($stopword_filename); | ||
my @module_options = get_module_options($module_to_check); | ||
|
||
# take all words from the text file and the module's options as valid words | ||
add_stopwords(@known_words, @module_options); | ||
|
||
# prepare the spelling check command | ||
set_spell_cmd('hunspell -d en_US -l'); | ||
|
||
# check that all is correct in the Perl module file given as an argument | ||
all_pod_files_spelling_ok($module_to_check); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": [ | ||
"libsnmp-perl" | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
packaging/centreon-plugin-Network-Huawei-Wlc-Snmp/pkg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"pkg_name": "centreon-plugin-Network-Huawei-Wlc-Snmp", | ||
"pkg_summary": "Centreon Plugin for Huawei WLC using SNMP protocol", | ||
"plugin_name": "centreon_huawei_wlc_snmp.pl", | ||
"files": [ | ||
"centreon/common/huawei/standard/snmp/", | ||
"centreon/plugins/script_snmp.pm", | ||
"centreon/plugins/snmp.pm", | ||
"snmp_standard/mode/interfaces.pm", | ||
"snmp_standard/mode/listinterfaces.pm", | ||
"snmp_standard/mode/resources/", | ||
"snmp_standard/mode/uptime.pm", | ||
"network/huawei/wlc/snmp/" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": [ | ||
"perl(SNMP)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.