OfficeMomsandDads/scheduler

View on GitHub

Showing 7 of 14 total issues

Function exports has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 3 hrs to fix

    Function DashboardReportsDateRangePicker has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DashboardReportsDateRangePicker = () => {
      const [start, setStart] = useState(null)
      const [end, setEnd] = useState(null)
      const [showErrorMessage, setShowErrorMessage] = useState(false)
      const [msg, setMsg] = useState(null)
    Severity: Minor
    Found in app/javascript/components/DashboardReportsDateRangePicker/index.js - About 1 hr to fix

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

        def self.filter_by_office_users(current_user, use_volunteerable_scope)
          if current_user.admin?
            use_volunteerable_scope ? volunteerable : all
          elsif current_user.coordinator? || current_user.social_worker?
            (use_volunteerable_scope ? volunteerable : User).where(
      Severity: Minor
      Found in app/models/user.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

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

        render() {
          return (
            <div>
              {this.state.children.map((child, index) =>
                <div key={index} className="card" style={{ width: '100%', display: child._destroy ? 'none' : 'block' }}>
      Severity: Minor
      Found in app/javascript/components/NeedChildForm/index.jsx - About 1 hr to fix

        Method download_report has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def download_report
            redirect_to :root unless DashboardPolicy.new(current_user).reports?
        
            return redirect_to dashboard_download_report_path unless sensitive_params_are_safe
        
        
        Severity: Minor
        Found in app/controllers/dashboard_controller.rb - About 45 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            @need  = policy_scope(Need).find(params[:need_id])
            @shift = policy_scope(Shift).find(params[:id])
        
            authorize @shift
        Severity: Minor
        Found in app/controllers/shifts_controller.rb - About 35 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

        Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(api) {
          var validEnv = ['development', 'test', 'production']
          var currentEnv = api.env()
          var isDevelopmentEnv = api.env('development')
          var isProductionEnv = api.env('production')
        Severity: Minor
        Found in babel.config.js - 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