fosterful/scheduler

View on GitHub

Showing 14 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

      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

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

        def users_by_hours_volunteered
        list_users = find_users_by_hours.map do |key, value|
        { id: key.fetch(0),
        role: key.fetch(1),
        name: "#{key.fetch(2)} #{key.fetch(3)}",
        Severity: Minor
        Found in app/lib/services/dashboard_queries.rb and 1 other location - About 45 mins to fix
        app/lib/services/dashboard_queries.rb on lines 25..34

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

        def users_by_needs_created
        list_users = find_users_by_needs.map do |key, value|
        { id: key.fetch(0),
        role: key.fetch(1),
        name: "#{key.fetch(2)} #{key.fetch(3)}",
        Severity: Minor
        Found in app/lib/services/dashboard_queries.rb and 1 other location - About 45 mins to fix
        app/lib/services/dashboard_queries.rb on lines 9..18

        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

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

        <input type="number" defaultValue={props.child.age} name={`need[children_attributes][${props.index}][age]`} />
        Severity: Minor
        Found in app/javascript/components/NeedChildForm/index.jsx and 2 other locations - About 35 mins to fix
        app/javascript/components/NeedChildForm/index.jsx on lines 50..50
        app/javascript/components/NeedChildForm/index.jsx on lines 55..55

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

        return <input type="hidden" defaultValue={props.child._destroy} name={`need[children_attributes][${props.index}][_destroy]`} />
        Severity: Minor
        Found in app/javascript/components/NeedChildForm/index.jsx and 2 other locations - About 35 mins to fix
        app/javascript/components/NeedChildForm/index.jsx on lines 18..18
        app/javascript/components/NeedChildForm/index.jsx on lines 50..50

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

        <input type="hidden" defaultValue={props.child.id} name={`need[children_attributes][${props.index}][id]`} />
        Severity: Minor
        Found in app/javascript/components/NeedChildForm/index.jsx and 2 other locations - About 35 mins to fix
        app/javascript/components/NeedChildForm/index.jsx on lines 18..18
        app/javascript/components/NeedChildForm/index.jsx on lines 55..55

        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

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

        toggleNeedsTargets() {
        this.hideableNeedsTargets.forEach((el) => {
        el.hidden = !el.hidden
        });
        }
        Severity: Minor
        Found in app/javascript/controllers/dashboard_query_controller.js and 1 other location - About 35 mins to fix
        app/javascript/controllers/dashboard_query_controller.js on lines 6..10

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

        toggleHoursTargets() {
        this.hideableHoursTargets.forEach((el) => {
        el.hidden = !el.hidden
        });
        }
        Severity: Minor
        Found in app/javascript/controllers/dashboard_query_controller.js and 1 other location - About 35 mins to fix
        app/javascript/controllers/dashboard_query_controller.js on lines 12..16

        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
        Severity
        Category
        Status
        Source
        Language