pivotal-sg/spotlight

View on GitHub

Showing 4 of 8 total issues

Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render: function() {
    return (
      <div className={'inner-ci-widget ' + this.props.status}>
        <div className="content">
          <p className="project-name">{this.props.title}</p>
Severity: Minor
Found in app/assets/javascripts/components/ci_widget.jsx - About 1 hr to fix

    Method get_room_availability has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_room_availability room_email
        upcoming_events = list_events(room_email) || []
    
        if upcoming_events.length == 0
          available = true
    Severity: Minor
    Found in app/services/google_calendar_service.rb - About 1 hr 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 repo_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def repo_info(repository=@project_name, path='', options={})
        params = options[:params] ? '?' + options[:params] : ''
        response = connection.get do |req|
          req.url '/job/' + URI.escape(repository) + path + '/api/json' + params
          req.headers['Accept'] = 'application/json'
    Severity: Minor
    Found in app/services/jenkins_ci_service.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(build={})
          if build['building']
            @state = Category::CiWidget::STATUS_BUILDING
          else
            @state = self.class.normalized_state_for(build['result'])
    Severity: Minor
    Found in app/models/ci/jenkins_ci_build.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