From 674e8f51543747be2772cbecc4556a537ab9ff5d Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Tue, 12 Sep 2023 17:30:23 +0100 Subject: [PATCH 1/2] (CAT-1404) - Regenerate .rubocop_todo.yml Signed-off-by: Gavin Didrichsen --- .rubocop_todo.yml | 69 +++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b91c658b..998d705e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,20 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-13 12:45:07 UTC using RuboCop version 1.50.1. +# on 2023-09-12 16:29:51 UTC using RuboCop version 1.56.3. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -Naming/FileName: - Exclude: - - 'lib/puppet-strings.rb' - -Naming/MethodName: - Exclude: - - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - - 'lib/puppet-strings/yard/parsers/puppet/parser.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Severity, Include. @@ -23,16 +14,16 @@ Gemspec/RequireMFA: Exclude: - 'puppet-strings.gemspec' -# Offense count: 46 +# Offense count: 45 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 98 + Max: 95 -# Offense count: 11 +# Offense count: 10 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: - Max: 119 + Max: 44 # Offense count: 1 # Configuration parameters: CountBlocks. @@ -44,23 +35,23 @@ Metrics/BlockNesting: Metrics/ClassLength: Max: 283 -# Offense count: 33 +# Offense count: 34 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 36 -# Offense count: 44 +# Offense count: 42 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 75 -# Offense count: 2 +# Offense count: 3 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: MaxOptionalParameters: 5 Max: 10 -# Offense count: 28 +# Offense count: 29 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 37 @@ -71,6 +62,14 @@ Naming/AccessorMethodName: - 'lib/puppet-strings/yard/handlers/puppet/base.rb' - 'lib/puppet-strings/yard/handlers/ruby/type_base.rb' +# Offense count: 1 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'lib/puppet-strings.rb' + # Offense count: 1 # Configuration parameters: ForbiddenDelimiters. # ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) @@ -78,6 +77,12 @@ Naming/HeredocDelimiterNaming: Exclude: - 'spec/acceptance/generate_markdown_spec.rb' +# Offense count: 24 +# Configuration parameters: AllowedPatterns. +# SupportedStyles: snake_case, camelCase +Naming/MethodName: + EnforcedStyle: snake_case + # Offense count: 24 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to @@ -96,9 +101,9 @@ Performance/CollectionLiteralInLoop: # Offense count: 1 RSpec/BeforeAfterAll: Exclude: - - 'spec/spec_helper.rb' - - 'spec/rails_helper.rb' - - 'spec/support/**/*.rb' + - '**/spec/spec_helper.rb' + - '**/spec/rails_helper.rb' + - '**/spec/support/**/*.rb' - 'spec/acceptance/running_strings_generate_spec.rb' # Offense count: 7 @@ -124,7 +129,7 @@ RSpec/DescribeClass: - 'spec/acceptance/generate_markdown_spec.rb' - 'spec/acceptance/running_strings_generate_spec.rb' -# Offense count: 48 +# Offense count: 51 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 66 @@ -134,12 +139,6 @@ RSpec/ExpectInHook: Exclude: - 'spec/unit/puppet-strings/json_spec.rb' -# Offense count: 20 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. -# Include: **/*_spec*rb*, **/spec/**/* -RSpec/FilePath: - Enabled: false - # Offense count: 91 RSpec/MultipleExpectations: Max: 64 @@ -154,24 +153,30 @@ RSpec/RepeatedExampleGroupDescription: Exclude: - 'spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb' +# Offense count: 20 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. +# Include: **/*_spec.rb +RSpec/SpecFilePathFormat: + Enabled: false + # Offense count: 1 Style/ClassVars: Exclude: - 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb' # Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). Style/CombinableLoops: Exclude: - 'lib/puppet-strings/markdown.rb' - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - - 'lib/puppet-strings/tasks/generate.rb' # Offense count: 1 Style/MixinUsage: Exclude: - 'spec/acceptance/running_strings_generate_spec.rb' -# Offense count: 17 +# Offense count: 20 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: @@ -190,9 +195,9 @@ Style/OptionalBooleanParameter: - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb' -# Offense count: 139 +# Offense count: 136 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: - Max: 200 + Max: 199 From 6718f5b3760ed1d49a14f8aedae7a206e06ac33b Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Tue, 12 Sep 2023 18:05:30 +0100 Subject: [PATCH 2/2] Ignore the rubocop Naming/MethodName violation. Signed-off-by: Gavin Didrichsen --- lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb | 3 +++ lib/puppet-strings/yard/parsers/puppet/parser.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb index 7268d466..20c85692 100644 --- a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +++ b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb @@ -143,6 +143,8 @@ def literal(ast) @literal_visitor.visit_this_0(self, ast) end + # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines + # rubocop:disable Naming/MethodName # ----- The following methods are different/additions from the original Literal_evaluator def literal_Object(o) # Ignore any other object types @@ -214,6 +216,7 @@ def literal_LiteralHash(o) result[literal(entry.key)] = literal(entry.value) end end + # rubocop:enable Naming/MethodName end # Extracts the datatype attributes from a Puppet Data Type interface hash. diff --git a/lib/puppet-strings/yard/parsers/puppet/parser.rb b/lib/puppet-strings/yard/parsers/puppet/parser.rb index 98f4e302..7d227bfd 100644 --- a/lib/puppet-strings/yard/parsers/puppet/parser.rb +++ b/lib/puppet-strings/yard/parsers/puppet/parser.rb @@ -40,6 +40,8 @@ def enumerator private + # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines + # rubocop:disable Naming/MethodName def transform_Program(o) # Cache the lines of the source text; we'll use this to locate comments @lines = o.source_text.lines.to_a @@ -83,4 +85,5 @@ def transform_TypeAlias(o) def transform_Object(o) # Ignore anything else (will be compacted out of the resulting array) end + # rubocop:enable Naming/MethodName end