diff --git a/.rubocop.yml b/.rubocop.yml index dbe848e0..1ae42a4a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -41,6 +41,8 @@ Jekyll/NoPutsAllowed: # ---------------------------------------- Gemspec/DeprecatedAttributeAssignment: Enabled: true +Gemspec/DevelopmentDependencies: + Enabled: false Gemspec/RequireMFA: Enabled: false @@ -54,6 +56,8 @@ Layout/EmptyLinesAroundAttributeAccessor: Enabled: true Layout/EndAlignment: Severity: error +Layout/EndOfLine: + Enabled: false Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/FirstHashElementIndentation: @@ -113,6 +117,10 @@ Lint/DuplicateBranch: Enabled: true Lint/DuplicateElsifCondition: Enabled: true +Lint/DuplicateMagicComment: + Enabled: true +Lint/DuplicateMatchPattern: + Enabled: true Lint/DuplicateRegexpCharacterClassElement: Enabled: true Lint/DuplicateRequire: @@ -137,6 +145,8 @@ Lint/LambdaWithoutLiteralBlock: Enabled: true Lint/MissingSuper: Enabled: false +Lint/MixedCaseRange: + Enabled: true Lint/MixedRegexpCaptureTypes: Enabled: false Lint/NestedPercentLiteral: @@ -154,8 +164,12 @@ Lint/RaiseException: Enabled: true Lint/RedundantDirGlobSort: Enabled: true +Lint/RedundantRegexpQuantifiers: + Enabled: true Lint/RedundantSafeNavigation: Enabled: true +Lint/RefinementImportMethods: + Enabled: true Lint/RequireRangeParentheses: Enabled: true Lint/RequireRelativeSelfPath: @@ -184,6 +198,8 @@ Lint/UnreachableLoop: Enabled: true Lint/UselessMethodDefinition: Enabled: true +Lint/UselessRuby2Keywords: + Enabled: true Lint/UselessTimes: Enabled: true Lint/Void: @@ -208,6 +224,8 @@ Metrics/ClassLength: - lib/jekyll/site.rb - test/**/*.rb Max: 240 +Metrics/CollectionLiteralLength: + Enabled: true Metrics/CyclomaticComplexity: Exclude: - lib/jekyll/commands/serve.rb @@ -234,32 +252,70 @@ Minitest/AssertInDelta: Enabled: true Minitest/AssertKindOf: Enabled: true +Minitest/AssertOperator: + Enabled: false Minitest/AssertOutput: Enabled: true Minitest/AssertPathExists: Enabled: true +Minitest/AssertPredicate: + Enabled: false +Minitest/AssertRaisesWithRegexpArgument: + Enabled: true +Minitest/AssertSame: + Enabled: true Minitest/AssertSilent: Enabled: true Minitest/AssertWithExpectedArgument: Enabled: true Minitest/AssertionInLifecycleHook: Enabled: true +Minitest/DuplicateTestRun: + Enabled: true +Minitest/EmptyLineBeforeAssertionMethods: + Enabled: false +Minitest/LifecycleHooksOrder: + Enabled: true Minitest/LiteralAsActualArgument: Enabled: true Minitest/MultipleAssertions: Enabled: true +Minitest/NonExecutableTestMethod: + Enabled: true +Minitest/NonPublicTestMethod: + Enabled: true +Minitest/RedundantMessageArgument: + Enabled: true Minitest/RefuteInDelta: Enabled: true Minitest/RefuteKindOf: Enabled: true +Minitest/RefuteOperator: + Enabled: false Minitest/RefutePathExists: Enabled: true +Minitest/RefutePredicate: + Enabled: false +Minitest/RefuteSame: + Enabled: true +Minitest/ReturnInTestMethod: + Enabled: true +Minitest/SkipEnsure: + Enabled: true +Minitest/SkipWithoutReason: + Enabled: true +Minitest/TestFileName: + Enabled: true + Exclude: + - test/helper.rb Minitest/TestMethodName: Enabled: false Minitest/UnreachableAssertion: Enabled: true Minitest/UnspecifiedException: Enabled: true +Minitest/UselessAssertion: + Enabled: true # Naming cops # ---------------------------------------- @@ -293,6 +349,8 @@ Performance/ConstantRegexp: Enabled: true Performance/MapCompact: Enabled: true +Performance/MapMethodChain: + Enabled: true Performance/MethodObjectAsBlock: Enabled: true Performance/RedundantEqualityComparisonBlock: @@ -347,6 +405,8 @@ Style/ArgumentsForwarding: Enabled: false Style/ArrayCoercion: Enabled: true +Style/ArrayIntersect: + Enabled: true Style/BisectedAttrAccessor: Enabled: true Style/CaseLikeIf: @@ -360,6 +420,10 @@ Style/CollectionCompact: Enabled: true Style/CombinableLoops: Enabled: true +Style/ConcatArrayLiterals: + Enabled: true +Style/DirEmpty: + Enabled: true Style/DocumentDynamicEvalDefinition: Enabled: true Style/Documentation: @@ -372,12 +436,16 @@ Style/EndlessMethod: Enabled: true Style/EnvHome: Enabled: true +Style/ExactRegexpMatch: + Enabled: true Style/ExplicitBlockArgument: Enabled: false Style/ExponentialNotation: Enabled: true Style/FetchEnvVar: Enabled: false +Style/FileEmpty: + Enabled: true Style/FileRead: Enabled: false Style/FileWrite: @@ -435,6 +503,10 @@ Style/NestedFileDirname: Enabled: true Style/NilLambda: Enabled: true +Style/ObjectThen: + Enabled: true +Style/OperatorMethodCall: + Enabled: true Style/OptionalBooleanParameter: Enabled: true Exclude: @@ -452,28 +524,52 @@ Style/QuotedSymbols: Enabled: true Style/RedundantArgument: Enabled: true +Style/RedundantArrayConstructor: + Enabled: true Style/RedundantAssignment: Enabled: true +Style/RedundantConstantBase: + Enabled: true +Style/RedundantCurrentDirectoryInPath: + Enabled: true +Style/RedundantDoubleSplatHashBraces: + Enabled: true +Style/RedundantEach: + Enabled: true Style/RedundantFetchBlock: Enabled: false Style/RedundantFileExtensionInRequire: Enabled: true +Style/RedundantFilterChain: + Enabled: true +Style/RedundantHeredocDelimiterQuotes: + Enabled: true Style/RedundantInitialize: Enabled: true Exclude: - lib/jekyll/plugin.rb +Style/RedundantLineContinuation: + Enabled: true +Style/RedundantRegexpArgument: + Enabled: true Style/RedundantRegexpCharacterClass: Enabled: true +Style/RedundantRegexpConstructor: + Enabled: true Style/RedundantRegexpEscape: Enabled: true Style/RedundantSelfAssignment: Enabled: true Style/RedundantSelfAssignmentBranch: Enabled: true +Style/RedundantStringEscape: + Enabled: true Style/RegexpLiteral: EnforcedStyle: percent_r Style/RescueModifier: Enabled: false +Style/ReturnNilInPredicateMethodDefinition: + Enabled: true Style/SafeNavigation: Exclude: - lib/jekyll/document.rb @@ -482,6 +578,8 @@ Style/SignalException: EnforcedStyle: only_raise Style/SingleArgumentDig: Enabled: true +Style/SingleLineDoEndBlock: + Enabled: true Style/SlicingWithRange: Enabled: false Style/SoleNestedConditional: diff --git a/lib/jekyll/plugin_manager.rb b/lib/jekyll/plugin_manager.rb index 84c555ab..810a2fa1 100644 --- a/lib/jekyll/plugin_manager.rb +++ b/lib/jekyll/plugin_manager.rb @@ -83,7 +83,7 @@ module Jekyll # Returns an array of strings, each string being the name of a gem name # that is allowed to be used. def whitelist - @whitelist ||= Array[site.config["whitelist"]].flatten + @whitelist ||= [site.config["whitelist"]].flatten end # Require all .rb files if safe mode is off diff --git a/test/test_tag_link.rb b/test/test_tag_link.rb index e0d2a714..a5ffaf22 100644 --- a/test/test_tag_link.rb +++ b/test/test_tag_link.rb @@ -78,7 +78,7 @@ class TestTagLink < TagUnitTest {% assign contacts_ext = 'html' %} {% link {{contacts_filename}}.{{contacts_ext}} %} {% assign info_path = 'info.md' %} - {% link {{\ info_path\ }} %} + {% link {{ info_path }} %} {% assign screen_css_path = '/css' %} {% link {{ screen_css_path }}/screen.css %} CONTENT @@ -195,7 +195,7 @@ class TestTagLink < TagUnitTest --- {% assign non_existent_path = 'non-existent-collection-item' %} - {% link {{\ non_existent_path\ }} %} + {% link {{ non_existent_path }} %} CONTENT assert_raises ArgumentError do diff --git a/test/test_utils.rb b/test/test_utils.rb index ad5b43fa..f282cb38 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -3,7 +3,7 @@ require "helper" class TestUtils < JekyllUnitTest - context "The \`Utils.deep_merge_hashes\` method" do + context "The `Utils.deep_merge_hashes` method" do setup do clear_dest @site = fixture_site @@ -89,7 +89,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.parse_date\` method" do + context "The `Utils.parse_date` method" do should "parse a properly formatted date" do assert_kind_of Time, Utils.parse_date("2014-08-02 14:43:06 PDT") end @@ -128,7 +128,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.slugify\` method" do + context "The `Utils.slugify` method" do should "return nil if passed nil" do assert_nil Utils.slugify(nil) rescue NoMethodError @@ -292,7 +292,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.titleize_slug\` method" do + context "The `Utils.titleize_slug` method" do should "capitalize all words and not drop any words" do assert_equal( "This Is A Long Title With Mixed Capitalization", @@ -309,7 +309,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.add_permalink_suffix\` method" do + context "The `Utils.add_permalink_suffix` method" do should "handle built-in permalink styles" do assert_equal( "/:basename/", @@ -345,7 +345,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.safe_glob\` method" do + context "The `Utils.safe_glob` method" do should "not apply pattern to the dir" do dir = "test/safe_glob_test[" assert_equal [], Dir.glob(dir + "/*") unless jruby? @@ -383,7 +383,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.has_yaml_header?\` method" do + context "The `Utils.has_yaml_header?` method" do should "accept files with YAML front matter" do file = source_dir("_posts", "2008-10-18-foo-bar.markdown") assert_equal "---\n", File.open(file, "rb") { |f| f.read(4) } @@ -401,7 +401,7 @@ class TestUtils < JekyllUnitTest end end - context "The \`Utils.merged_file_read_opts\` method" do + context "The `Utils.merged_file_read_opts` method" do should "ignore encoding if it's not there" do opts = Utils.merged_file_read_opts(nil, {}) assert_nil opts["encoding"]