Showing 77 of 131 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div id="toast-notice" aria-label={showNotice ? I18n.t('alert_auto_hide') : ''} role="region" aria-live="polite"
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div id="toast-alert" aria-label={showAlert ? I18n.t('alert_auto_hide') : ''} role="alert" className={`${
- Read upRead up
Function useFocusTrap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export const useFocusTrap = ( ref: { current: null | HTMLElement }, isOpen: boolean,) => { useEffect(() => {
- Read upRead up
Function resolveElement
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const resolveElement = () => { if (element) { return ( <div id={elementId}
Function useFocusTrap
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useFocusTrap = ( ref: { current: null | HTMLElement }, isOpen: boolean,) => { useEffect(() => {
Function Toast
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const Toast = ({ alert, notice, appendDashboardClass }: Props): Node => { const [showAlert, setShowAlert] = useState<boolean>( alert !== null && alert !== '' && !document.documentElement?.hasAttribute('data-turbolinks-preview'),
- Read upRead up
Method page_title
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def page_title t('app_name') + if sign_in_path? ' | ' + t('account.sign_in') elsif join_path?
- Read upRead up
Remove explicit presence validation for group_id
. Open
presence: true
- Exclude checks
Use atomic file operation method FileUtils.rm_f
. Open
File.delete(dr.file_path) if File.exist?(dr.file_path)
- Read upRead up
- Exclude checks
Parsing error: 'Const declarations' require an initialization value. (7:18) Open
export const TYPES: string[] = REQUIRES_DEFAULT.concat([
- Read upRead up
- Exclude checks
Return false
instead of nil
in predicate methods. Open
return if omniauth_avatar.nil?
- Read upRead up
- Exclude checks
Remove explicit presence validation for group_id
/user_id
. Open
validates :group_id, :user_id, presence: true
- Exclude checks
Prefer grep
to select
with a regexp match. Open
resource['tags'].select do |tag| @moment_keywords.match?(tag) end
- Read upRead up
- Exclude checks
Prefer string interpolation to string concatenation. Open
' | ' + t('account.sign_up')
- Read upRead up
- Exclude checks
Rails.public_path
is a Pathname
so you can just append #read
. Open
File.read(Rails.public_path.join(webpack_folder, path))
- Exclude checks
Remove explicit presence validation for user_id
. Open
validates :user_id, :name, :description, presence: true
- Exclude checks
Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant. Open
%w[SECRET_KEY_BASE DEVISE_SECRET_KEY].each do |key|
- Exclude checks
Parsing error: Unexpected token, expected "," (5:5) Open
ref: { current: null | HTMLElement },
- Read upRead up
- Exclude checks