diff --git a/spec/ameba/base_spec.cr b/spec/ameba/base_spec.cr index c765168b..e643a558 100644 --- a/spec/ameba/base_spec.cr +++ b/spec/ameba/base_spec.cr @@ -15,6 +15,7 @@ module Ameba::Rule Layout Lint Metrics + Naming Performance Style ) diff --git a/spec/ameba/rule/style/constant_names_spec.cr b/spec/ameba/rule/naming/constant_names_spec.cr similarity index 88% rename from spec/ameba/rule/style/constant_names_spec.cr rename to spec/ameba/rule/naming/constant_names_spec.cr index 23048382..6cbce95e 100644 --- a/spec/ameba/rule/style/constant_names_spec.cr +++ b/spec/ameba/rule/naming/constant_names_spec.cr @@ -1,11 +1,11 @@ require "../../../spec_helper" module Ameba - subject = Rule::Style::ConstantNames.new + subject = Rule::Naming::ConstantNames.new private def it_reports_constant(name, value, expected, *, file = __FILE__, line = __LINE__) it "reports constant name #{expected}", file, line do - rule = Rule::Style::ConstantNames.new + rule = Rule::Naming::ConstantNames.new expect_issue rule, <<-CRYSTAL, name: name, file: file, line: line %{name} = #{value} # ^{name} error: Constant name should be screaming-cased: #{expected}, not #{name} @@ -13,7 +13,7 @@ module Ameba end end - describe Rule::Style::ConstantNames do + describe Rule::Naming::ConstantNames do it "passes if type names are screaming-cased" do expect_no_issues subject, <<-CRYSTAL LUCKY_NUMBERS = [3, 7, 11] diff --git a/spec/ameba/rule/style/method_names_spec.cr b/spec/ameba/rule/naming/method_names_spec.cr similarity index 88% rename from spec/ameba/rule/style/method_names_spec.cr rename to spec/ameba/rule/naming/method_names_spec.cr index c9729dc4..df664cec 100644 --- a/spec/ameba/rule/style/method_names_spec.cr +++ b/spec/ameba/rule/naming/method_names_spec.cr @@ -1,11 +1,11 @@ require "../../../spec_helper" module Ameba - subject = Rule::Style::MethodNames.new + subject = Rule::Naming::MethodNames.new private def it_reports_method_name(name, expected, *, file = __FILE__, line = __LINE__) it "reports method name #{expected}", file, line do - rule = Rule::Style::MethodNames.new + rule = Rule::Naming::MethodNames.new expect_issue rule, <<-CRYSTAL, name: name, file: file, line: line def %{name}; end # ^{name} error: Method name should be underscore-cased: #{expected}, not %{name} @@ -13,7 +13,7 @@ module Ameba end end - describe Rule::Style::MethodNames do + describe Rule::Naming::MethodNames do it "passes if method names are underscore-cased" do expect_no_issues subject, <<-CRYSTAL class Person diff --git a/spec/ameba/rule/style/predicate_name_spec.cr b/spec/ameba/rule/naming/predicate_name_spec.cr similarity index 96% rename from spec/ameba/rule/style/predicate_name_spec.cr rename to spec/ameba/rule/naming/predicate_name_spec.cr index 46e37fb6..8386b5cc 100644 --- a/spec/ameba/rule/style/predicate_name_spec.cr +++ b/spec/ameba/rule/naming/predicate_name_spec.cr @@ -1,6 +1,6 @@ require "../../../spec_helper" -module Ameba::Rule::Style +module Ameba::Rule::Naming subject = PredicateName.new describe PredicateName do diff --git a/spec/ameba/rule/style/query_bool_methods_spec.cr b/spec/ameba/rule/naming/query_bool_methods_spec.cr similarity index 98% rename from spec/ameba/rule/style/query_bool_methods_spec.cr rename to spec/ameba/rule/naming/query_bool_methods_spec.cr index 5c71ec51..8d4710d0 100644 --- a/spec/ameba/rule/style/query_bool_methods_spec.cr +++ b/spec/ameba/rule/naming/query_bool_methods_spec.cr @@ -1,6 +1,6 @@ require "../../../spec_helper" -module Ameba::Rule::Style +module Ameba::Rule::Naming subject = QueryBoolMethods.new describe QueryBoolMethods do diff --git a/spec/ameba/rule/style/type_names_spec.cr b/spec/ameba/rule/naming/type_names_spec.cr similarity index 92% rename from spec/ameba/rule/style/type_names_spec.cr rename to spec/ameba/rule/naming/type_names_spec.cr index 31a84d39..aa96f649 100644 --- a/spec/ameba/rule/style/type_names_spec.cr +++ b/spec/ameba/rule/naming/type_names_spec.cr @@ -1,11 +1,11 @@ require "../../../spec_helper" module Ameba - subject = Rule::Style::TypeNames.new + subject = Rule::Naming::TypeNames.new private def it_reports_name(type, name, expected, *, file = __FILE__, line = __LINE__) it "reports type name #{expected}", file, line do - rule = Rule::Style::TypeNames.new + rule = Rule::Naming::TypeNames.new expect_issue rule, <<-CRYSTAL, type: type, name: name, file: file, line: line %{type} %{name}; end # ^{type}^{name}^^^^ error: Type name should be camelcased: #{expected}, but it was %{name} @@ -13,7 +13,7 @@ module Ameba end end - describe Rule::Style::TypeNames do + describe Rule::Naming::TypeNames do it "passes if type names are camelcased" do expect_no_issues subject, <<-CRYSTAL class ParseError < Exception diff --git a/spec/ameba/rule/style/variable_names_spec.cr b/spec/ameba/rule/naming/variable_names_spec.cr similarity index 93% rename from spec/ameba/rule/style/variable_names_spec.cr rename to spec/ameba/rule/naming/variable_names_spec.cr index 7add818e..586dc51c 100644 --- a/spec/ameba/rule/style/variable_names_spec.cr +++ b/spec/ameba/rule/naming/variable_names_spec.cr @@ -1,11 +1,11 @@ require "../../../spec_helper" module Ameba - subject = Rule::Style::VariableNames.new + subject = Rule::Naming::VariableNames.new private def it_reports_var_name(name, value, expected, *, file = __FILE__, line = __LINE__) it "reports variable name #{expected}", file, line do - rule = Rule::Style::VariableNames.new + rule = Rule::Naming::VariableNames.new expect_issue rule, <<-CRYSTAL, name: name, file: file, line: line %{name} = #{value} # ^{name} error: Var name should be underscore-cased: #{expected}, not %{name} @@ -13,7 +13,7 @@ module Ameba end end - describe Rule::Style::VariableNames do + describe Rule::Naming::VariableNames do it "passes if var names are underscore-cased" do expect_no_issues subject, <<-CRYSTAL class Greeting diff --git a/spec/ameba/runner_spec.cr b/spec/ameba/runner_spec.cr index a3e9cc54..f1fc904c 100644 --- a/spec/ameba/runner_spec.cr +++ b/spec/ameba/runner_spec.cr @@ -95,7 +95,7 @@ module Ameba end it "does not run other rules" do - rules = [Rule::Lint::Syntax.new, Rule::Style::ConstantNames.new] of Rule::Base + rules = [Rule::Lint::Syntax.new, Rule::Naming::ConstantNames.new] of Rule::Base source = Source.new <<-CRYSTAL MyBadConstant = 1 diff --git a/src/ameba/rule/style/constant_names.cr b/src/ameba/rule/naming/constant_names.cr similarity index 94% rename from src/ameba/rule/style/constant_names.cr rename to src/ameba/rule/naming/constant_names.cr index 3cc6a75d..76a09aee 100644 --- a/src/ameba/rule/style/constant_names.cr +++ b/src/ameba/rule/naming/constant_names.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that enforces constant names to be in screaming case. # # For example, these constant names are considered valid: @@ -18,7 +18,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/ConstantNames: + # Naming/ConstantNames: # Enabled: true # ``` class ConstantNames < Base diff --git a/src/ameba/rule/style/method_names.cr b/src/ameba/rule/naming/method_names.cr similarity index 95% rename from src/ameba/rule/style/method_names.cr rename to src/ameba/rule/naming/method_names.cr index dc85ec94..681fd8b5 100644 --- a/src/ameba/rule/style/method_names.cr +++ b/src/ameba/rule/naming/method_names.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that enforces method names to be in underscored case. # # For example, these are considered valid: @@ -34,7 +34,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/MethodNames: + # Naming/MethodNames: # Enabled: true # ``` class MethodNames < Base diff --git a/src/ameba/rule/style/predicate_name.cr b/src/ameba/rule/naming/predicate_name.cr similarity index 93% rename from src/ameba/rule/style/predicate_name.cr rename to src/ameba/rule/naming/predicate_name.cr index 567a7513..f37a8343 100644 --- a/src/ameba/rule/style/predicate_name.cr +++ b/src/ameba/rule/naming/predicate_name.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that disallows tautological predicate names - # meaning those that start with the prefix `is_`, except for # the ones that are not valid Crystal code (e.g. `is_404?`). @@ -20,7 +20,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/PredicateName: + # Naming/PredicateName: # Enabled: true # ``` class PredicateName < Base diff --git a/src/ameba/rule/style/query_bool_methods.cr b/src/ameba/rule/naming/query_bool_methods.cr similarity index 96% rename from src/ameba/rule/style/query_bool_methods.cr rename to src/ameba/rule/naming/query_bool_methods.cr index 4bd8c370..1cb9f59c 100644 --- a/src/ameba/rule/style/query_bool_methods.cr +++ b/src/ameba/rule/naming/query_bool_methods.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that disallows boolean properties without the `?` suffix - defined # using `Object#(class_)property` or `Object#(class_)getter` macros. # @@ -23,7 +23,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/QueryBoolMethods: + # Naming/QueryBoolMethods: # Enabled: true # ``` class QueryBoolMethods < Base diff --git a/src/ameba/rule/style/type_names.cr b/src/ameba/rule/naming/type_names.cr similarity index 96% rename from src/ameba/rule/style/type_names.cr rename to src/ameba/rule/naming/type_names.cr index 40d24697..59ce05a7 100644 --- a/src/ameba/rule/style/type_names.cr +++ b/src/ameba/rule/naming/type_names.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that enforces type names in camelcase manner. # # For example, these are considered valid: @@ -48,7 +48,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/TypeNames: + # Naming/TypeNames: # Enabled: true # ``` class TypeNames < Base diff --git a/src/ameba/rule/style/variable_names.cr b/src/ameba/rule/naming/variable_names.cr similarity index 96% rename from src/ameba/rule/style/variable_names.cr rename to src/ameba/rule/naming/variable_names.cr index e2ae8edf..061fc028 100644 --- a/src/ameba/rule/style/variable_names.cr +++ b/src/ameba/rule/naming/variable_names.cr @@ -1,4 +1,4 @@ -module Ameba::Rule::Style +module Ameba::Rule::Naming # A rule that enforces variable names to be in underscored case. # # For example, these variable names are considered valid: @@ -19,7 +19,7 @@ module Ameba::Rule::Style # YAML configuration example: # # ``` - # Style/VariableNames: + # Naming/VariableNames: # Enabled: true # ``` class VariableNames < Base