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')
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)
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(
- Read upRead up
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' }}>
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
- Read upRead up
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
- Read upRead up
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')
- Read upRead up
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"