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/report/github_report.rb
Ruby
mit
4,125
master
1,046
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Displays smells as GitHub Workflow commands. # # @public # class GithubReport < BaseReport def show(out = $stdout) out.print(workflow_commands.join) end private def wo...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/location_formatter.rb
Ruby
mit
4,125
master
860
# frozen_string_literal: true module Reek module Report # # Formats the location of a warning as an empty string. # module BlankLocationFormatter module_function def format(_warning) '' end end # # Formats the location of a warning as an array of line numbers. ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/yaml_report.rb
Ruby
mit
4,125
master
353
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Displays a list of smells in YAML format # YAML with empty array for 0 smells # # @public # class YAMLReport < BaseReport def show(out = $stdout) out.print smells.map(&:yaml_hash).to_...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/json_report.rb
Ruby
mit
4,125
master
361
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Displays a list of smells in JSON format # JSON with empty array for 0 smells # # @public # class JSONReport < BaseReport def show(out = $stdout) out.print ::JSON.generate smells.map(...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/base_report.rb
Ruby
mit
4,125
master
1,906
# frozen_string_literal: true require 'json' require 'pathname' require 'rainbow' module Reek # @public module Report # # A report that contains the smells and smell counts following source code analysis. # # @abstract Subclass and override {#show} to create a concrete report class. # # @p...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/xml_report.rb
Ruby
mit
4,125
master
1,576
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Generates a list of smells in XML format # # @public # class XMLReport < BaseReport require 'rexml/document' # @public def show document.write output: $stdout, indent: 2 ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/text_report.rb
Ruby
mit
4,125
master
1,601
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Generates a sorted, text summary of smells in examiners # # @public # class TextReport < BaseReport # @public def initialize(**args) super print progress_formatter.header ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/heading_formatter.rb
Ruby
mit
4,125
master
1,255
# frozen_string_literal: true module Reek module Report # # Base class for heading formatters. # Is responsible for formatting the heading emitted for each examiner # # @abstract Override {#show_header?} to implement a heading formatter. class HeadingFormatterBase # @quality :reek:Utili...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report/progress_formatter.rb
Ruby
mit
4,125
master
1,545
# frozen_string_literal: true module Reek module Report module ProgressFormatter # # Base class for progress formatters. # Is responsible for formatting the progress emitted for each examiner # # @abstract Override {#header, #progress, #footer} to implement a progress formatter. ...
github
troessner/reek
https://github.com/troessner/reek
tasks/configuration.rake
Ruby
mit
4,125
master
721
# frozen_string_literal: true require_relative '../lib/reek' require_relative '../lib/reek/detector_repository' require_relative '../lib/reek/configuration/rake_task_converter' require_relative '../lib/reek/configuration/app_configuration' require 'yaml' namespace :configuration do desc 'Updates the default config...
github
troessner/reek
https://github.com/troessner/reek
tasks/test.rake
Ruby
mit
4,125
master
865
# frozen_string_literal: true require 'cucumber/rake/task' require 'rspec/core/rake_task' namespace 'test' do RSpec::Core::RakeTask.new('spec') do |t| t.pattern = 'spec/reek/**/*_spec.rb' t.ruby_opts = ['-rbundler/setup -rsimplecov -Ilib -w'] end RSpec::Core::RakeTask.new('performance') do |t| t.pa...
github
troessner/reek
https://github.com/troessner/reek
tasks/rubocop.rake
Ruby
mit
4,125
master
245
# frozen_string_literal: true begin require 'rubocop/rake_task' RuboCop::RakeTask.new do |task| task.options << '--display-cop-names' end rescue LoadError task :rubocop do puts 'Install rubocop to run its rake tasks' end end
github
troessner/reek
https://github.com/troessner/reek
spec/spec_helper.rb
Ruby
mit
4,125
master
3,079
# frozen_string_literal: true require 'pathname' require 'timeout' require 'rspec-benchmark' require_relative '../lib/reek' require_relative '../lib/reek/spec' require_relative '../lib/reek/ast/ast_node_class_map' require_relative '../lib/reek/configuration/app_configuration' require_relative '../samples/paths' # Si...
github
troessner/reek
https://github.com/troessner/reek
spec/quality/reek_source_spec.rb
Ruby
mit
4,125
master
271
# frozen_string_literal: true require_relative '../spec_helper' RSpec.describe 'Reek source code' do Pathname.glob('lib/**/*.rb').each do |pathname| describe pathname do it 'has no smells' do expect(pathname).not_to reek end end end end
github
troessner/reek
https://github.com/troessner/reek
spec/reek/detector_repository_spec.rb
Ruby
mit
4,125
master
762
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/smell_detectors/base_detector' require_lib 'reek/detector_repository' RSpec.describe Reek::DetectorRepository do describe '.smell_types' do let(:smell_types) { described_class.smell_types } it 'includes existing smell_types' ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/tree_dresser_spec.rb
Ruby
mit
4,125
master
1,471
# frozen_string_literal: true require_relative '../spec_helper' Reek::CLI::Silencer.without_warnings { require 'parser/ruby25' } require_lib 'reek/tree_dresser' RSpec.describe Reek::TreeDresser do describe '#dress' do let(:dresser) { described_class.new } let(:sexp) do Parser::Ruby25.parse('class Klaz...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/logging_error_handler_spec.rb
Ruby
mit
4,125
master
659
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/logging_error_handler' RSpec.describe Reek::LoggingErrorHandler do describe '#handle' do let(:exception) { RuntimeError.new('some message') } let(:handler) { described_class.new } it "outputs the exception's message to st...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report_spec.rb
Ruby
mit
4,125
master
877
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/report' RSpec.describe Reek::Report do describe '.report_class' do it 'returns the correct class' do expect(described_class.report_class(:text)).to eq described_class::TextReport end end describe '.location_formatte...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_configuration_spec.rb
Ruby
mit
4,125
master
1,964
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/smell_configuration' RSpec.describe Reek::SmellConfiguration do context 'when overriding default configs' do let(:base_config) do { 'accept' => ['_'], 'enabled' => true, 'exclude' => [], 'rej...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/documentation_link_spec.rb
Ruby
mit
4,125
master
1,092
# frozen_string_literal: true require_relative '../spec_helper' RSpec.describe Reek::DocumentationLink do describe '.build' do it 'returns the correct link for a smell type' do expect(described_class.build('FeatureEnvy')). to eq "https://github.com/troessner/reek/blob/v#{Reek::Version::STRING}/doc...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/code_comment_spec.rb
Ruby
mit
4,125
master
6,635
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/code_comment' RSpec.describe Reek::CodeComment do context 'with an empty comment' do let(:comment) { build_code_comment(comment: '') } it 'is not descriptive' do expect(comment).not_to be_descriptive end it 'ha...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context_builder_spec.rb
Ruby
mit
4,125
master
13,033
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/context_builder' RSpec.describe Reek::ContextBuilder do describe '#context_tree' do context 'with some simple example code' do let(:walker) do code = 'class Car; def drive; end; end' described_class.new(synta...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_warning_spec.rb
Ruby
mit
4,125
master
4,242
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/smell_warning' RSpec.describe Reek::SmellWarning do let(:uncommunicative_name_detector) { build(:smell_detector, smell_type: 'UncommunicativeVariableName') } describe 'sort order' do shared_examples_for 'first sorts ahead of se...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/examiner_spec.rb
Ruby
mit
4,125
master
10,042
# frozen_string_literal: true require_relative '../spec_helper' require_lib 'reek/examiner' require_lib 'reek/logging_error_handler' RSpec.shared_examples_for 'no smells found' do it 'is not smelly' do expect(examiner).not_to be_smelly end it 'finds no smells' do expect(examiner.smells.length).to eq(0)...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/too_many_statements_spec.rb
Ruby
mit
4,125
master
2,042
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/too_many_statements' RSpec.describe Reek::SmellDetectors::TooManyStatements do let(:config) do { described_class::MAX_ALLOWED_STATEMENTS_KEY => 2 } end it 'reports the right values' do src = <<-RUBY ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/unused_parameters_spec.rb
Ruby
mit
4,125
master
3,869
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/unused_parameters' RSpec.describe Reek::SmellDetectors::UnusedParameters do it 'reports the right values' do src = <<-RUBY def alfa(bravo) end RUBY expect(src).to reek_of(:UnusedParameters, ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/control_parameter_spec.rb
Ruby
mit
4,125
master
9,205
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/control_parameter' RSpec.describe Reek::SmellDetectors::ControlParameter do it 'reports the right values' do src = <<-RUBY def alfa(bravo) bravo ? true : false end RUBY expect(src).t...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/too_many_instance_variables_spec.rb
Ruby
mit
4,125
master
2,951
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/too_many_instance_variables' RSpec.describe Reek::SmellDetectors::TooManyInstanceVariables do let(:config) do { described_class::MAX_ALLOWED_IVARS_KEY => 2 } end it 'reports the right values' do src = <...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/boolean_parameter_spec.rb
Ruby
mit
4,125
master
3,226
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/boolean_parameter' RSpec.describe Reek::SmellDetectors::BooleanParameter do it 'reports the right values' do src = <<-RUBY def alfa(bravo = true) end RUBY expect(src).to reek_of(:BooleanPara...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/irresponsible_module_spec.rb
Ruby
mit
4,125
master
5,495
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/irresponsible_module' RSpec.describe Reek::SmellDetectors::IrresponsibleModule do it 'reports the right values' do src = <<-RUBY class Alfa end RUBY expect(src).to reek_of(:IrresponsibleModu...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/manual_dispatch_spec.rb
Ruby
mit
4,125
master
1,891
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/too_many_constants' RSpec.describe Reek::SmellDetectors::ManualDispatch do it 'reports the right values' do src = <<-RUBY class Alfa def bravo(charlie) true if charlie.respond_to?(:to_a) ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/repeated_conditional_spec.rb
Ruby
mit
4,125
master
2,177
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/repeated_conditional' RSpec.describe Reek::SmellDetectors::RepeatedConditional do it 'reports the right values' do src = <<-RUBY class Alfa attr_accessor :bravo def charlie puts ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/uncommunicative_method_name_spec.rb
Ruby
mit
4,125
master
2,206
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/uncommunicative_method_name' RSpec.describe Reek::SmellDetectors::UncommunicativeMethodName do it 'reports the right values' do src = <<-RUBY def m; end RUBY expect(src).to reek_of(:Uncommunicativ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/nil_check_spec.rb
Ruby
mit
4,125
master
2,087
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/nil_check' RSpec.describe Reek::SmellDetectors::NilCheck do it 'reports the right values' do src = <<-RUBY def alfa(bravo) bravo.nil? end RUBY expect(src).to reek_of(:NilCheck, ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/utility_function_spec.rb
Ruby
mit
4,125
master
8,217
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/utility_function' RSpec.describe Reek::SmellDetectors::UtilityFunction do it 'reports the right values' do src = <<-RUBY def alfa(bravo) bravo.charlie.delta end RUBY expect(src).to r...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/long_parameter_list_spec.rb
Ruby
mit
4,125
master
1,727
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/long_parameter_list' RSpec.describe Reek::SmellDetectors::LongParameterList do it 'reports the right values' do src = <<-RUBY class Alfa def bravo(charlie, delta, echo, foxtrot) end e...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb
Ruby
mit
4,125
master
5,900
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/uncommunicative_variable_name' RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do it 'reports the right values' do src = <<-RUBY def alfa x = 5 end RUBY expect(src)....
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/module_initialize_spec.rb
Ruby
mit
4,125
master
2,052
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/module_initialize' RSpec.describe Reek::SmellDetectors::ModuleInitialize do it 'reports the right values' do src = <<-RUBY module Alfa def initialize; end end RUBY expect(src).to ree...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/too_many_methods_spec.rb
Ruby
mit
4,125
master
1,297
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/too_many_methods' RSpec.describe Reek::SmellDetectors::TooManyMethods do let(:config) do { described_class::MAX_ALLOWED_METHODS_KEY => 3 } end it 'reports the right values' do src = <<-RUBY class ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/long_yield_list_spec.rb
Ruby
mit
4,125
master
1,338
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/long_yield_list' RSpec.describe Reek::SmellDetectors::LongYieldList do it 'reports the right values' do src = <<-RUBY class Alfa def bravo(charlie, delta, echo, foxtrot) yield charlie, de...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/too_many_constants_spec.rb
Ruby
mit
4,125
master
3,302
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/too_many_constants' RSpec.describe Reek::SmellDetectors::TooManyConstants do let(:config) do { described_class::MAX_ALLOWED_CONSTANTS_KEY => 2 } end it 'reports the right values' do src = <<-RUBY ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/attribute_spec.rb
Ruby
mit
4,125
master
4,148
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/attribute' RSpec.describe Reek::SmellDetectors::Attribute do it 'reports the right values' do src = <<-RUBY class Alfa attr_writer :bravo end RUBY expect(src).to reek_of(:Attribute, ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/nested_iterators_spec.rb
Ruby
mit
4,125
master
8,224
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/nested_iterators' RSpec.describe Reek::SmellDetectors::NestedIterators do it 'reports the right values' do src = <<-RUBY def alfa(bravo) bravo.each do |charlie| charlie.each { |delta| del...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/data_clump_spec.rb
Ruby
mit
4,125
master
4,607
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/data_clump' RSpec.describe Reek::SmellDetectors::DataClump do it 'reports the right values' do src = <<-RUBY class Alfa def bravo (echo, foxtrot); end def charlie(echo, foxtrot); end ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/unused_private_method_spec.rb
Ruby
mit
4,125
master
5,474
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/unused_private_method' RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do it 'reports the right values' do src = <<-RUBY class Alfa private def charlie end end R...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/feature_envy_spec.rb
Ruby
mit
4,125
master
6,893
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/feature_envy' RSpec.describe Reek::SmellDetectors::FeatureEnvy do it 'reports the right values' do src = <<-RUBY class Alfa def bravo(charlie) (charlie.delta - charlie.echo) * foxtrot ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/missing_safe_method_spec.rb
Ruby
mit
4,125
master
1,584
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/missing_safe_method' RSpec.describe Reek::SmellDetectors::MissingSafeMethod do it 'reports the right values' do src = <<-RUBY class Alfa def bravo! end end RUBY expect(src).t...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/subclassed_from_core_class_spec.rb
Ruby
mit
4,125
master
2,198
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/subclassed_from_core_class' RSpec.describe Reek::SmellDetectors::SubclassedFromCoreClass do it 'reports the right values' do src = <<-RUBY class Alfa < Hash end RUBY expect(src).to reek_of(:...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/class_variable_spec.rb
Ruby
mit
4,125
master
2,429
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/class_variable' RSpec.describe Reek::SmellDetectors::ClassVariable do it 'reports the right values' do src = <<-RUBY class Alfa @@bravo = 5 end RUBY expect(src).to reek_of(:ClassVari...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/base_detector_spec.rb
Ruby
mit
4,125
master
1,966
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/base_detector' require_lib 'reek/smell_detectors/duplicate_method_call' RSpec.describe Reek::SmellDetectors::BaseDetector do describe '.todo_configuration_for' do it 'returns exclusion configuration for the give...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb
Ruby
mit
4,125
master
4,819
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/uncommunicative_parameter_name' RSpec.describe Reek::SmellDetectors::UncommunicativeParameterName do it 'reports the right values' do src = <<-RUBY def alfa(x) x end RUBY expect(src)...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/instance_variable_assumption_spec.rb
Ruby
mit
4,125
master
2,579
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/instance_variable_assumption' RSpec.describe Reek::SmellDetectors::InstanceVariableAssumption do it 'reports the right values' do src = <<-RUBY class Alfa def bravo @charlie end ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/duplicate_method_call_spec.rb
Ruby
mit
4,125
master
6,066
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/duplicate_method_call' RSpec.describe Reek::SmellDetectors::DuplicateMethodCall do it 'reports the right values' do src = <<-RUBY class Alfa def bravo(charlie) charlie.delta cha...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/smell_detectors/uncommunicative_module_name_spec.rb
Ruby
mit
4,125
master
2,306
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/smell_detectors/uncommunicative_module_name' RSpec.describe Reek::SmellDetectors::UncommunicativeModuleName do it 'reports the right values' do src = <<-RUBY class K end RUBY expect(src).to reek_of(:Uncommu...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/cli/options_spec.rb
Ruby
mit
4,125
master
1,506
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/cli/options' RSpec.describe Reek::CLI::Options do let(:options) { described_class.new } describe '#initialize' do it 'sets a valid default value for report_format' do expect(options.report_format).to eq :text end ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/cli/silencer_spec.rb
Ruby
mit
4,125
master
907
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/cli/silencer' RSpec.describe Reek::CLI::Silencer do # rubocop:disable RSpec/Output describe '.silently' do it 'blocks output from the block on $stdout' do expect { described_class.silently { puts 'Hi!' } }.not_to output...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/cli/application_spec.rb
Ruby
mit
4,125
master
5,837
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/cli/application' RSpec.describe Reek::CLI::Application do describe '#initialize' do it 'exits with default error code on invalid options' do call = lambda do Reek::CLI::Silencer.silently do described_cla...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/cli/command/todo_list_command_spec.rb
Ruby
mit
4,125
master
2,412
# frozen_string_literal: true require_relative '../../../spec_helper' require_lib 'reek/cli/command/todo_list_command' require_lib 'reek/cli/options' require_lib 'reek/configuration/app_configuration' RSpec.describe Reek::CLI::Command::TodoListCommand do let(:existing_configuration) do <<~YAML --- d...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/cli/command/report_command_spec.rb
Ruby
mit
4,125
master
1,265
# frozen_string_literal: true require_relative '../../../spec_helper' require_lib 'reek/cli/command/report_command' require_lib 'reek/cli/options' RSpec.describe Reek::CLI::Command::ReportCommand do describe '#execute' do let(:options) { Reek::CLI::Options.new [] } let(:configuration) { instance_double Ree...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/ast/object_refs_spec.rb
Ruby
mit
4,125
master
2,136
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/ast/object_refs' RSpec.describe Reek::AST::ObjectRefs do let(:refs) { described_class.new } context 'when empty' do it 'reports no refs to self' do expect(refs.references_to(:self)).to be_empty end end context...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/ast/reference_collector_spec.rb
Ruby
mit
4,125
master
1,437
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/ast/reference_collector' RSpec.describe Reek::AST::ReferenceCollector do describe '#num_refs_to_self' do def refs_to_self(src) syntax_tree = Reek::Source::SourceCode.from(src).syntax_tree described_class.new(syntax_...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/ast/node_spec.rb
Ruby
mit
4,125
master
6,307
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/ast/node' RSpec.describe Reek::AST::Node do describe '#each_node' do context 'with an empty module' do let(:ast) do src = 'module Emptiness; end' Reek::Source::SourceCode.from(src).syntax_tree end ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/ast/sexp_extensions_spec.rb
Ruby
mit
4,125
master
15,869
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/ast/sexp_extensions' RSpec.describe Reek::AST::SexpExtensions::DefNode do context 'with no parameters' do let(:node) { sexp(:def, :hello, sexp(:args)) } it 'has no arg names' do expect(node.arg_names).to eq [] en...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/rake/task_spec.rb
Ruby
mit
4,125
master
1,436
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/rake/task' RSpec.describe Reek::Rake::Task do describe '#source_files' do it 'is set to "lib/**/*.rb" by default' do task = described_class.new expect(task.source_files).to eq FileList['lib/**/*.rb'] end it...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/spec/should_reek_only_of_spec.rb
Ruby
mit
4,125
master
2,604
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/spec' RSpec.describe Reek::Spec::ShouldReekOnlyOf do let(:examiner) { instance_double(Reek::Examiner).as_null_object } let(:expected_context_name) { 'SmellyClass#big_method' } let(:expected_smell_type) { :NestedIterators } le...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/spec/should_reek_spec.rb
Ruby
mit
4,125
master
1,603
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/spec' RSpec.describe Reek::Spec::ShouldReek do describe 'checking code in a string' do let(:matcher) { described_class.new } let(:clean_code) { 'def good() true; end' } let(:smelly_code) { 'def x() y = 4; end' } it...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/spec/should_reek_of_spec.rb
Ruby
mit
4,125
master
6,506
# frozen_string_literal: true require 'pathname' require_relative '../../spec_helper' require_lib 'reek/spec' RSpec.describe Reek::Spec::ShouldReekOf do describe 'smell type selection' do let(:ruby) { 'def double_thing() @other.thing.foo + @other.thing.foo end' } it 'reports duplicate calls by smell type' ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/spec/smell_matcher_spec.rb
Ruby
mit
4,125
master
3,094
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/spec/smell_matcher' RSpec.describe Reek::Spec::SmellMatcher do let(:smell_warning) do build_smell_warning(smell_type: 'UncommunicativeVariableName', message: "has the variable name '@s'", ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/errors/base_error_spec.rb
Ruby
mit
4,125
master
321
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/errors/base_error' RSpec.describe Reek::Errors::BaseError do let(:error) { described_class.new } describe '#long_message' do it 'returns the message' do expect(error.long_message).to eq error.message end end end
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/directory_directives_spec.rb
Ruby
mit
4,125
master
4,672
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/errors/config_file_error' require_lib 'reek/configuration/directory_directives' RSpec.describe Reek::Configuration::DirectoryDirectives do describe '#directive_for' do let(:baz_config) { { Reek::SmellDetectors::IrresponsibleMo...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/app_configuration_spec.rb
Ruby
mit
4,125
master
6,514
# frozen_string_literal: true require 'pathname' require_relative '../../spec_helper' require_lib 'reek/configuration/app_configuration' require_lib 'reek/configuration/directory_directives' require_lib 'reek/configuration/default_directive' require_lib 'reek/configuration/excluded_paths' RSpec.describe Reek::Configu...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/schema_validator_spec.rb
Ruby
mit
4,125
master
5,221
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/configuration/schema_validator' require_lib 'reek/errors/config_file_error' RSpec.describe Reek::Configuration::SchemaValidator do describe 'validate' do subject(:validator) { described_class.new configuration } context 'w...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/excluded_paths_spec.rb
Ruby
mit
4,125
master
833
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/errors/config_file_error' require_lib 'reek/configuration/excluded_paths' RSpec.describe Reek::Configuration::ExcludedPaths do describe '#add' do let(:exclusions) { [].extend(described_class) } let(:paths) do %w(sampl...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/schema_spec.rb
Ruby
mit
4,125
master
5,275
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/configuration/schema' RSpec.shared_examples_for 'all detectors present' do |path| it 'contains a rule for the Attribute detector' do expect(schema.info.dig(*(path + [:Attribute]))).not_to be_nil end it 'contains a rule for...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/default_directive_spec.rb
Ruby
mit
4,125
master
481
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/configuration/default_directive' RSpec.describe Reek::Configuration::DefaultDirective do describe '#add' do let(:directives) { {}.extend(described_class) } it 'adds a smell configuration' do directives.add(Uncommunic...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/configuration_file_finder_spec.rb
Ruby
mit
4,125
master
9,218
# frozen_string_literal: true require 'fileutils' require 'pathname' require 'tmpdir' require_relative '../../spec_helper' require_lib 'reek/configuration/app_configuration' RSpec.describe Reek::Configuration::ConfigurationFileFinder do describe '.find' do let(:regular_configuration_dir) { CONFIGURATION_DIR.joi...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/configuration/rake_task_converter_spec.rb
Ruby
mit
4,125
master
1,247
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/configuration/rake_task_converter' RSpec.describe Reek::Configuration::RakeTaskConverter do describe 'convert' do let(:configuration_for_smell_detector) do { 'exclude' => [/Klass#foobar$/, /^Klass#omg$/], ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/statement_counter_spec.rb
Ruby
mit
4,125
master
668
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/statement_counter' RSpec.describe Reek::Context::StatementCounter do let(:counter) { described_class.new } describe '#increase_by' do it 'does not increase if passed a falsy value' do counter.increase_by(nil) ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/method_context_spec.rb
Ruby
mit
4,125
master
2,186
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/method_context' RSpec.describe Reek::Context::MethodContext do let(:method_context) { described_class.new(exp, nil) } describe '#matches?' do let(:exp) { instance_double(Reek::AST::SexpExtensions::ModuleNode).as_null...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/root_context_spec.rb
Ruby
mit
4,125
master
374
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/root_context' RSpec.describe Reek::Context::RootContext do describe '#full_name' do it 'reports full context' do ast = Reek::Source::SourceCode.from('foo = 1').syntax_tree root = described_class.new(ast) ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/module_context_spec.rb
Ruby
mit
4,125
master
1,893
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/module_context' require_lib 'reek/context/root_context' RSpec.describe Reek::Context::ModuleContext do it 'reports module name for smell in method' do expect(' module Fred def simple(x) x + 1; end en...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/ghost_context_spec.rb
Ruby
mit
4,125
master
1,731
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/code_context' require_lib 'reek/context/ghost_context' RSpec.describe Reek::Context::GhostContext do let(:exp) { instance_double(Reek::AST::Node) } let(:parent) { Reek::Context::CodeContext.new(exp) } describe '#regist...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/context/code_context_spec.rb
Ruby
mit
4,125
master
6,003
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/context/method_context' require_lib 'reek/context/module_context' RSpec.describe Reek::Context::CodeContext do describe '#full_name' do let(:ctx) { described_class.new(exp) } let(:exp) { instance_double(Reek::AS...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/location_formatter_spec.rb
Ruby
mit
4,125
master
991
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/report/location_formatter' RSpec.describe Reek::Report::BlankLocationFormatter do let(:warning) { build_smell_warning(lines: [11, 9, 250, 100]) } describe '.format' do it 'returns a blank String regardless of the warning' do...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/github_report_spec.rb
Ruby
mit
4,125
master
1,071
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/json_report' RSpec.describe Reek::Report::GithubReport do let(:instance) do described_class.new end let(:examiner) do Reek::Examiner.new(source) end context 'with empty source' d...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/xml_report_spec.rb
Ruby
mit
4,125
master
823
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/xml_report' RSpec.describe Reek::Report::XMLReport do let(:xml_report) { described_class.new } context 'with an empty source' do it 'prints empty checkstyle XML' do xml_report.add_exa...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/html_report_spec.rb
Ruby
mit
4,125
master
494
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/html_report' RSpec.describe Reek::Report::HTMLReport do let(:instance) { described_class.new } context 'with an empty source' do let(:examiner) { Reek::Examiner.new('') } before do ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/progress_formatter_spec.rb
Ruby
mit
4,125
master
1,832
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/report/progress_formatter' RSpec.describe Reek::Report::ProgressFormatter::Dots do let(:sources_count) { 23 } let(:formatter) { described_class.new(sources_count) } describe '#header' do it 'announces the number of files t...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/json_report_spec.rb
Ruby
mit
4,125
master
1,790
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/json_report' require 'json' require 'stringio' RSpec.describe Reek::Report::JSONReport do let(:options) { {} } let(:instance) { described_class.new(**options) } let(:examiner) { Reek::Examine...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/yaml_report_spec.rb
Ruby
mit
4,125
master
1,672
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/yaml_report' require 'yaml' require 'stringio' RSpec.describe Reek::Report::YAMLReport do let(:options) { {} } let(:instance) { described_class.new(**options) } let(:examiner) { Reek::Examine...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/report/text_report_spec.rb
Ruby
mit
4,125
master
2,466
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/report/text_report' require_lib 'reek/report/heading_formatter' require_lib 'reek/report/simple_warning_formatter' require 'rainbow' RSpec.describe Reek::Report::TextReport do let(:instance) { described_...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/code_climate/code_climate_configuration_spec.rb
Ruby
mit
4,125
master
809
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/code_climate/code_climate_configuration' RSpec.describe Reek::CodeClimate::CodeClimateConfiguration do let(:yml) { described_class.load } Reek::SmellDetectors::BaseDetector.descendants.each do |detector| describe "for #{dete...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/code_climate/code_climate_fingerprint_spec.rb
Ruby
mit
4,125
master
3,962
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/code_climate/code_climate_fingerprint' RSpec.describe Reek::CodeClimate::CodeClimateFingerprint do describe '#compute' do let(:computed) { described_class.new(warning).compute } context 'when fingerprinting a warning with ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/code_climate/code_climate_report_spec.rb
Ruby
mit
4,125
master
2,055
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/examiner' require_lib 'reek/code_climate' require 'json' require 'stringio' RSpec.describe Reek::CodeClimate::CodeClimateReport do let(:options) { {} } let(:instance) { described_class.new(**options) } let(:examiner) { Reek::E...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/code_climate/code_climate_formatter_spec.rb
Ruby
mit
4,125
master
1,676
# frozen_string_literal: true require_relative '../../spec_helper' require_lib 'reek/code_climate/code_climate_formatter' RSpec.describe Reek::CodeClimate::CodeClimateFormatter do describe '#render' do let(:warning) do Reek::SmellWarning.new( 'UtilityFunction', context: 'context foo', ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/source/source_locator_spec.rb
Ruby
mit
4,125
master
5,531
# frozen_string_literal: true require 'pathname' require_relative '../../spec_helper' require_lib 'reek/configuration/app_configuration' require_lib 'reek/source/source_locator' RSpec.describe Reek::Source::SourceLocator do describe '#sources' do context 'when applied to hidden directories' do let(:path) ...
github
troessner/reek
https://github.com/troessner/reek
spec/reek/source/source_code_spec.rb
Ruby
mit
4,125
master
2,610
# frozen_string_literal: true require_relative '../../spec_helper' require 'stringio' require_lib 'reek/source/source_code' RSpec.describe Reek::Source::SourceCode do describe '#syntax_tree' do it 'associates comments with the AST' do source = "# this is\n# a comment\ndef foo; end" source_code = des...
github
troessner/reek
https://github.com/troessner/reek
spec/performance/reek/smell_detectors/runtime_speed_spec.rb
Ruby
mit
4,125
master
471
# frozen_string_literal: true require_relative '../../../spec_helper' require_lib 'reek/examiner' RSpec.describe 'Runtime speed' do let(:source_directory) { SAMPLES_DIR.join('smelly_source') } it 'runs on our smelly sources in less than 5 seconds' do expect do Dir[source_directory.join('**/*.rb')].each...
github
troessner/reek
https://github.com/troessner/reek
samples/paths.rb
Ruby
mit
4,125
master
253
SAMPLES_DIR = Pathname.new(__dir__).relative_path_from(Pathname.pwd) CONFIGURATION_DIR = SAMPLES_DIR.join('configuration') CLEAN_FILE = SAMPLES_DIR.join('clean_source').join('clean.rb') SMELLY_FILE = SAMPLES_DIR.join('smelly_source').join('smelly.rb')
github
troessner/reek
https://github.com/troessner/reek
samples/smelly_source/ruby.rb
Ruby
mit
4,125
master
11,797
module CodeRay module Scanners # This scanner is really complex, since Ruby _is_ a complex language! # # It tries to highlight 100% of all common code, # and 90% of strange codes. # # It is optimized for HTML highlighting, and is not very useful for # parsing or pretty printing. # # For now, I think ...