SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Ruby

Ruby static code analysis

Unique rules to find Bugs, Security Hotspots, and Code Smells in your RUBY code

  • All rules 75
  • Bug17
  • Security Hotspot2
  • Code Smell56
Filtered: 1 rule found
naming
    Impact
      Clean code attribute
        1. Predicate methods should not use redundant "is_" prefix

           Code Smell

        Predicate methods should not use redundant "is_" prefix

        consistency - conventional
        maintainability
        Code Smell
        • convention
        • naming

        This rule raises an issue when a method name starts with "is_" and ends with "?".

        Why is this an issue?

        How can I fix it?

        More Info

        In Ruby, predicate methods (methods that return boolean values) should end with a question mark to indicate their boolean nature. Using both the "is_" prefix and the "?" suffix creates redundancy that violates Ruby naming conventions.

        The question mark suffix already clearly communicates that the method returns a boolean value. Adding "is_" makes the method name unnecessarily verbose and goes against established Ruby idioms. This redundancy can make code less readable and harder to maintain.

        Ruby’s naming conventions emphasize clarity and conciseness. Method names like empty?, valid?, and present? are more idiomatic than is_empty?, is_valid?, and is_present?.

        What is the potential impact?

        Using redundant "is_" prefixes in predicate methods reduces code readability and violates Ruby naming conventions. While this doesn’t cause runtime errors, it makes the codebase less idiomatic and can confuse developers who expect standard Ruby naming patterns.

        This pattern can also make method names unnecessarily long, reducing code clarity and making it harder to follow established Ruby style guides.

          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use