Function exports
has 89 lines of code (exceeds 25 allowed). Consider refactoring.
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function DashboardReportsDateRangePicker
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
const DashboardReportsDateRangePicker = () => {
const [start, setStart] = useState(null)
const [end, setEnd] = useState(null)
const [showErrorMessage, setShowErrorMessage] = useState(false)
const [msg, setMsg] = useState(null)
Method filter_by_office_users
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
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(
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
render() {
return (
<div>
{this.state.children.map((child, index) =>
<div key={index} className="card" style={{ width: '100%', display: child._destroy ? 'none' : 'block' }}>
Similar blocks of code found in 2 locations. Consider refactoring.
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)}",
Similar blocks of code found in 2 locations. Consider refactoring.
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)}",
Method download_report
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
def download_report
redirect_to :root unless DashboardPolicy.new(current_user).reports?
return redirect_to dashboard_download_report_path unless sensitive_params_are_safe
Similar blocks of code found in 3 locations. Consider refactoring.
<input type="number" defaultValue={props.child.age} name={`need[children_attributes][${props.index}][age]`} />
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.
return <input type="hidden" defaultValue={props.child._destroy} name={`need[children_attributes][${props.index}][_destroy]`} />
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.
<input type="hidden" defaultValue={props.child.id} name={`need[children_attributes][${props.index}][id]`} />
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.
def update
@need = policy_scope(Need).find(params[:need_id])
@shift = policy_scope(Shift).find(params[:id])
authorize @shift
Similar blocks of code found in 2 locations. Consider refactoring.
toggleNeedsTargets() {
this.hideableNeedsTargets.forEach((el) => {
el.hidden = !el.hidden
});
}
app/javascript/controllers/dashboard_query_controller.js on lines 6..10 Similar blocks of code found in 2 locations. Consider refactoring.
toggleHoursTargets() {
this.hideableHoursTargets.forEach((el) => {
el.hidden = !el.hidden
});
}
app/javascript/controllers/dashboard_query_controller.js on lines 12..16 Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')