cwadding/foscam-ruby

View on GitHub

Showing 29 of 35 total issues

Method save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def save
                run_callbacks :save do
                    flag = false
                    if changed? && is_valid?
                        @previously_changed = changes
Severity: Minor
Found in lib/foscam/activemodel/network.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def self.all
                cam_params = client.get_params
                users = []
                unless cam_params.empty?
                    (1..8).each do |i|
Severity: Minor
Found in lib/foscam/activemodel/user.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def initialize(args = {})
                @ntp_svr = args[:ntp_svr] if args.has_key?(:ntp_svr) && !args[:ntp_svr].nil?
                @time = Time.find_zone(-args[:tz].to_i).at(args[:now].to_i) if args.has_key?(:now) && !args[:now].nil?
                [:daylight_saving_time, :ntp_enable].each do |field|
                    self.instance_variable_set("@#{field}".to_sym, args[field].to_i > 0) if args.has_key?(field) && !args[field].nil?
Severity: Minor
Found in lib/foscam/model/clock.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def save
                run_callbacks :save do
                    flag = false
                    if changed? && is_valid?
                        @previously_changed = changes
Severity: Minor
Found in lib/foscam/activemodel/ftp_server.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def save
                run_callbacks :save do
                    flag = false
                    if changed? && is_valid? && set_id
                        @previously_changed = changes
Severity: Minor
Found in lib/foscam/activemodel/user.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def save
                run_callbacks :save do
                    flag = false
                    if changed? && is_valid?
                        @previously_changed = changes
Severity: Minor
Found in lib/foscam/activemodel/mail_server.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def save
                run_callbacks :save do
                    flag = false
                    if changed? && is_valid?
                        @previously_changed = changes
Severity: Minor
Found in lib/foscam/activemodel/alarm_config.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def initialize(args = {})
                [:ssid, :defkey, :key1, :key2, :key3, :key4, :wpa_psk].each do |field|
                    self.instance_variable_set("@#{field}".to_sym, args[field])
                end
                @authtype = AUTH_TYPE[args[:authtype].to_i] if args.has_key?(:authtype) && !args[:authtype].nil?
Severity: Minor
Found in lib/foscam/model/wifi_config.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method dirty_params_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def dirty_params_hash
                h = {}
                h.merge!({:dir => self.dir}) if dir_changed?
                h.merge!({:user => self.username}) if username_changed?
                h.merge!({:pwd => self.password}) if password_changed?
Severity: Minor
Found in lib/foscam/activemodel/ftp_server.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language