repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/base_detector.rb | lib/reek/smell_detectors/base_detector.rb | # frozen_string_literal: true
require 'set'
require_relative '../smell_warning'
require_relative '../smell_configuration'
module Reek
module SmellDetectors
#
# Shared responsibilities of all smell detectors.
#
# See
# - {file:docs/Basic-Smell-Options.md}
# - {file:docs/Code-Smells.md}
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/too_many_methods.rb | lib/reek/smell_detectors/too_many_methods.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Large Class is a class or module that has a large number of
# instance variables, methods or lines of code.
#
# +TooManyMethods+ reports classes having more than a configurable number
# of ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/uncommunicative_parameter_name.rb | lib/reek/smell_detectors/uncommunicative_parameter_name.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# An Uncommunicative Name is a name that doesn't communicate its intent
# well enough.
#
# Poor names make it hard for the reader to build a mental picture
# of what's going on in the code. The... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/module_initialize.rb | lib/reek/smell_detectors/module_initialize.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# a module is usually a mixin, so when initialize method is present it is
# hard to tell initialization order and parameters so having 'initialize'
# in a module is usually a bad idea
#
# See {... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/too_many_constants.rb | lib/reek/smell_detectors/too_many_constants.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Large Class is a class or module that has a large number of
# instance variables, methods, constants or lines of code.
#
# +TooManyConstants' reports classes having more than a
# configurab... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/unused_private_method.rb | lib/reek/smell_detectors/unused_private_method.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Classes should use their private methods. Otherwise this is dead
# code which is confusing and bad for maintenance.
#
# See {file:docs/Unused-Private-Method.md} for details.
#
class Unuse... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/data_clump.rb | lib/reek/smell_detectors/data_clump.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Data Clump occurs when the same two or three items frequently
# appear together in classes and parameter lists, or when a group
# of instance variable names start or end with similar substrings.
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/unused_parameters.rb | lib/reek/smell_detectors/unused_parameters.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Methods should use their parameters.
#
# See {file:docs/Unused-Parameters.md} for details.
class UnusedParameters < BaseDetector
#
# Checks whether the given method has any unused par... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/too_many_statements.rb | lib/reek/smell_detectors/too_many_statements.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Long Method is any method that has a large number of lines.
#
# +TooManyStatements+ reports any method with more than 5 statements.
#
# See {file:docs/Too-Many-Statements.md} for details.
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/uncommunicative_method_name.rb | lib/reek/smell_detectors/uncommunicative_method_name.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# An Uncommunicative Name is a name that doesn't communicate its intent
# well enough.
#
# Poor names make it hard for the reader to build a mental picture
# of what's going on in the code. The... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/attribute.rb | lib/reek/smell_detectors/attribute.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A class that publishes a getter or setter for an instance variable
# invites client classes to become too intimate with its inner workings,
# and in particular with its representation of state.
#... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/repeated_conditional.rb | lib/reek/smell_detectors/repeated_conditional.rb | # frozen_string_literal: true
require_relative '../ast/node'
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Simulated Polymorphism occurs when
# * code uses a case statement (especially on a type field);
# * or code has several if statements in a row
# (especially if th... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/utility_function.rb | lib/reek/smell_detectors/utility_function.rb | # frozen_string_literal: true
require_relative '../ast/reference_collector'
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Utility Function is any instance method that has no
# dependency on the state of the instance.
#
# Currently +UtilityFunction+ will warn about any ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/duplicate_method_call.rb | lib/reek/smell_detectors/duplicate_method_call.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Duplication occurs when two fragments of code look nearly identical,
# or when two fragments of code have nearly identical effects
# at some conceptual level.
#
# +DuplicateMethodCall+ checks... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/subclassed_from_core_class.rb | lib/reek/smell_detectors/subclassed_from_core_class.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Subclassing core classes in Ruby can lead to unexpected side effects.
# Knowing that Ruby has a core library, which is written in C, and a standard
# library, which is written in Ruby, if you do not ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/uncommunicative_module_name.rb | lib/reek/smell_detectors/uncommunicative_module_name.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# An Uncommunicative Name is a name that doesn't communicate its intent
# well enough.
#
# Poor names make it hard for the reader to build a mental picture
# of what's going on in the code. The... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/nested_iterators.rb | lib/reek/smell_detectors/nested_iterators.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Nested Iterator occurs when a block contains another block.
#
# +NestedIterators+ reports failing methods only once.
#
# See {file:docs/Nested-Iterators.md} for details.
class NestedIte... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/too_many_instance_variables.rb | lib/reek/smell_detectors/too_many_instance_variables.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Large Class is a class or module that has a large number of
# instance variables, methods or lines of code.
#
# +TooManyInstanceVariables' reports classes having more than a
# configurable ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/irresponsible_module.rb | lib/reek/smell_detectors/irresponsible_module.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# It is considered good practice to annotate every class and module
# with a brief comment outlining its responsibilities.
#
# See {file:docs/Irresponsible-Module.md} for details.
class Irrespo... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/missing_safe_method.rb | lib/reek/smell_detectors/missing_safe_method.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
# Excerpt from:
# http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist
# since this sums it up really well:
#
# The ! in method names that end with ! means, "This method is dange... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/feature_envy.rb | lib/reek/smell_detectors/feature_envy.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Feature Envy occurs when a code fragment references another object
# more often than it references itself, or when several clients do
# the same series of manipulations on a particular type of object... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/nil_check.rb | lib/reek/smell_detectors/nil_check.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
# Checking for nil is a special kind of type check, and therefore a case of
# SimulatedPolymorphism.
#
# See {file:docs/Nil-Check.md} for details.
class NilCheck < BaseDetector
def sniff
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/uncommunicative_variable_name.rb | lib/reek/smell_detectors/uncommunicative_variable_name.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# An Uncommunicative Name is a name that doesn't communicate its intent
# well enough.
#
# Poor names make it hard for the reader to build a mental picture
# of what's going on in the code. The... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/long_yield_list.rb | lib/reek/smell_detectors/long_yield_list.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A variant on LongParameterList that checks the number of items
# passed to a block by a +yield+ call.
#
# See {file:docs/Long-Yield-List.md} for details.
class LongYieldList < BaseDetector
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/control_parameter.rb | lib/reek/smell_detectors/control_parameter.rb | # frozen_string_literal: true
require_relative 'base_detector'
require_relative 'control_parameter_helpers/candidate'
require_relative 'control_parameter_helpers/control_parameter_finder'
module Reek
module SmellDetectors
#
# Control Coupling occurs when a method or block checks the value of
# a paramet... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/boolean_parameter.rb | lib/reek/smell_detectors/boolean_parameter.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Boolean parameter effectively permits a method's caller
# to decide which execution path to take. The
# offending parameter is a kind of Control Couple.
#
# Currently Reek can only detect a... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/class_variable.rb | lib/reek/smell_detectors/class_variable.rb | # frozen_string_literal: true
require 'set'
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# Class variables form part of the global runtime state, and as such make
# it easy for one part of the system to accidentally or inadvertently
# depend on another part of the system. So ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/long_parameter_list.rb | lib/reek/smell_detectors/long_parameter_list.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Long Parameter List occurs when a method has more than one
# or two parameters, or when a method yields more than one or
# two objects to an associated block.
#
# Currently +LongParameterLi... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/manual_dispatch.rb | lib/reek/smell_detectors/manual_dispatch.rb | # frozen_string_literal: true
require_relative 'base_detector'
module Reek
module SmellDetectors
#
# A Manual Dispatch occurs when a method is only called after a
# manual check that the method receiver is of the correct type.
#
# The +ManualDispatch+ checker reports any invocation of +respond_t... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb | lib/reek/smell_detectors/control_parameter_helpers/candidate.rb | # frozen_string_literal: true
module Reek
module SmellDetectors
module ControlParameterHelpers
#
# Collects information about a single control parameter.
#
class Candidate
#
# @param parameter [Symbol] the parameter name
# @param occurrences [Array<Reek::AST::Node>... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/control_parameter_helpers/control_parameter_finder.rb | lib/reek/smell_detectors/control_parameter_helpers/control_parameter_finder.rb | # frozen_string_literal: true
require_relative 'call_in_condition_finder'
require_relative '../../ast/node'
module Reek
module SmellDetectors
module ControlParameterHelpers
# Finds cases of ControlParameter in a particular node for a particular parameter
class ControlParameterFinder
CONDITIO... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb | lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb | # frozen_string_literal: true
module Reek
module SmellDetectors
module ControlParameterHelpers
#
# CallInConditionFinder finds usages of the given parameter
# in the context of a method call in a condition, e.g.:
#
# def alfa(bravo)
# if charlie(bravo)
# delta
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/application.rb | lib/reek/cli/application.rb | # frozen_string_literal: true
require_relative 'options'
require_relative 'status'
require_relative '../configuration/app_configuration'
require_relative '../configuration/configuration_file_finder'
require_relative '../source/source_locator'
require_relative 'command/report_command'
require_relative 'command/todo_lis... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/options.rb | lib/reek/cli/options.rb | # frozen_string_literal: true
require 'optparse'
require 'rainbow'
require_relative '../version'
require_relative 'status'
require_relative '../detector_repository'
require_relative '../documentation_link'
module Reek
module CLI
#
# Parses the command line
#
# See {file:docs/Command-Line-Options.md}... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/silencer.rb | lib/reek/cli/silencer.rb | # frozen_string_literal: true
require 'stringio'
module Reek
module CLI
# CLI silencer
module Silencer
module_function
# @quality :reek:TooManyStatements { max_statements: 9 }
def silently
old_verbose = $VERBOSE
old_stderr = $stderr
old_stdout = $stdout
$V... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/status.rb | lib/reek/cli/status.rb | # frozen_string_literal: true
module Reek
module CLI
module Status
DEFAULT_SUCCESS_EXIT_CODE = 0
DEFAULT_ERROR_EXIT_CODE = 1
DEFAULT_FAILURE_EXIT_CODE = 2
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/command/todo_list_command.rb | lib/reek/cli/command/todo_list_command.rb | # frozen_string_literal: true
require_relative 'base_command'
require_relative '../../examiner'
require_relative '../../configuration/app_configuration'
module Reek
module CLI
module Command
#
# A command to collect smells from a set of sources and writes a configuration
# file that can serve ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/command/base_command.rb | lib/reek/cli/command/base_command.rb | # frozen_string_literal: true
module Reek
module CLI
module Command
#
# Base class for all commands
#
class BaseCommand
def initialize(options:, sources:, configuration:)
@options = options
@sources = sources
@configuration = configuration
end... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/cli/command/report_command.rb | lib/reek/cli/command/report_command.rb | # frozen_string_literal: true
require_relative 'base_command'
require_relative '../../examiner'
require_relative '../../logging_error_handler'
require_relative '../../report'
module Reek
module CLI
module Command
#
# A command to collect smells from a set of sources and write them out in
# tex... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/node.rb | lib/reek/ast/node.rb | # frozen_string_literal: true
require_relative '../cli/silencer'
Reek::CLI::Silencer.without_warnings { require 'parser' }
module Reek
module AST
# Base class for AST nodes extended with utility methods. Contains some
# methods to ease the transition from Sexp to AST::Node.
#
class Node < ::Parser::... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions.rb | lib/reek/ast/sexp_extensions.rb | # frozen_string_literal: true
require_relative 'reference_collector'
require_relative 'sexp_extensions/arguments'
require_relative 'sexp_extensions/begin'
require_relative 'sexp_extensions/block'
require_relative 'sexp_extensions/case'
require_relative 'sexp_extensions/constant'
require_relative 'sexp_extensions/if'
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/reference_collector.rb | lib/reek/ast/reference_collector.rb | # frozen_string_literal: true
module Reek
module AST
#
# Locates references to the current object within a portion
# of an abstract syntax tree.
#
class ReferenceCollector
def initialize(ast)
@ast = ast
end
def num_refs_to_self
(explicit_self_calls.to_a + implic... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/builder.rb | lib/reek/ast/builder.rb | # frozen_string_literal: true
module Reek
module AST
#
# An AST Builder for ruby parser.
#
class Builder < ::Parser::Builders::Default
# This is a work around for parsing ruby code that has a string with invalid sequence as UTF-8.
# See. https://github.com/whitequark/parser/issues/283
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/object_refs.rb | lib/reek/ast/object_refs.rb | # frozen_string_literal: true
module Reek
# Represents functionality related to an Abstract Syntax Tree.
module AST
#
# ObjectRefs is used in CodeContexts.
# It manages and counts the references out of a method to other objects and to `self`.
#
# E.g. this code:
# def foo(thing)
# ... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/ast_node_class_map.rb | lib/reek/ast/ast_node_class_map.rb | # frozen_string_literal: true
require_relative 'node'
require_relative 'sexp_extensions'
module Reek
module AST
# Maps AST node types to sublasses of ASTNode extended with the relevant
# utility modules.
#
class ASTNodeClassMap
def initialize
@klass_map = {}
end
def klass_... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/logical_operators.rb | lib/reek/ast/sexp_extensions/logical_operators.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for :and and :or nodes.
module LogicOperatorBase
def condition
children.first
end
def body_nodes(type, ignoring = [])
children[1].each_node type, (... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/methods.rb | lib/reek/ast/sexp_extensions/methods.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for :def and :defs nodes.
module MethodNodeBase
def arguments
parameters.reject(&:block?)
end
def arg_names
arguments.map(&:name)
end
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/begin.rb | lib/reek/ast/sexp_extensions/begin.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :begin nodes.
module BeginNode
# The special type :begin exists primarily to contain more statements.
# Therefore, this method overrides the default implementation to return
# this... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/symbols.rb | lib/reek/ast/sexp_extensions/symbols.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :sym nodes.
module SymNode
def name
children.first
end
def full_name(outer)
"#{outer}##{name}"
end
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/variables.rb | lib/reek/ast/sexp_extensions/variables.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for nodes representing variables.
module VariableBase
def name
children.first
end
end
# Utility methods for :cvar nodes.
module CvarNode
in... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/nested_assignables.rb | lib/reek/ast/sexp_extensions/nested_assignables.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for nodes that can contain argument
# nodes nested through :mlhs nodes.
module NestedAssignables
def components
children.flat_map(&:components)
end
end
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/arguments.rb | lib/reek/ast/sexp_extensions/arguments.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for argument nodes.
module ArgNodeBase
def name
children.first
end
def marked_unused?
plain_name.start_with?('_')
end
def plain_na... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/send.rb | lib/reek/ast/sexp_extensions/send.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :send nodes.
module SendNode
ATTR_DEFN_METHODS = [:attr_writer, :attr_accessor].freeze
def receiver
children.first
end
def name
children[1]
en... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/case.rb | lib/reek/ast/sexp_extensions/case.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :case nodes.
module CaseNode
def condition
children.first
end
def body_nodes(type, ignoring = [])
children[1..].compact.flat_map do |child|
child.e... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/yield.rb | lib/reek/ast/sexp_extensions/yield.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :yield nodes.
module YieldNode
def args
children
end
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/constant.rb | lib/reek/ast/sexp_extensions/constant.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :const nodes.
module ConstNode
# TODO: name -> full_name, simple_name -> name
def name
if namespace
"#{namespace.format_to_ruby}::#{simple_name}"
else
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/self.rb | lib/reek/ast/sexp_extensions/self.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :self nodes.
module SelfNode
def name
:self
end
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/super.rb | lib/reek/ast/sexp_extensions/super.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :super nodes.
module SuperNode
def name
:super
end
end
ZsuperNode = SuperNode
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/module.rb | lib/reek/ast/sexp_extensions/module.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Base module for utility methods for nodes that define constants: module
# definition, class definition and constant assignment.
module ConstantDefiningNodeBase
# The full name of the constant, including the nam... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/if.rb | lib/reek/ast/sexp_extensions/if.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :if nodes.
module IfNode
#
# @return [Reek::AST::Node] the condition that is associated with a conditional node.
# For instance, this code
#
# if charlie(brav... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/when.rb | lib/reek/ast/sexp_extensions/when.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :when nodes.
module WhenNode
def condition_list
children[0..-2]
end
def body
children.last
end
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/lambda.rb | lib/reek/ast/sexp_extensions/lambda.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :lambda nodes.
module LambdaNode
def name
'lambda'
end
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/ast/sexp_extensions/block.rb | lib/reek/ast/sexp_extensions/block.rb | # frozen_string_literal: true
module Reek
module AST
module SexpExtensions
# Utility methods for :block nodes.
module BlockNode
def call
children.first
end
def args
children[1]
end
def block
children[2]
end
def p... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/class_context.rb | lib/reek/context/class_context.rb | # frozen_string_literal: true
require_relative 'module_context'
module Reek
module Context
#
# A context wrapper for any class found in a syntax tree.
#
class ClassContext < ModuleContext
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/code_context.rb | lib/reek/context/code_context.rb | # frozen_string_literal: true
require_relative '../code_comment'
require_relative '../ast/object_refs'
require_relative 'statement_counter'
require 'forwardable'
module Reek
module Context
#
# Superclass for all types of source code context. Each instance represents
# a code element of some kind, and e... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/module_context.rb | lib/reek/context/module_context.rb | # frozen_string_literal: true
require_relative 'code_context'
require_relative 'attribute_context'
require_relative 'method_context'
require_relative 'visibility_tracker'
module Reek
module Context
#
# A context wrapper for any module found in a syntax tree.
#
class ModuleContext < CodeContext
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/root_context.rb | lib/reek/context/root_context.rb | # frozen_string_literal: true
require_relative 'code_context'
require_relative 'method_context'
module Reek
module Context
#
# A context wrapper representing the root of an abstract syntax tree.
#
class RootContext < CodeContext
def type
:root
end
def full_name
''
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/attribute_context.rb | lib/reek/context/attribute_context.rb | # frozen_string_literal: true
require_relative 'code_context'
module Reek
module Context
#
# A context wrapper for attribute definitions found in a syntax tree.
#
# @quality :reek:Attribute
class AttributeContext < CodeContext
attr_accessor :visibility
def initialize(exp, send_expre... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/visibility_tracker.rb | lib/reek/context/visibility_tracker.rb | # frozen_string_literal: true
module Reek
module Context
# Responsible for tracking visibilities in regards to CodeContexts.
class VisibilityTracker
VISIBILITY_MODIFIERS = [:private, :public, :protected, :module_function].freeze
VISIBILITY_MAP = { public_class_method: :public, private_class_metho... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/ghost_context.rb | lib/reek/context/ghost_context.rb | # frozen_string_literal: true
require_relative 'code_context'
require_relative 'singleton_method_context'
module Reek
module Context
# Semi-transparent context to represent a metaclass while building the
# context tree. This context will not be part of the resulting tree, but
# will track context and vi... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/send_context.rb | lib/reek/context/send_context.rb | # frozen_string_literal: true
require_relative 'code_context'
module Reek
module Context
#
# A context wrapper for method calls found in a syntax tree.
#
class SendContext < CodeContext
attr_reader :name
def initialize(exp, name)
@name = name
super(exp)
end
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/method_context.rb | lib/reek/context/method_context.rb | # frozen_string_literal: true
require_relative 'code_context'
module Reek
module Context
#
# A context wrapper for any method definition found in a syntax tree.
#
# @quality :reek:Attribute
class MethodContext < CodeContext
attr_accessor :visibility
attr_reader :refs
def initi... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/singleton_attribute_context.rb | lib/reek/context/singleton_attribute_context.rb | # frozen_string_literal: true
require_relative 'attribute_context'
module Reek
module Context
#
# A context wrapper for any singleton attribute definition found in a
# syntax tree.
#
class SingletonAttributeContext < AttributeContext
def instance_method?
false
end
end
e... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/refinement_context.rb | lib/reek/context/refinement_context.rb | # frozen_string_literal: true
require_relative 'module_context'
module Reek
module Context
#
# A context wrapper for any refinement blocks found in a syntax tree.
#
class RefinementContext < ModuleContext
def full_name
exp.call.args.first.name
end
end
end
end
| ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/singleton_method_context.rb | lib/reek/context/singleton_method_context.rb | # frozen_string_literal: true
require_relative 'method_context'
module Reek
module Context
#
# A context wrapper for any singleton method definition found in a syntax tree.
#
class SingletonMethodContext < MethodContext
def singleton_method?
true
end
def instance_method?
... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
troessner/reek | https://github.com/troessner/reek/blob/cf216cc2a6d709a840d74a7f54ebe5ae1a98699b/lib/reek/context/statement_counter.rb | lib/reek/context/statement_counter.rb | # frozen_string_literal: true
require_relative '../ast/node'
module Reek
module Context
# Responsible for counting the statements in a `CodeContext`.
class StatementCounter
attr_reader :value
def initialize
@value = 0
end
def increase_by(sexp)
self.value = value + s... | ruby | MIT | cf216cc2a6d709a840d74a7f54ebe5ae1a98699b | 2026-01-04T15:47:06.659122Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/helper.rb | spec/helper.rb | require "simplecov"
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter]
SimpleCov.start do
add_filter "/spec/"
add_filter "/vendor/"
minimum_coverage(99.77)
end
require "twitter"
require "rspec"
require "stringio"
require "tempfile"
require "timecop"
require "webmock/rspec"
require_relative "support/... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/support/media_object_examples.rb | spec/support/media_object_examples.rb | shared_examples_for "a Twitter::Media object" do
describe "#==" do
it "returns true when objects IDs are the same" do
media = described_class.new(id: 1)
other = described_class.new(id: 1)
expect(media == other).to be true
end
it "returns false when objects IDs are different" do
me... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/geo_results_spec.rb | spec/twitter/geo_results_spec.rb | require "helper"
describe Twitter::GeoResults do
describe "#each" do
before do
@geo_results = described_class.new(result: {places: [{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]})
end
it "iterates" do
count = 0
@geo_results.each { count += 1 }
expect(count).to eq(6)
e... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/version_spec.rb | spec/twitter/version_spec.rb | require "helper"
describe Twitter::Version do
before do
allow(described_class).to receive_messages(major: 1, minor: 2, patch: 3, pre: nil)
end
describe ".to_h" do
it "returns a hash with the right values" do
expect(described_class.to_h).to be_a Hash
expect(described_class.to_h[:major]).to eq... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/saved_search_spec.rb | spec/twitter/saved_search_spec.rb | require "helper"
describe Twitter::SavedSearch do
describe "#==" do
it "returns true when objects IDs are the same" do
saved_search = described_class.new(id: 1, name: "foo")
other = described_class.new(id: 1, name: "bar")
expect(saved_search == other).to be true
end
it "returns false w... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/place_spec.rb | spec/twitter/place_spec.rb | require "helper"
describe Twitter::Place do
describe ".new" do
it "raises an IndexError when id or woeid is not specified" do
expect { described_class.new(id: 1) }.not_to raise_error
expect { described_class.new(woeid: 1) }.not_to raise_error
expect { described_class.new }.to raise_error(IndexE... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/relationship_spec.rb | spec/twitter/relationship_spec.rb | require "helper"
describe Twitter::Relationship do
describe "#source" do
it "returns a User when source is set" do
relationship = described_class.new(relationship: {source: {id: 7_505_382}})
expect(relationship.source).to be_a Twitter::SourceUser
end
it "returns nil when source is not set" d... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/cursor_spec.rb | spec/twitter/cursor_spec.rb | require "helper"
describe Twitter::Cursor do
describe "#each" do
before do
@client = Twitter::REST::Client.new(consumer_key: "CK", consumer_secret: "CS", access_token: "AT", access_token_secret: "AS")
stub_get("/1.1/followers/ids.json").with(query: {cursor: "-1", screen_name: "sferik"}).to_return(bod... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/size_spec.rb | spec/twitter/size_spec.rb | require "helper"
describe Twitter::Size do
describe "#==" do
it "returns true for empty objects" do
size = described_class.new
other = described_class.new
expect(size == other).to be true
end
it "returns true when objects height and width are the same" do
size = described_class.n... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/client_spec.rb | spec/twitter/client_spec.rb | require "helper"
describe Twitter::Client do
describe "#user_agent" do
it "defaults TwitterRubyGem/version" do
expect(subject.user_agent).to eq("TwitterRubyGem/#{Twitter::Version}")
end
end
describe "#user_agent=" do
it "overwrites the User-Agent string" do
subject.user_agent = "MyTwitte... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/target_user_spec.rb | spec/twitter/target_user_spec.rb | require "helper"
describe Twitter::TargetUser do
describe "#==" do
it "returns true when objects IDs are the same" do
saved_search = described_class.new(id: 1, name: "foo")
other = described_class.new(id: 1, name: "bar")
expect(saved_search == other).to be true
end
it "returns false wh... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/direct_message_spec.rb | spec/twitter/direct_message_spec.rb | require "helper"
describe Twitter::DirectMessage do
describe "#==" do
it "returns true when objects IDs are the same" do
direct_message = described_class.new(id: 1, text: "foo")
other = described_class.new(id: 1, text: "bar")
expect(direct_message == other).to be true
end
it "returns f... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/o_embed_spec.rb | spec/twitter/o_embed_spec.rb | require "helper"
describe Twitter::OEmbed do
describe "#author_uri" do
it "returns a URI when the author_url is set" do
oembed = described_class.new(author_url: "https://twitter.com/sferik")
expect(oembed.author_uri).to be_an Addressable::URI
expect(oembed.author_uri.to_s).to eq("https://twitte... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/profile_banner_spec.rb | spec/twitter/profile_banner_spec.rb | require "helper"
describe Twitter::ProfileBanner do
describe "#sizes" do
it "returns a hash of Sizes when sizes is set" do
sizes = described_class.new(sizes: {small: {h: 226, w: 340, resize: "fit"}, large: {h: 466, w: 700, resize: "fit"}, medium: {h: 399, w: 600, resize: "fit"}, thumb: {h: 150, w: 150, res... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/rate_limit_spec.rb | spec/twitter/rate_limit_spec.rb | require "helper"
describe Twitter::RateLimit do
describe "#limit" do
it "returns an Integer when x-rate-limit-limit header is set" do
rate_limit = described_class.new("x-rate-limit-limit" => "150")
expect(rate_limit.limit).to be_an Integer
expect(rate_limit.limit).to eq(150)
end
it "re... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/utils_spec.rb | spec/twitter/utils_spec.rb | require "benchmark"
require "helper"
describe Twitter::Utils do
describe "#pmap" do
it "returns an array" do
expect(subject.flat_pmap([], &:reverse)).to be_an(Array)
end
it "behaves like map" do
array = (0..9).to_a
block = proc { |x| x + 1 }
expect(subject.pmap(array, &block)).to... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/trend_results_spec.rb | spec/twitter/trend_results_spec.rb | require "helper"
describe Twitter::TrendResults do
describe "#as_of" do
it "returns a Time when as_of is set" do
trend_results = described_class.new(id: 1, as_of: "2012-08-24T23:25:43Z")
expect(trend_results.as_of).to be_a Time
expect(trend_results.as_of).to be_utc
end
it "returns nil ... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/suggestion_spec.rb | spec/twitter/suggestion_spec.rb | require "helper"
describe Twitter::Suggestion do
describe "#==" do
it "returns true for empty objects" do
suggestion = described_class.new
other = described_class.new
expect(suggestion == other).to be true
end
it "returns true when objects slugs are the same" do
suggestion = desc... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/geo_spec.rb | spec/twitter/geo_spec.rb | require "helper"
describe Twitter::Geo do
before do
@geo = described_class.new(coordinates: [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
end
describe "#==" do
it "returns true for empty objects" do
geo = described_class.new... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/media_factory_spec.rb | spec/twitter/media_factory_spec.rb | require "helper"
describe Twitter::MediaFactory do
describe ".new" do
it "generates a photo" do
media = described_class.new(id: 1, type: "photo")
expect(media).to be_a Twitter::Media::Photo
end
it "generates an animated GIF" do
media = described_class.new(id: 1, type: "animated_gif")
... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/settings_spec.rb | spec/twitter/settings_spec.rb | require "helper"
describe Twitter::Settings do
describe "#trend_location" do
it "returns a Twitter::Place when trend_location is set" do
settings = described_class.new(trend_location: {countryCode: "US", name: "San Francisco", country: "United States", placeType: {name: "Town", code: 7}, woeid: 2_487_956, ... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/identity_spec.rb | spec/twitter/identity_spec.rb | require "helper"
describe Twitter::Identity do
describe "#initialize" do
it "raises an IndexError when id is not specified" do
expect { described_class.new }.to raise_error(IndexError)
end
end
describe "#==" do
it "returns true when objects IDs are the same" do
one = described_class.new(... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/headers_spec.rb | spec/twitter/headers_spec.rb | require "helper"
describe Twitter::Headers do
before do
@client = Twitter::REST::Client.new(consumer_key: "CK", consumer_secret: "CS", access_token: "AT", access_token_secret: "AS")
@headers = described_class.new(@client, :get, "#{Twitter::REST::Request::BASE_URL}/path")
end
describe "#oauth_auth_header... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
sferik/twitter-ruby | https://github.com/sferik/twitter-ruby/blob/0570c4f442ce2e4ffae70a2e3536dd690ad120f9/spec/twitter/premium_search_results_spec.rb | spec/twitter/premium_search_results_spec.rb | require "helper"
describe Twitter::PremiumSearchResults do
describe "#each" do
before do
@client = Twitter::REST::Client.new(consumer_key: "CK", consumer_secret: "CS", access_token: "AT", access_token_secret: "AS", dev_environment: "DE")
end
it "requests the correct resources" do
stub_post("... | ruby | MIT | 0570c4f442ce2e4ffae70a2e3536dd690ad120f9 | 2026-01-04T15:46:08.737251Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.