hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Avoid too many return statements within this method.
Open

      return true if prefix >= '172.16' and prefix <= '172.31'
Severity: Major
Found in lib/rcs-db/position/resolver.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return @limits['connectors']
    Severity: Major
    Found in lib/rcs-db/license_component.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return :bad_request
      Severity: Major
      Found in lib/rcs-worker/rest.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return true
        Severity: Major
        Found in lib/rcs-db/license.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return nil
          Severity: Major
          Found in lib/rcs-db/db_objects/entity.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return false
            Severity: Major
            Found in lib/rcs-db/position/resolver.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return @limits['correlation']
              Severity: Major
              Found in lib/rcs-db/license_component.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return false
                Severity: Major
                Found in lib/rcs-db/license.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return {}
                  Severity: Major
                  Found in lib/rcs-db/position/resolver.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return nil
                    Severity: Major
                    Found in lib/rcs-db/db_objects/entity.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return @limits['intelligence']
                      Severity: Major
                      Found in lib/rcs-db/license_component.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return e[:data]['name']
                        Severity: Major
                        Found in lib/rcs-db/db_objects/entity.rb - About 30 mins to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              loop do
                                # get the first entry from the queue and mark it as processed to avoid
                                # conflicts with multiple processors
                                if (queued = OCRQueue.get_queued)
                                  entry = queued.first
                          Severity: Minor
                          Found in lib/rcs-ocr/processor.rb and 1 other location - About 25 mins to fix
                          lib/rcs-intelligence/processor.rb on lines 34..46

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              ::Entity.any_in({path: [operation._id]}).each do |ent|
                                trace :debug, "Adding these users to entity #{ent.name}: #{self.users.collect {|u| u.name}.inspect}"
                                ent.users += self.users
                          Severity: Minor
                          Found in lib/rcs-db/db_objects/group.rb and 1 other location - About 25 mins to fix
                          lib/rcs-db/db_objects/group.rb on lines 70..72

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              ::Item.any_in({path: [operation._id]}).each do |item|
                                trace :debug, "Adding these users to item #{item.name}: #{self.users.collect {|u| u.name}.inspect}"
                                item.users += self.users
                          Severity: Minor
                          Found in lib/rcs-db/db_objects/group.rb and 1 other location - About 25 mins to fix
                          lib/rcs-db/db_objects/group.rb on lines 74..76

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              loop do
                                # get the first entry from the queue and mark it as processed to avoid
                                # conflicts with multiple processors
                                if (queued = IntelligenceQueue.get_queued)
                                  entry = queued.first
                          Severity: Minor
                          Found in lib/rcs-intelligence/processor.rb and 1 other location - About 25 mins to fix
                          lib/rcs-ocr/processor.rb on lines 32..44

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 31.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

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

                                def dispatch(scope)
                                  loop do
                                    connector_queue = ConnectorQueue.take(scope)
                                    break unless connector_queue
                                    process(connector_queue)
                          Severity: Minor
                          Found in lib/rcs-connector/dispatcher.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 require_basic_auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def require_basic_auth
                          
                              # check if the headers contains the authentication
                              auth = @request[:headers][:authorization]
                              # no header
                          Severity: Minor
                          Found in lib/rcs-db/rest.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 add_handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def add_handle(entity, addressbook_evidence)
                              data = addressbook_evidence[:data]
                              return unless data['type'] == :target
                          
                              trace :debug, "Parsing handle data: #{data.inspect}"
                          Severity: Minor
                          Found in lib/rcs-intelligence/accounts.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def self.run
                              # infinite processing loop
                              loop do
                                # get the first entry from the queue and mark it as processed to avoid
                                # conflicts with multiple processors
                          Severity: Minor
                          Found in lib/rcs-intelligence/processor.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