Names should be descriptive and consistent with existing patterns in the codebase. This applies to methods, variables, and DSL elements: 1. Follow existing naming patterns for similar concepts:
Names should be descriptive and consistent with existing patterns in the codebase. This applies to methods, variables, and DSL elements:
# Good: Follows pattern of post_install_defined?, resource_defined?
def livecheck_defined?
method(:livecheck).owner != Formula
end
# Bad: Inconsistent with existing pattern
def has_livecheck?
method(:livecheck).owner != Formula
end
# Good: Clear what the variable contains
basename = File.basename(path, ".*")
match_github = url.match(%r{github\.com/(?<user>\S+)/(?<repo>\S+)})
# Bad: Unclear or ambiguous names
m = url.match(%r{github\.com/(?<user>\S+)/(?<repo>\S+)})
filename = File.basename(path, ".*") # When actually storing basename
# Good: Clear boolean nature and what's being checked
def binary_linked_to_library?(binary, library)
# Bad: Unclear if returns boolean
def check_binary_linkage(binary, library)
Enter the URL of a public GitHub repository