source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/control_parameter.rb
Ruby
mit
4,125
master
3,002
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/too_many_statements.rb
Ruby
mit
4,125
master
1,242
# 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. ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/unused_parameters.rb
Ruby
mit
4,125
master
737
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/uncommunicative_parameter_name.rb
Ruby
mit
4,125
master
2,199
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/attribute.rb
Ruby
mit
4,125
master
1,218
# 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. #...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/subclassed_from_core_class.rb
Ruby
mit
4,125
master
1,439
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/manual_dispatch.rb
Ruby
mit
4,125
master
877
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/duplicate_method_call.rb
Ruby
mit
4,125
master
4,179
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/unused_private_method.rb
Ruby
mit
4,125
master
2,323
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/irresponsible_module.rb
Ruby
mit
4,125
master
867
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/feature_envy.rb
Ruby
mit
4,125
master
2,166
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/too_many_instance_variables.rb
Ruby
mit
4,125
master
1,451
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/nil_check.rb
Ruby
mit
4,125
master
2,114
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/repeated_conditional.rb
Ruby
mit
4,125
master
3,083
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/long_parameter_list.rb
Ruby
mit
4,125
master
1,449
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/uncommunicative_variable_name.rb
Ruby
mit
4,125
master
4,358
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/uncommunicative_method_name.rb
Ruby
mit
4,125
master
1,852
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/uncommunicative_module_name.rb
Ruby
mit
4,125
master
2,398
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/boolean_parameter.rb
Ruby
mit
4,125
master
1,043
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/module_initialize.rb
Ruby
mit
4,125
master
882
# 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 {...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb
Ruby
mit
4,125
master
2,608
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
Ruby
mit
4,125
master
832
# 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>...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/control_parameter_helpers/control_parameter_finder.rb
Ruby
mit
4,125
master
2,847
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/code_climate/code_climate_formatter.rb
Ruby
mit
4,125
master
1,571
# frozen_string_literal: true require 'codeclimate_engine' require_relative 'code_climate_configuration' module Reek module CodeClimate # Generates a hash in the structure specified by the Code Climate engine spec class CodeClimateFormatter def initialize(warning) @warning = warning end ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/code_climate/code_climate_configuration.rb
Ruby
mit
4,125
master
328
# frozen_string_literal: true module Reek module CodeClimate # loads the smell type metadata to present in Code Climate module CodeClimateConfiguration def self.load config_file = File.expand_path('code_climate_configuration.yml', __dir__) YAML.load_file config_file end end ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/code_climate/code_climate_report.rb
Ruby
mit
4,125
master
535
# frozen_string_literal: true require_relative '../report/base_report' require_relative 'code_climate_formatter' module Reek module CodeClimate # # Displays a list of smells in Code Climate engine format # (https://github.com/codeclimate/spec/blob/master/SPEC.md) # JSON with empty array for 0 smells...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/code_climate/code_climate_fingerprint.rb
Ruby
mit
4,125
master
1,141
# frozen_string_literal: true require 'digest' module Reek module CodeClimate # Generates a string to uniquely identify a smell class CodeClimateFingerprint NON_IDENTIFYING_PARAMETERS = [:count, :depth].freeze def initialize(warning) @warning = warning end def compute ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/send_context.rb
Ruby
mit
4,125
master
457
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/visibility_tracker.rb
Ruby
mit
4,125
master
2,079
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/refinement_context.rb
Ruby
mit
4,125
master
306
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/statement_counter.rb
Ruby
mit
4,125
master
485
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/method_context.rb
Ruby
mit
4,125
master
1,996
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/attribute_context.rb
Ruby
mit
4,125
master
737
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/singleton_attribute_context.rb
Ruby
mit
4,125
master
327
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/root_context.rb
Ruby
mit
4,125
master
593
# 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 '' ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/code_context.rb
Ruby
mit
4,125
master
5,456
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/singleton_method_context.rb
Ruby
mit
4,125
master
673
# 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? ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/ghost_context.rb
Ruby
mit
4,125
master
1,549
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/module_context.rb
Ruby
mit
4,125
master
3,426
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context/class_context.rb
Ruby
mit
4,125
master
226
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
Ruby
mit
4,125
master
1,388
# frozen_string_literal: true require_relative 'base_error' require_relative '../documentation_link' module Reek module Errors # Gets raised when trying to use a configuration for a detector # that can't be parsed into a hash. class GarbageDetectorConfigurationInCommentError < BaseError BAD_DETECT...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/bad_detector_in_comment_error.rb
Ruby
mit
4,125
master
1,463
# frozen_string_literal: true require_relative 'base_error' require_relative '../documentation_link' module Reek module Errors # Gets raised when trying to configure a detector which is unknown to us. # This might happen for multiple reasons. The users might have a typo in # his comment or he might use ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/syntax_error.rb
Ruby
mit
4,125
master
1,120
# frozen_string_literal: true require_relative 'base_error' module Reek module Errors # Gets raised when Reek is unable to process the source due to a SyntaxError class SyntaxError < BaseError TEMPLATE = "Source '%<source>s' cannot be processed by Reek due to a syntax error in the source file." ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/base_error.rb
Ruby
mit
4,125
master
208
# frozen_string_literal: true module Reek module Errors # Base class for all runtime Reek errors class BaseError < ::RuntimeError def long_message message end end end end
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/encoding_error.rb
Ruby
mit
4,125
master
1,117
# frozen_string_literal: true require_relative 'base_error' module Reek module Errors # Gets raised when Reek is unable to process the source due to an EncodingError class EncodingError < BaseError TEMPLATE = "Source '%<source>s' cannot be processed by Reek due to an encoding error in the source file....
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/incomprehensible_source_error.rb
Ruby
mit
4,125
master
1,120
# frozen_string_literal: true require_relative 'base_error' module Reek module Errors # Gets raised when Reek is unable to process the source class IncomprehensibleSourceError < BaseError TEMPLATE = 'Source %<source>s cannot be processed by Reek.' LONG_TEMPLATE = <<-MESSAGE !!! ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/legacy_comment_separator_error.rb
Ruby
mit
4,125
master
1,053
# frozen_string_literal: true require_relative 'base_error' module Reek module Errors # Gets raised for old-style comment configuration format. class LegacyCommentSeparatorError < BaseError MESSAGE = <<-MESSAGE.freeze Error: You are using the legacy configuration format (including three ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb
Ruby
mit
4,125
master
1,552
# frozen_string_literal: true require_relative 'base_error' require_relative '../documentation_link' module Reek module Errors # Gets raised when trying to configure a detector with an option # which is unknown to it. class BadDetectorConfigurationKeyInCommentError < BaseError UNKNOWN_SMELL_DETECT...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/errors/config_file_error.rb
Ruby
mit
4,125
master
229
# frozen_string_literal: true require_relative 'base_error' module Reek module Errors # Gets raised when Reek is unable to process the source due to bad config file class ConfigFileError < BaseError end end end
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/ast_node_class_map.rb
Ruby
mit
4,125
master
956
# 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_...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/builder.rb
Ruby
mit
4,125
master
396
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions.rb
Ruby
mit
4,125
master
844
# 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' ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/node.rb
Ruby
mit
4,125
master
4,322
# 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::...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/reference_collector.rb
Ruby
mit
4,125
master
606
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/object_refs.rb
Ruby
mit
4,125
master
1,783
# 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) # ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/module.rb
Ruby
mit
4,125
master
5,307
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/logical_operators.rb
Ruby
mit
4,125
master
587
# 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, (...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/methods.rb
Ruby
mit
4,125
master
1,806
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/variables.rb
Ruby
mit
4,125
master
897
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/nested_assignables.rb
Ruby
mit
4,125
master
552
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/send.rb
Ruby
mit
4,125
master
1,573
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/symbols.rb
Ruby
mit
4,125
master
296
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/arguments.rb
Ruby
mit
4,125
master
2,478
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/constant.rb
Ruby
mit
4,125
master
519
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/case.rb
Ruby
mit
4,125
master
470
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/block.rb
Ruby
mit
4,125
master
606
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/begin.rb
Ruby
mit
4,125
master
420
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/when.rb
Ruby
mit
4,125
master
292
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/super.rb
Ruby
mit
4,125
master
251
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/yield.rb
Ruby
mit
4,125
master
223
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/if.rb
Ruby
mit
4,125
master
1,129
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/self.rb
Ruby
mit
4,125
master
218
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/ast/sexp_extensions/lambda.rb
Ruby
mit
4,125
master
225
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/source/source_code.rb
Ruby
mit
4,125
master
4,124
# frozen_string_literal: true require_relative '../cli/silencer' # Silence Parser's warnings about Ruby micro version differences Reek::CLI::Silencer.silently { require 'parser/current' } require_relative '../tree_dresser' require_relative '../ast/node' require_relative '../ast/builder' # Opt in to new way of represe...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/source/source_locator.rb
Ruby
mit
4,125
master
2,531
# frozen_string_literal: true require 'find' require 'pathname' module Reek module Source # # Finds Ruby source files in a filesystem. # class SourceLocator # Initialize with the paths we want to search. # # paths - a list of paths as Strings def initialize(paths, configurati...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/default_directive.rb
Ruby
mit
4,125
master
805
# frozen_string_literal: true require_relative 'configuration_validator' module Reek module Configuration # # Hash extension for the default directive. # module DefaultDirective include ConfigurationValidator # Adds the configuration for detectors as default directive. # # @...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/configuration_validator.rb
Ruby
mit
4,125
master
821
# frozen_string_literal: true require_relative '../errors/config_file_error' module Reek module Configuration # # Configuration validator module. # module ConfigurationValidator private # @quality :reek:UtilityFunction def smell_type?(key) Reek::SmellDetectors.const_define...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/directory_directives.rb
Ruby
mit
4,125
master
3,185
# frozen_string_literal: true require_relative 'configuration_validator' module Reek module Configuration # # Hash extension for directory directives. # module DirectoryDirectives include ConfigurationValidator # Returns the directive for a given source. # # @param source_vi...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/schema_validator.rb
Ruby
mit
4,125
master
970
# frozen_string_literal: true require_relative '../errors/config_file_error' require_relative 'schema' module Reek module Configuration # # Schema validator module. # class SchemaValidator def initialize(configuration) @configuration = configuration config_directories = configu...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/configuration_converter.rb
Ruby
mit
4,125
master
3,956
# frozen_string_literal: true require_relative 'configuration_validator' module Reek module Configuration # Responsible for converting marked strings coming from the outside world # into proper regexes. class ConfigurationConverter REGEXABLE_ATTRIBUTES = %w(accept reject exclude).freeze incl...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/configuration_file_finder.rb
Ruby
mit
4,125
master
2,775
# frozen_string_literal: true require 'pathname' require_relative 'configuration_converter' require_relative 'schema_validator' require_relative '../errors/config_file_error' module Reek module Configuration # # ConfigurationFileFinder is responsible for finding Reek's configuration. # # There are 3...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/excluded_paths.rb
Ruby
mit
4,125
master
475
# frozen_string_literal: true require_relative 'configuration_validator' require_relative '../errors/config_file_error' module Reek module Configuration # # Array extension for excluded paths. # module ExcludedPaths include ConfigurationValidator # @param paths [String] # @return ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/app_configuration.rb
Ruby
mit
4,125
master
2,802
# frozen_string_literal: true require 'pathname' require_relative 'configuration_file_finder' require_relative 'configuration_validator' require_relative 'default_directive' require_relative 'directory_directives' require_relative 'excluded_paths' module Reek module Configuration # # Reek's application conf...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/rake_task_converter.rb
Ruby
mit
4,125
master
966
# frozen_string_literal: true module Reek module Configuration # Responsible for converting configuration values coming from the outside world # to whatever we want to use internally. module RakeTaskConverter class << self REGEXABLE_ATTRIBUTES = %w(accept reject exclude).freeze # C...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/configuration/schema.rb
Ruby
mit
4,125
master
6,619
# frozen_string_literal: true require 'dry/schema' module Reek module Configuration # # Configuration schema constants. # class Schema # Enable the :info extension so we can introspect # your keys and types Dry::Schema.load_extensions(:info) # rubocop:disable Metrics/BlockLe...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/spec/should_reek.rb
Ruby
mit
4,125
master
886
# frozen_string_literal: true require_relative '../examiner' require_relative '../report/simple_warning_formatter' module Reek module Spec # # An rspec matcher that matches when the +actual+ has code smells. # class ShouldReek def initialize(configuration: Configuration::AppConfiguration.defau...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/spec/smell_matcher.rb
Ruby
mit
4,125
master
1,648
# frozen_string_literal: true module Reek module Spec # # Matches a +SmellWarning+ object agains a smell type and hash of attributes. # class SmellMatcher attr_reader :smell_warning COMPARABLE_ATTRIBUTES = [:message, :lines, :context, :source].freeze def initialize(smell_warning) ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/spec/should_reek_only_of.rb
Ruby
mit
4,125
master
1,121
# frozen_string_literal: true require_relative '../examiner' require_relative '../report/simple_warning_formatter' require_relative 'should_reek_of' require_relative 'smell_matcher' module Reek module Spec # # An rspec matcher that matches when the +actual+ has the specified # code smell and no others. ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/spec/should_reek_of.rb
Ruby
mit
4,125
master
3,896
# frozen_string_literal: true require_relative '../examiner' require_relative 'smell_matcher' require_relative '../configuration/app_configuration' module Reek module Spec # # An rspec matcher that matches when the +actual+ has the specified # code smell. # class ShouldReekOf include RSpec...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/rake/task.rb
Ruby
mit
4,125
master
3,676
# frozen_string_literal: true require 'rake' require 'rake/tasklib' require 'pathname' require 'English' module Reek # # Defines a task library for running Reek. # # @public module Rake # A Rake task that runs Reek on a set of source files. # # Example: # # require 'reek/rake/task' ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/status.rb
Ruby
mit
4,125
master
203
# 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
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/options.rb
Ruby
mit
4,125
master
8,651
# 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}...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/silencer.rb
Ruby
mit
4,125
master
693
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/application.rb
Ruby
mit
4,125
master
3,775
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/command/todo_list_command.rb
Ruby
mit
4,125
master
2,043
# 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 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/command/base_command.rb
Ruby
mit
4,125
master
511
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/cli/command/report_command.rb
Ruby
mit
4,125
master
2,160
# 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...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/simple_warning_formatter.rb
Ruby
mit
4,125
master
662
# frozen_string_literal: true module Reek module Report # # Basic formatter that just shows a simple message for each warning, # prepended with the result of the passed-in location formatter. # class SimpleWarningFormatter def initialize(location_formatter: BlankLocationFormatter) @...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/html_report.rb
Ruby
mit
4,125
master
416
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Saves the report as a HTML file # # @public # class HTMLReport < BaseReport require 'erb' # @public def show template_path = Pathname.new("#{__dir__}/html_report/html_report....
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/documentation_link_warning_formatter.rb
Ruby
mit
4,125
master
389
# frozen_string_literal: true require_relative 'simple_warning_formatter' module Reek module Report # # Formatter that adds a link to the docs to the basic message from # SimpleWarningFormatter. # class DocumentationLinkWarningFormatter < SimpleWarningFormatter def format(warning) ...