-
Notifications
You must be signed in to change notification settings - Fork 931
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
Base for Yard docs #3303
base: master
Are you sure you want to change the base?
Base for Yard docs #3303
Conversation
Changed namespaces in a way that will make for a better documentation. Separated errors into class. Made the rake test work.
…s about the dsl in models)
next if line =~ /Output \d Config/i | ||
next if line =~ /(Tachometers|Temperatures|Voltages)/ | ||
next if line =~ /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/ | ||
next if line =~ /[0-9]+\s+(RPMS?|m?V|C)/i |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
cmd 'show system information' do |cfg| | ||
cfg.sub! /^Device Up Time.*\n/, '' | ||
cfg.delete! "\r" | ||
comment(cfg).gsub(/ +$/, '') |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
cfg.each_line.map do |l| | ||
next '' if l =~ /^Building configuration/ | ||
|
||
comment_next = 2 if l =~ /^Switch ID.*Hardware Version.*Firmware Version/ | ||
|
||
if comment_next.positive? | ||
comment_next -= 1 | ||
next comment(l) | ||
end | ||
|
||
l | ||
end.join.gsub(/ +$/, '') |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
cfg.gsub! /^passwd (\S+) (.*)/, 'passwd <secret hidden> \2' | ||
cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3' | ||
cfg.gsub! /(ikev[12] ((remote|local)-authentication )?pre-shared-key) (\S+)/, '\1 <secret hidden>' | ||
cfg.gsub! /^(aaa-server TACACS\+? \(\S+\) host[^\n]*\n(\s+[^\n]+\n)*\skey) \S+$/mi, '\1 <secret hidden>' |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3' | ||
cfg.gsub! /(ikev[12] ((remote|local)-authentication )?pre-shared-key) (\S+)/, '\1 <secret hidden>' | ||
cfg.gsub! /^(aaa-server TACACS\+? \(\S+\) host[^\n]*\n(\s+[^\n]+\n)*\skey) \S+$/mi, '\1 <secret hidden>' | ||
cfg.gsub! /^(aaa-server \S+ \(\S+\) host[^\n]*\n(\s+[^\n]+\n)*\s+key) \S+$/mi, '\1 <secret hidden>' |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
cfg.gsub! /^(\s+standby \d+ authentication) .{1,8}$/, '\\1 <secret hidden>' | ||
cfg.gsub! /^(\s+standby \d+ authentication md5 key-string) .+?( timeout \d+)?$/, '\\1 <secret hidden> \\2' | ||
cfg.gsub! /^(\s+key-string) .+/, '\\1 <secret hidden>' | ||
cfg.gsub! /^((tacacs|radius) server [^\n]+\n(\s+[^\n]+\n)*\s+key) [^\n]+$/m, '\1 <secret hidden>' |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
# @!method prompt(regex) | ||
# Sets the prompt for the device. | ||
# @param regex [Regexp] The regular expression that matches the prompt. | ||
prompt /^\((\w|\S)+\) (>|#)$/ |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
cmd 'show run' do |cfg| | ||
cfg.each_line.select do |line| | ||
(not line.match /^!.*$/) && | ||
(not line.match /^\((\w|\S)+\) (>|#)$/) && |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
next if line =~ /date \d{4}:\d{2}:\d{2}/ | ||
next if line =~ /time \d{2}:\d{2}:\d{2}/ | ||
next if line =~ /system-time "\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2}.\d+"/ | ||
next if line =~ /system-uptime "((\s+up\s+\d+\s+)|(\d+\s\w+(,\s)?)*)"/ |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
This
regular expression
library input
next if line =~ /date \d{4}:\d{2}:\d{2}/ | ||
next if line =~ /time \d{2}:\d{2}:\d{2}/ | ||
next if line =~ /system-time "\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2}.\d+"/ | ||
next if line =~ /system-uptime "((\s+up\s+\d+\s+)|(\d+\s\w+(,\s)?)*)"/ |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
This commit should fix couple of the rubocop errors, my IDE was acting up and instead of keeping the changes i wanted it merged both old and new code. Just to be safe i will review the pull request when i have some free time also i didn't want to change metrics and i won't change cnos model just to be safe that it won't break anything. |
While I greatly appreciate the effort that went into creating documentation for Oxidized (Thank you!), I must say I am quite overwhelmed by this PR. My feeling is that you are doing too much at one time, resulting in a PR that is very difficult to handle:
I suggest breaking the PR down into smaller steps (and PRs):
Submodules for source and output have already been introduced by another PR - no work to do here. I'm not sure I want submodules for models, as they are kind of a DSL and that makes writing models unnecessarily complicated. I'm not even sure I want a yard documentation for models, the yard output doesn't make a lot of sense (Instance Method Summary: #clean, #prompt). The steps above could also be done as commits inside a branch, but I think it is easier to work with PR, as I can check and merge at each step, and changes done somewhere else in master will be included in the next step, reducing conflicts. The steps mentioned above are independent from each other an can be merged independently into master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed more errors
I felt that might be an issue and you are right. I was wondering how i would go about it before starting the work i was thinking should i open an issue or an empty PR asking for the best way to go dealing with this
I think i found two more and fixed them
Yeah i tried to make the tests pass after changing submodules and those were the leftovers of debugging now fixed
There's a lot of scattered comments that don't make sense and would make creating the yard docs harder instead of deleting them i opted to just make all of the comments private so they can be cleaned up later as the documentation gets better.
Also one of the main issues i was thinking about you are right When i'll find some time i will split this PR into separate PRs making it easier to deal with. Should i split the documentation into separate PRs/commits based on "submodules" to make it easier to deal with? |
Hello Eryk, I think that if you go on with fixing the issues of this PR, it will just make more to split it afterwards in smaller PRs, which would be unnecessary work. |
Pre-Request Checklist
rubocop --auto-correct
)rake test
)Description