rubycritic 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -585
  3. data/.rubocop_todo.yml +36 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +1 -1
  6. data/Rakefile +9 -9
  7. data/bin/rubycritic +2 -2
  8. data/features/command_line_interface/options.feature +1 -0
  9. data/features/step_definitions/rubycritic_steps.rb +1 -1
  10. data/features/step_definitions/sample_file_steps.rb +3 -3
  11. data/features/support/env.rb +6 -6
  12. data/lib/rubycritic.rb +1 -1
  13. data/lib/rubycritic/analysers/attributes.rb +6 -7
  14. data/lib/rubycritic/analysers/churn.rb +4 -6
  15. data/lib/rubycritic/analysers/complexity.rb +5 -7
  16. data/lib/rubycritic/analysers/helpers/ast_node.rb +4 -6
  17. data/lib/rubycritic/analysers/helpers/flay.rb +1 -3
  18. data/lib/rubycritic/analysers/helpers/flog.rb +5 -7
  19. data/lib/rubycritic/analysers/helpers/methods_counter.rb +1 -3
  20. data/lib/rubycritic/analysers/helpers/modules_locator.rb +3 -5
  21. data/lib/rubycritic/analysers/helpers/parser.rb +2 -2
  22. data/lib/rubycritic/analysers/helpers/reek.rb +1 -1
  23. data/lib/rubycritic/analysers/smells/flay.rb +14 -16
  24. data/lib/rubycritic/analysers/smells/flog.rb +15 -17
  25. data/lib/rubycritic/analysers/smells/reek.rb +11 -13
  26. data/lib/rubycritic/analysers_runner.rb +8 -10
  27. data/lib/rubycritic/browser.rb +17 -0
  28. data/lib/rubycritic/cli/application.rb +3 -3
  29. data/lib/rubycritic/cli/options.rb +29 -23
  30. data/lib/rubycritic/command_factory.rb +5 -5
  31. data/lib/rubycritic/commands/base.rb +2 -2
  32. data/lib/rubycritic/commands/ci.rb +4 -4
  33. data/lib/rubycritic/commands/default.rb +5 -5
  34. data/lib/rubycritic/commands/help.rb +1 -1
  35. data/lib/rubycritic/commands/status_reporter.rb +1 -1
  36. data/lib/rubycritic/commands/version.rb +2 -2
  37. data/lib/rubycritic/configuration.rb +4 -2
  38. data/lib/rubycritic/core/analysed_module.rb +15 -17
  39. data/lib/rubycritic/core/analysed_modules_collection.rb +3 -3
  40. data/lib/rubycritic/core/location.rb +4 -6
  41. data/lib/rubycritic/core/rating.rb +5 -7
  42. data/lib/rubycritic/core/smell.rb +11 -13
  43. data/lib/rubycritic/generators/console_report.rb +1 -1
  44. data/lib/rubycritic/generators/html/base.rb +9 -9
  45. data/lib/rubycritic/generators/html/code_file.rb +5 -7
  46. data/lib/rubycritic/generators/html/code_index.rb +3 -5
  47. data/lib/rubycritic/generators/html/line.rb +4 -6
  48. data/lib/rubycritic/generators/html/overview.rb +4 -6
  49. data/lib/rubycritic/generators/html/smells_index.rb +3 -5
  50. data/lib/rubycritic/generators/html/turbulence.rb +4 -6
  51. data/lib/rubycritic/generators/html/view_helpers.rb +4 -4
  52. data/lib/rubycritic/generators/html_report.rb +13 -9
  53. data/lib/rubycritic/generators/json/simple.rb +7 -9
  54. data/lib/rubycritic/generators/json_report.rb +1 -3
  55. data/lib/rubycritic/generators/text/list.rb +9 -9
  56. data/lib/rubycritic/reporter.rb +3 -5
  57. data/lib/rubycritic/revision_comparator.rb +6 -8
  58. data/lib/rubycritic/serializer.rb +2 -4
  59. data/lib/rubycritic/smells_status_setter.rb +2 -4
  60. data/lib/rubycritic/source_control_systems/base.rb +4 -6
  61. data/lib/rubycritic/source_control_systems/double.rb +1 -2
  62. data/lib/rubycritic/source_control_systems/git.rb +1 -3
  63. data/lib/rubycritic/source_control_systems/mercurial.rb +1 -3
  64. data/lib/rubycritic/source_locator.rb +5 -6
  65. data/lib/rubycritic/version.rb +1 -1
  66. data/rubycritic.gemspec +26 -25
  67. data/test/analysers_test_helper.rb +1 -1
  68. data/test/lib/rubycritic/analysers/churn_test.rb +9 -9
  69. data/test/lib/rubycritic/analysers/complexity_test.rb +5 -5
  70. data/test/lib/rubycritic/analysers/helpers/methods_counter_test.rb +12 -12
  71. data/test/lib/rubycritic/analysers/helpers/modules_locator_test.rb +25 -25
  72. data/test/lib/rubycritic/analysers/smells/flay_test.rb +12 -12
  73. data/test/lib/rubycritic/analysers/smells/flog_test.rb +7 -7
  74. data/test/lib/rubycritic/analysers/smells/reek_test.rb +8 -8
  75. data/test/lib/rubycritic/browser_test.rb +16 -0
  76. data/test/lib/rubycritic/commands/status_reporter_test.rb +31 -19
  77. data/test/lib/rubycritic/configuration_test.rb +10 -10
  78. data/test/lib/rubycritic/core/analysed_module_test.rb +37 -37
  79. data/test/lib/rubycritic/core/analysed_modules_collection_test.rb +32 -32
  80. data/test/lib/rubycritic/core/location_test.rb +16 -16
  81. data/test/lib/rubycritic/core/smell_test.rb +31 -31
  82. data/test/lib/rubycritic/core/smells_array_test.rb +18 -18
  83. data/test/lib/rubycritic/generators/console_report_test.rb +26 -26
  84. data/test/lib/rubycritic/generators/turbulence_test.rb +8 -8
  85. data/test/lib/rubycritic/generators/view_helpers_test.rb +36 -36
  86. data/test/lib/rubycritic/smells_status_setter_test.rb +7 -7
  87. data/test/lib/rubycritic/source_control_systems/base_test.rb +7 -7
  88. data/test/lib/rubycritic/source_control_systems/double_test.rb +3 -3
  89. data/test/lib/rubycritic/source_control_systems/git_test.rb +4 -4
  90. data/test/lib/rubycritic/source_control_systems/mercurial_test.rb +3 -3
  91. data/test/lib/rubycritic/source_locator_test.rb +30 -30
  92. data/test/lib/rubycritic/version_test.rb +4 -4
  93. data/test/test_helper.rb +4 -4
  94. metadata +30 -17
@@ -1,8 +1,7 @@
1
- require "rubycritic/generators/json/simple"
1
+ require 'rubycritic/generators/json/simple'
2
2
 
3
3
  module Rubycritic
4
4
  module Generator
5
-
6
5
  class JsonReport
7
6
  def initialize(analysed_modules)
8
7
  @analysed_modules = analysed_modules
@@ -18,6 +17,5 @@ module Rubycritic
18
17
  Json::Simple.new(@analysed_modules)
19
18
  end
20
19
  end
21
-
22
20
  end
23
21
  end
@@ -1,24 +1,24 @@
1
- require "colorize"
1
+ require 'colorize'
2
2
 
3
3
  module Rubycritic
4
4
  module Generator
5
5
  module Text
6
6
  class List
7
7
  class << self
8
- TEMPLATE_PATH = File.expand_path("../templates/list.erb", __FILE__)
8
+ TEMPLATE_PATH = File.expand_path('../templates/list.erb', __FILE__)
9
9
 
10
10
  def erb_template
11
- @erb_template ||= ERB.new(File.read(TEMPLATE_PATH), nil, "-")
11
+ @erb_template ||= ERB.new(File.read(TEMPLATE_PATH), nil, '-')
12
12
  end
13
13
  end
14
14
 
15
15
  RATING_TO_COLOR = {
16
- "A" => :green,
17
- "B" => :green,
18
- "C" => :yellow,
19
- "D" => :light_red,
20
- "F" => :red
21
- }
16
+ 'A' => :green,
17
+ 'B' => :green,
18
+ 'C' => :yellow,
19
+ 'D' => :light_red,
20
+ 'F' => :red
21
+ }.freeze
22
22
 
23
23
  def initialize(analysed_module)
24
24
  @analysed_module = analysed_module
@@ -1,5 +1,4 @@
1
1
  module Rubycritic
2
-
3
2
  module Reporter
4
3
  def self.generate_report(analysed_modules)
5
4
  report_generator_class.new(analysed_modules).generate_report
@@ -8,16 +7,15 @@ module Rubycritic
8
7
  def self.report_generator_class
9
8
  case Config.format
10
9
  when :json
11
- require "rubycritic/generators/json_report"
10
+ require 'rubycritic/generators/json_report'
12
11
  Generator::JsonReport
13
12
  when :console
14
- require "rubycritic/generators/console_report"
13
+ require 'rubycritic/generators/console_report'
15
14
  Generator::ConsoleReport
16
15
  else
17
- require "rubycritic/generators/html_report"
16
+ require 'rubycritic/generators/html_report'
18
17
  Generator::HtmlReport
19
18
  end
20
19
  end
21
20
  end
22
-
23
21
  end
@@ -1,13 +1,12 @@
1
- require "rubycritic/serializer"
2
- require "rubycritic/analysers_runner"
3
- require "rubycritic/smells_status_setter"
4
- require "rubycritic/version"
5
- require "digest/md5"
1
+ require 'rubycritic/serializer'
2
+ require 'rubycritic/analysers_runner'
3
+ require 'rubycritic/smells_status_setter'
4
+ require 'rubycritic/version'
5
+ require 'digest/md5'
6
6
 
7
7
  module Rubycritic
8
-
9
8
  class RevisionComparator
10
- SNAPSHOTS_DIR_NAME = "snapshots"
9
+ SNAPSHOTS_DIR_NAME = 'snapshots'.freeze
11
10
 
12
11
  def initialize(paths)
13
12
  @paths = paths
@@ -49,5 +48,4 @@ module Rubycritic
49
48
  )
50
49
  end
51
50
  end
52
-
53
51
  end
@@ -1,7 +1,6 @@
1
- require "fileutils"
1
+ require 'fileutils'
2
2
 
3
3
  module Rubycritic
4
-
5
4
  class Serializer
6
5
  def initialize(file)
7
6
  @file = file
@@ -13,7 +12,7 @@ module Rubycritic
13
12
 
14
13
  def dump(content)
15
14
  create_file_directory
16
- File.open(@file, "w+") do |file|
15
+ File.open(@file, 'w+') do |file|
17
16
  Marshal.dump(content, file)
18
17
  end
19
18
  end
@@ -28,5 +27,4 @@ module Rubycritic
28
27
  File.dirname(@file)
29
28
  end
30
29
  end
31
-
32
30
  end
@@ -1,5 +1,4 @@
1
1
  module Rubycritic
2
-
3
2
  module SmellsStatusSetter
4
3
  def self.set(smells_before, smells_now)
5
4
  old_smells = smells_now & smells_before
@@ -8,11 +7,10 @@ module Rubycritic
8
7
  set_status(new_smells, :new)
9
8
  end
10
9
 
11
- private
12
-
13
10
  def self.set_status(smells, status)
14
11
  smells.each { |smell| smell.status = status }
15
12
  end
16
- end
17
13
 
14
+ private_class_method :set_status
15
+ end
18
16
  end
@@ -1,8 +1,7 @@
1
- require "shellwords"
1
+ require 'shellwords'
2
2
 
3
3
  module Rubycritic
4
4
  module SourceControlSystem
5
-
6
5
  class Base
7
6
  @@systems = []
8
7
 
@@ -28,10 +27,9 @@ module Rubycritic
28
27
  "#{systems[0...-1].join(', ')} or #{systems[-1]}"
29
28
  end
30
29
  end
31
-
32
30
  end
33
31
  end
34
32
 
35
- require "rubycritic/source_control_systems/double"
36
- require "rubycritic/source_control_systems/git"
37
- require "rubycritic/source_control_systems/mercurial"
33
+ require 'rubycritic/source_control_systems/double'
34
+ require 'rubycritic/source_control_systems/git'
35
+ require 'rubycritic/source_control_systems/mercurial'
@@ -2,7 +2,7 @@ module Rubycritic
2
2
  module SourceControlSystem
3
3
  class Double < Base
4
4
  def revisions_count(_)
5
- "N/A"
5
+ 'N/A'
6
6
  end
7
7
 
8
8
  def date_of_last_commit(_)
@@ -13,6 +13,5 @@ module Rubycritic
13
13
  false
14
14
  end
15
15
  end
16
-
17
16
  end
18
17
  end
@@ -1,6 +1,5 @@
1
1
  module Rubycritic
2
2
  module SourceControlSystem
3
-
4
3
  class Git < Base
5
4
  register_system
6
5
 
@@ -9,7 +8,7 @@ module Rubycritic
9
8
  end
10
9
 
11
10
  def self.to_s
12
- "Git"
11
+ 'Git'
13
12
  end
14
13
 
15
14
  def revisions_count(path)
@@ -52,6 +51,5 @@ module Rubycritic
52
51
  `git stash pop`
53
52
  end
54
53
  end
55
-
56
54
  end
57
55
  end
@@ -1,6 +1,5 @@
1
1
  module Rubycritic
2
2
  module SourceControlSystem
3
-
4
3
  class Mercurial < Base
5
4
  register_system
6
5
 
@@ -9,7 +8,7 @@ module Rubycritic
9
8
  end
10
9
 
11
10
  def self.to_s
12
- "Mercurial"
11
+ 'Mercurial'
13
12
  end
14
13
 
15
14
  def revisions_count(path)
@@ -24,6 +23,5 @@ module Rubycritic
24
23
  false
25
24
  end
26
25
  end
27
-
28
26
  end
29
27
  end
@@ -1,10 +1,9 @@
1
- require "pathname"
1
+ require 'pathname'
2
2
 
3
3
  module Rubycritic
4
-
5
4
  class SourceLocator
6
- RUBY_EXTENSION = ".rb"
7
- RUBY_FILES = File.join("**", "*#{RUBY_EXTENSION}")
5
+ RUBY_EXTENSION = '.rb'.freeze
6
+ RUBY_FILES = File.join('**', "*#{RUBY_EXTENSION}")
8
7
 
9
8
  def initialize(paths)
10
9
  @initial_paths = Array(paths)
@@ -22,9 +21,9 @@ module Rubycritic
22
21
 
23
22
  def deduplicate_symlinks(path_list)
24
23
  # sort the symlinks to the end so files are preferred
25
- path_list.sort_by! { |path| File.symlink?(path.cleanpath) ? "z" : "a" }
24
+ path_list.sort_by! { |path| File.symlink?(path.cleanpath) ? 'z' : 'a' }
26
25
  if defined?(JRUBY_VERSION)
27
- require "java"
26
+ require 'java'
28
27
  path_list.uniq! do |path|
29
28
  java.io.File.new(path.realpath.to_s).canonical_path
30
29
  end
@@ -1,3 +1,3 @@
1
1
  module Rubycritic
2
- VERSION = "2.6.0"
2
+ VERSION = '2.7.0'.freeze
3
3
  end
@@ -1,37 +1,38 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "rubycritic/version"
4
+ require 'rubycritic/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "rubycritic"
7
+ spec.name = 'rubycritic'
8
8
  spec.version = Rubycritic::VERSION
9
- spec.authors = ["Guilherme Simoes"]
10
- spec.email = ["guilherme.rdems@gmail.com"]
11
- spec.description = "RubyCritic is a tool that wraps around various static analysis gems "\
12
- "to provide a quality report of your Ruby code."
13
- spec.summary = "RubyCritic is a Ruby code quality reporter"
14
- spec.homepage = "https://github.com/whitesmith/rubycritic"
15
- spec.license = "MIT"
16
- spec.required_ruby_version = ">= 2.0.0"
9
+ spec.authors = ['Guilherme Simoes']
10
+ spec.email = ['guilherme.rdems@gmail.com']
11
+ spec.description = 'RubyCritic is a tool that wraps around various static analysis gems '\
12
+ 'to provide a quality report of your Ruby code.'
13
+ spec.summary = 'RubyCritic is a Ruby code quality reporter'
14
+ spec.homepage = 'https://github.com/whitesmith/rubycritic'
15
+ spec.license = 'MIT'
16
+ spec.required_ruby_version = '>= 2.0.0'
17
17
 
18
18
  spec.files = `git ls-files`.split("\n")
19
19
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  spec.test_files = `git ls-files -- test/*`.split("\n")
21
- spec.require_path = "lib"
21
+ spec.require_path = 'lib'
22
22
 
23
- spec.add_runtime_dependency "virtus", "~> 1.0"
24
- spec.add_runtime_dependency "flay", "2.6.1"
25
- spec.add_runtime_dependency "flog", "4.3.2"
26
- spec.add_runtime_dependency "reek", "3.8.1"
27
- spec.add_runtime_dependency "parser", ">= 2.2.0", "< 3.0"
28
- spec.add_runtime_dependency "colorize"
23
+ spec.add_runtime_dependency 'virtus', '~> 1.0'
24
+ spec.add_runtime_dependency 'flay', '2.6.1'
25
+ spec.add_runtime_dependency 'flog', '4.3.2'
26
+ spec.add_runtime_dependency 'reek', '3.9.1'
27
+ spec.add_runtime_dependency 'parser', '~> 2.3'
28
+ spec.add_runtime_dependency 'colorize'
29
+ spec.add_runtime_dependency 'launchy', '2.4.3'
29
30
 
30
- spec.add_development_dependency "aruba"
31
- spec.add_development_dependency "bundler", "~> 1.3"
32
- spec.add_development_dependency "cucumber"
33
- spec.add_development_dependency "rake"
34
- spec.add_development_dependency "minitest", "~> 5.3"
35
- spec.add_development_dependency "mocha", "~> 1.0"
36
- spec.add_development_dependency "rubocop", "0.29.0"
31
+ spec.add_development_dependency 'aruba'
32
+ spec.add_development_dependency 'bundler', '~> 1.3'
33
+ spec.add_development_dependency 'cucumber'
34
+ spec.add_development_dependency 'rake'
35
+ spec.add_development_dependency 'minitest', '~> 5.3'
36
+ spec.add_development_dependency 'mocha', '~> 1.0'
37
+ spec.add_development_dependency 'rubocop', '0.36.0'
37
38
  end
@@ -1,3 +1,3 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  class AnalysedModuleDouble < OpenStruct; end
@@ -1,23 +1,23 @@
1
- require "analysers_test_helper"
2
- require "rubycritic/analysers/churn"
3
- require "rubycritic/source_control_systems/base"
1
+ require 'analysers_test_helper'
2
+ require 'rubycritic/analysers/churn'
3
+ require 'rubycritic/source_control_systems/base'
4
4
 
5
5
  describe Rubycritic::Analyser::Churn do
6
- context "when analysing a file" do
6
+ context 'when analysing a file' do
7
7
  before do
8
- @analysed_module = AnalysedModuleDouble.new(:path => "path_to_some_file.rb")
8
+ @analysed_module = AnalysedModuleDouble.new(path: 'path_to_some_file.rb')
9
9
  analysed_modules = [@analysed_module]
10
10
  analyser = Rubycritic::Analyser::Churn.new(analysed_modules)
11
11
  analyser.source_control_system = SourceControlSystemDouble.new
12
12
  analyser.run
13
13
  end
14
14
 
15
- it "calculates its churn" do
15
+ it 'calculates its churn' do
16
16
  @analysed_module.churn.must_equal 1
17
17
  end
18
18
 
19
- it "determines the date of its last commit" do
20
- @analysed_module.committed_at.must_equal "2013-10-09 12:52:49 +0100"
19
+ it 'determines the date of its last commit' do
20
+ @analysed_module.committed_at.must_equal '2013-10-09 12:52:49 +0100'
21
21
  end
22
22
  end
23
23
  end
@@ -28,6 +28,6 @@ class SourceControlSystemDouble < Rubycritic::SourceControlSystem::Base
28
28
  end
29
29
 
30
30
  def date_of_last_commit(_path)
31
- "2013-10-09 12:52:49 +0100"
31
+ '2013-10-09 12:52:49 +0100'
32
32
  end
33
33
  end
@@ -1,15 +1,15 @@
1
- require "analysers_test_helper"
2
- require "rubycritic/analysers/complexity"
1
+ require 'analysers_test_helper'
2
+ require 'rubycritic/analysers/complexity'
3
3
 
4
4
  describe Rubycritic::Analyser::Complexity do
5
- context "when analysing a file" do
5
+ context 'when analysing a file' do
6
6
  before do
7
- @analysed_module = AnalysedModuleDouble.new(:path => "test/samples/flog/complex.rb", :smells => [])
7
+ @analysed_module = AnalysedModuleDouble.new(path: 'test/samples/flog/complex.rb', smells: [])
8
8
  analysed_modules = [@analysed_module]
9
9
  Rubycritic::Analyser::Complexity.new(analysed_modules).run
10
10
  end
11
11
 
12
- it "calculates its complexity" do
12
+ it 'calculates its complexity' do
13
13
  @analysed_module.complexity.must_be :>, 0
14
14
  end
15
15
  end
@@ -1,25 +1,25 @@
1
- require "analysers_test_helper"
2
- require "rubycritic/analysers/helpers/methods_counter"
1
+ require 'analysers_test_helper'
2
+ require 'rubycritic/analysers/helpers/methods_counter'
3
3
 
4
4
  describe Rubycritic::MethodsCounter do
5
- describe "#count" do
6
- context "when a file contains Ruby code" do
7
- it "calculates the number of methods" do
8
- analysed_module = AnalysedModuleDouble.new(:path => "test/samples/methods_count.rb")
5
+ describe '#count' do
6
+ context 'when a file contains Ruby code' do
7
+ it 'calculates the number of methods' do
8
+ analysed_module = AnalysedModuleDouble.new(path: 'test/samples/methods_count.rb')
9
9
  Rubycritic::MethodsCounter.new(analysed_module).count.must_equal 2
10
10
  end
11
11
  end
12
12
 
13
- context "when a file is empty" do
14
- it "returns 0 as the number of methods" do
15
- analysed_module = AnalysedModuleDouble.new(:path => "test/samples/empty.rb")
13
+ context 'when a file is empty' do
14
+ it 'returns 0 as the number of methods' do
15
+ analysed_module = AnalysedModuleDouble.new(path: 'test/samples/empty.rb')
16
16
  Rubycritic::MethodsCounter.new(analysed_module).count.must_equal 0
17
17
  end
18
18
  end
19
19
 
20
- context "when a file is unparsable" do
21
- it "does not blow up and returns 0 as the number of methods" do
22
- analysed_module = AnalysedModuleDouble.new(:path => "test/samples/unparsable.rb")
20
+ context 'when a file is unparsable' do
21
+ it 'does not blow up and returns 0 as the number of methods' do
22
+ analysed_module = AnalysedModuleDouble.new(path: 'test/samples/unparsable.rb')
23
23
  capture_output_streams do
24
24
  Rubycritic::MethodsCounter.new(analysed_module).count.must_equal 0
25
25
  end
@@ -1,51 +1,51 @@
1
- require "test_helper"
2
- require "rubycritic/analysers/helpers/modules_locator"
3
- require "rubycritic/core/analysed_module"
4
- require "pathname"
1
+ require 'test_helper'
2
+ require 'rubycritic/analysers/helpers/modules_locator'
3
+ require 'rubycritic/core/analysed_module'
4
+ require 'pathname'
5
5
 
6
6
  describe Rubycritic::ModulesLocator do
7
- describe "#names" do
8
- context "when a file contains Ruby code" do
9
- it "returns the names of all the classes and modules inside the file" do
7
+ describe '#names' do
8
+ context 'when a file contains Ruby code' do
9
+ it 'returns the names of all the classes and modules inside the file' do
10
10
  analysed_module = Rubycritic::AnalysedModule.new(
11
- :pathname => Pathname.new("test/samples/module_names.rb"),
12
- :methods_count => 1
11
+ pathname: Pathname.new('test/samples/module_names.rb'),
12
+ methods_count: 1
13
13
  )
14
14
  Rubycritic::ModulesLocator.new(analysed_module).names
15
- .must_equal ["Foo", "Foo::Bar", "Foo::Baz", "Foo::Qux", "Foo::Quux::Corge"]
15
+ .must_equal ['Foo', 'Foo::Bar', 'Foo::Baz', 'Foo::Qux', 'Foo::Quux::Corge']
16
16
  end
17
17
  end
18
18
 
19
- context "when a file is empty" do
20
- it "returns the name of the file titleized" do
19
+ context 'when a file is empty' do
20
+ it 'returns the name of the file titleized' do
21
21
  analysed_module = Rubycritic::AnalysedModule.new(
22
- :pathname => Pathname.new("test/samples/empty.rb"),
23
- :methods_count => 1
22
+ pathname: Pathname.new('test/samples/empty.rb'),
23
+ methods_count: 1
24
24
  )
25
- Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ["Empty"]
25
+ Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ['Empty']
26
26
  end
27
27
  end
28
28
 
29
- context "when a file is unparsable" do
30
- it "does not blow up and returns the name of the file titleized" do
29
+ context 'when a file is unparsable' do
30
+ it 'does not blow up and returns the name of the file titleized' do
31
31
  analysed_module = Rubycritic::AnalysedModule.new(
32
- :pathname => Pathname.new("test/samples/unparsable.rb"),
33
- :methods_count => 1
32
+ pathname: Pathname.new('test/samples/unparsable.rb'),
33
+ methods_count: 1
34
34
  )
35
35
  capture_output_streams do
36
- Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ["Unparsable"]
36
+ Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ['Unparsable']
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
- context "when a file has no methods" do
42
- it "returns the names of all the classes and modules inside the file" do
41
+ context 'when a file has no methods' do
42
+ it 'returns the names of all the classes and modules inside the file' do
43
43
  analysed_module = Rubycritic::AnalysedModule.new(
44
- :pathname => Pathname.new("test/samples/no_methods.rb"),
45
- :methods_count => 0
44
+ pathname: Pathname.new('test/samples/no_methods.rb'),
45
+ methods_count: 0
46
46
  )
47
47
  capture_output_streams do
48
- Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ["Foo::NoMethods"]
48
+ Rubycritic::ModulesLocator.new(analysed_module).names.must_equal ['Foo::NoMethods']
49
49
  end
50
50
  end
51
51
  end